Repository navigation
fix(mcp-server-supabase): keep a declined or cancelled SQL confirmation final - #581
Merged
Merged
Conversation
…ion final Once execute_sql or apply_migration has asked for confirmation, only an accept runs the SQL. A decline or cancel stays final when the SQL classifies differently on the resend, and the classifier is not consulted. An unanswered resend that no longer classifies as destructive asks again. Also covers the state-error path (state for another tool, other SQL or another project) for the two classes that had no test: SQL that now classifies as not destructive runs and ignores the stale state, and a classification that throws returns that failure, not the state error. The first group fails on this commit by design. The state-error rows pass on main and guard the gate change that follows.
…on final When a resend of execute_sql or apply_migration carries state this server issued for the same tool, project, name and query, only an accept runs the SQL. A decline or cancel returns its result before the SQL is classified, so a classifier that throws or now returns "not destructive" cannot hide the answer or run the SQL. A resend with no answer asks again with a neutral reconfirm line when the SQL no longer classifies as destructive. Unchanged: a first call with no state, an accepted resend, and a state error (another tool's state, changed arguments), which keeps the not-destructive bypass. Carried from d06882d and 2015346 on PR 454, without the classifier interface.
This was referenced Nov 20, 2026
Open
barryroodt
marked this pull request as ready for review
November 20, 2026 09:07
mattrossman
approved these changes
Nov 20, 2026
Coverage Report for CI Build 44699107992Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.01%) to 98.152%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Merged
barryroodt
pushed a commit
that referenced
this pull request
Nov 26, 2026
🤖 I have created a release *beep* *boop* --- <details><summary>mcp-utils: 0.11.1</summary> ## [0.11.1](mcp-utils-v0.11.0...mcp-utils-v0.11.1) (2026-11-26) ### Bug Fixes * **mcp-ui:** shared project card for create-project and create-branch ([#578](#578)) ([efe189f](efe189f)) </details> <details><summary>mcp-server-supabase: 0.20.0</summary> ## [0.20.0](mcp-server-supabase-v0.19.0...mcp-server-supabase-v0.20.0) (2026-11-26) ### Features * **debugging:** add project issues DEBUG-311 ([#546](#546)) ([01f8021](01f8021)) * **mcp-server-supabase:** add optional schemas parameter to generate_typescript_types ([#592](#592)) ([7532f53](7532f53)) ### Bug Fixes * **debugging:** link docs once per issue in get_issues ([#610](#610)) ([74801d8](74801d8)) * **mcp-server-supabase:** detect import maps uploaded with a ./ prefix ([#591](#591)) ([6b8f4dc](6b8f4dc)) * **mcp-server-supabase:** keep a declined or cancelled SQL confirmation final ([#581](#581)) ([03afe8e](03afe8e)) * **mcp-server-supabase:** match Studio's notebook row_limit and clarify skip and blank-input messages ([#593](#593)) ([ad07f1b](ad07f1b)) * **mcp-server-supabase:** skip cost confirmation for $0 projects on clients without forms ([#608](#608)) ([50cfc37](50cfc37)) * **mcp-server-supabase:** stop reusing a removed import map on edge function redeploy ([#588](#588)) ([56093a6](56093a6)) * **mcp-ui:** shared project card for create-project and create-branch ([#578](#578)) ([efe189f](efe189f)) * **mcp:** confirm UPDATEs without WHERE that follow a comment and set a dollar-quoted value ([#612](#612)) ([468907a](468907a)) * **mcp:** confirm UPDATEs without WHERE that use inheritance syntax ([#565](#565)) ([687b3ee](687b3ee)) * **mcp:** confirm UPDATEs without WHERE when a column name ends in where ([#557](#557)) ([57fa34b](57fa34b)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
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.
First PR in the stack replacing #454. Base:
main(1/5).Why this changes
When
execute_sqlorapply_migrationasks for confirmation, the client sends a second tool call with the server-issued state and the user’s answer. Today, only Accept skips a second SQL classification. If the user clicks Decline or Cancel, the server checks the SQL again before it honors that answer.The current regex always gives the same answer for the same SQL. The next PR makes the classifier replaceable, so a parser could flag a query on the first call and a fallback could clear it on the second. Today, that would run SQL the user just declined. #455 added observability and a test that captures this behavior.
What changes
The server checks that the signed state is valid and unexpired, then matches it to the current tool, project ID and exact SQL text. For
apply_migration, the migration name must also match.A decline ends that call. The client can still send Accept for the same prompt before the state expires. If the client changes the SQL, the earlier answer doesn’t apply to the new query. The server classifies it as before.
Where to review
Start with
checkDestructiveSqlConfirmation, which decides when to classify the SQL. The updated tests show what happens when the classifier changes its answer or throws after the first prompt. SQL confirmation handling · PR diff and testsRefs AI-1338