Repository navigation
feat(mcp-server-supabase): route execute_sql and apply_migration through one SQL classify step - #583
Open
barryroodt wants to merge 2 commits into
Open
barryroodt wants to merge 2 commits into
barryroodt wants to merge 2 commits into
Conversation
Tests for `elicitation.confirmation.classifier` on execute_sql and apply_migration, at the public option with real tool calls. They fail on this commit by design: the option is not wired yet. - One row per classifier outcome, per tool, on the first call and on an unanswered resend: the four reasons ask; `unavailable`, `timeout`, `crashed`, results outside the contract, a result whose inspection throws and every throw stop the call. - Every stopped call carries the error name SqlClassifierCallError. Nothing from the classifier's own error or result reaches the client, and the error the host's onToolCall gets has no cause. - A result whose failure kind changes while it is read (a getter that answers differently after n reads, n = 0 to 12, bare and through withFallback) never puts its text in the client result or the host error. - Each confirmation reason's first prompt line holds its own keyword and none of the others'. - The state-error path (state for another tool, other SQL or another project): cleared SQL runs, and a classifier failure replaces the state error. - The classifier is not called on an accepted, declined or cancelled resend, when confirmation is not enabled for the tool, for a client that cannot elicit, or on a read-only server. - A request aborted while the classifier is pending does not run the SQL, whether the classifier then resolves or rejects. - The tests that spied on isDestructiveSql now pass a classifier through the option, with SQL the regex clears. - The packed consumer type check passes a classifier as the server option. Carried from 4683923 (PR 454) and merged with the accept-only tests.
…y step execute_sql and apply_migration now ask one classify step whether SQL needs confirmation. The server builds the step once from the new `elicitation.confirmation.classifier` option (default: the regex classifier) and getDatabaseTools requires it, so a tool group cannot be wired without it. The step checks the classifier's result at runtime. Only `undefined` skips confirmation; a reason or `oversized` asks, each with its own first prompt line. `unavailable`, `timeout`, `crashed`, a result outside the contract, a result that throws when read, or any rejection fails the call with a SqlClassifierCallError, and the SQL does not run. The error carries nothing of the classifier's own error and has no cause. A failure kind is read once and checked against the fixed kinds before it is used, so a result that changes while it is read cannot put its text in the message. A cancelled request rethrows its abort. The rules from the accept-only change hold: a decline or cancel returns before any classification, and an accepted resend runs without one. The one test that builds the tool group by hand passes the step here, since this commit makes it a required argument. Carried from 4683923 (PR 454): the reason maps, the runtime validation and the prompt lines.
barryroodt
force-pushed
the
feat/sql-classify-step
branch
from
November 23, 2026 08:44
27619f2 to
0162527
Compare
barryroodt
force-pushed
the
feat/sql-classifier-interface
branch
from
November 23, 2026 08:44
eded40b to
9167400
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.
Third PR in the stack replacing #454. Base: #582 (3/5).
Why this changes
#582 defined how a SQL classifier tells a tool whether to ask for confirmation. This PR connects that classifier to
execute_sqlandapply_migration. Hosts can setelicitation.confirmation.classifieronce for both tools. The existing regex stays the default.In #454, each tool group could omit the classifier, which made it easy to miss
run_notebookwhen it was added. The server now creates one shared classification step and requires it when building the database tools. #584 connects notebooks to the same step.When the tools ask for confirmation
undefinedoversizedunavailable,timeout,crashed, an invalid result or an exceptionSqlClassifierCallErrorwith a fixed message. The original error stays out of logs and traces.When the user answers a matching prompt, #581’s behavior still applies. Accept runs the SQL. Decline or Cancel ends the call. All of these answers skip classification.
Cancelling the request while classification is running takes a different path. Once the classifier settles, the tool propagates the cancellation and records
tool_error. Hosts that count tool errors will count these cancellations too. A custom classifier must handle its own timeout because the server can keep waiting indefinitely.Rollout
Wait for #585 before releasing this change or enabling a custom classifier on a host. #584 brings
run_notebookonto the shared classifier, and #585 lets hosts see when classification failed.Refs AI-1338