Repository navigation
feat(mcp-server-supabase): record a sql_classifier_call fact for each classifier call - #585
Open
barryroodt wants to merge 2 commits into
Open
barryroodt wants to merge 2 commits into
barryroodt wants to merge 2 commits into
Conversation
This was referenced Nov 20, 2026
Open
barryroodt
marked this pull request as ready for review
November 20, 2026 15:24
…fact Tests for one payload-free `sql_classifier_call` fact per classifier call, in execute_sql, apply_migration and run_notebook. They fail on this commit by design: nothing records the fact yet. - A shared table maps each classifier outcome to the fact's `result`, and the SQL tools and run_notebook run it on each path that classifies, including the state-error path and the notebook's resend paths. - A result that throws when read records `invalid`, bare and through withFallback. - A result whose failure kind changes while it is read records one fact with a fixed `result`, and the fact and the client's error describe the same outcome. - Requests cancelled while the classifier runs record `aborted`, run nothing and end as tool_error. - `durationMs` is pinned with a controlled clock. - Existing exact fact lists on paths that classify gain the new fact. Lists on paths that never ask the classifier are unchanged, so they still prove no fact is recorded there. - The packed consumer fixture expects the fact on its destructive SQL call, and its type check holds a sample for each feature.
… classifier call The classify step now records one payload-free fact when the classifier call settles: what it decided, how long it took, or how it failed. Before this, a call that failed in the classifier left no fact that said so. execute_sql and apply_migration record it under destructive_sql, run_notebook under notebook. An aborted request records aborted, whatever the classifier resolved or threw. A result outside the contract records invalid, also when reading it throws. The step derives the outcome once, from one checked read of the result, and maps both the fact and the reason or error from it, so the two always agree. Its return value and thrown errors are unchanged. The step's observation argument is required, so a new caller cannot leave the fact out by accident.
barryroodt
force-pushed
the
feat/sql-classifier-call-fact
branch
from
November 23, 2026 08:44
49979b0 to
d235d1d
Compare
barryroodt
force-pushed
the
feat/run-notebook-classify-step
branch
from
November 23, 2026 08:44
0de08fc to
d101ca5
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Final PR in the stack replacing #454. Based on #584.
Why this changes
If the SQL confirmation classifier times out, the host sees a generic
tool_error. It can’t tell from that outcome whether classification failed or the database operation failed. This PR adds asql_classifier_callobservation so the host can see what the classifier reported and how long it took.What the host sees
Each time a classifier call finishes, the server records the feature (
destructive_sqlornotebook), the result, and the duration in milliseconds. The result comes from a fixed list, so observations can distinguish a timeout from a crash without including SQL or error text.For example, if
execute_sqlstops because the classifier timed out, the host still seestool_error. It now also seessql_classifier_callwithresult: timeout. Both come from the same classifier outcome.Rollout
This completes the stack for release. Hosts that handle every
ObservationFactkind in an exhaustive switch must add asql_classifier_callcase when they upgrade.Before Platform enables a custom classifier, it still needs to decide how to alert on failures and sample traces, how to count cancellations during classification, and when to time out a call that never finishes.
Refs AI-1338