Repository navigation
feat(mcp-server-supabase): detect instant elicitation cancels - #483
Merged
barryroodt merged 16 commits intoOct 26, 2026
Conversation
Coverage Report for CI Build 40098459377Warning No base build found for commit Coverage: 97.587%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
mattrossman
reviewed
Oct 23, 2026
mattrossman
reviewed
Oct 23, 2026
mattrossman
requested changes
Oct 23, 2026
…tect-instant-elicitation-cancels-from-clients-that-answer
mattrossman
approved these changes
Oct 26, 2026
barryroodt
deleted the
barryroodt/ai-1328-detect-instant-elicitation-cancels-from-clients-that-answer
branch
October 26, 2026 13:24
Merged
barryroodt
added a commit
that referenced
this pull request
Oct 27, 2026
…ires (#490) ## What kind of change does this PR introduce? Bug fix ## What is the current behavior? If a client answers a confirmation form after the signed `requestState` has expired, the SDK rejects the resume with a generic JSON-RPC `-32602` "Invalid or expired requestState". The client can't tell the confirmation timed out, and the model never gets a hint to retry, so to the user it looks like our server is broken. We saw this in a support ticket where Codex answered a `create_branch` cost form about 21 minutes after the first call. The token only lasts 10 minutes. [AI-1337](https://linear.app/supabase/issue/AI-1337) and [AI-1318](https://linear.app/supabase/issue/AI-1318) look like the same thing from Codex. ## What is the new behavior? Our verify hook now catches only the SDK's `expired` case and returns a normal tool result with `isError: true` and `structuredContent: { status: 'expired', message }`, with the same JSON in `content` (same shape as #483). The model then reads something like: > This confirmation expired after 10 minutes. Call `create_branch` again to get a new confirmation. The SDK checks expiry after the MAC, so only an authentic token reaches this path. The lifetime in the message comes from the same TTL the codec uses. This covers all six tools that resume signed state: `create_project`, `create_branch`, `execute_sql`, `apply_migration`, `run_notebook` and `create_edge_function_secret`. The expired check runs before any other routing, so an expired resume never runs anything, even when the client swaps in a non-destructive query or drops form capability. We take the tool name from the tool being called and never read the expired payload. Malformed, bad-MAC and bind failures still get the SDK's `-32602` unchanged. The TTL and the SDK stay the same. Confirmation tools now record a `resume_validation` fact with `result: 'expired'`, so we can finally see these. ## Verification I ran a local smoke test on the in-process server with a mocked clock: - expired `create_branch`: expired result, no branch created - expired `execute_sql` resumed with a non-destructive `INSERT`: expired result, SQL not run - expired `execute_sql` from a client without form capability: expired result, SQL not run - tampered token: `-32602` - valid resume inside the TTL: branch created ## Additional context Closes [AI-1372](https://linear.app/supabase/issue/AI-1372)
barryroodt
added a commit
that referenced
this pull request
Oct 29, 2026
…ck (#500) ## What kind of change does this PR introduce? Bug fix, test fixture only. ## What is the current behavior? `pnpm test:packed-platform-consumer` has been failing on main since #483. That PR added `elapsed_ms` to the `input_response` observation fact, and the fixture's exact-shape `deepEqual` on the destructive-SQL resume facts doesn't expect the key, so it throws there. Everything after that line gets skipped for the packaged artifact, including the privacy checks (no `PRIVATE_` value and no destructive-SQL `requestState` token in the recorded observation scopes). [CI](https://github.com/supabase/mcp/blob/c242e63b38ed1cea5d5bd2f32e49aa38d290776a/.github/workflows/tests.yml) doesn't run this check, which is why nothing flagged it. ## What is the new behavior? `scripts/fixtures/packed-platform-consumer/modern-call.mjs` accepts `elapsed_ms` on that fact the same way it already accepts `durationMs` on the `returned` operation fact. The shape check stays exact and the value has to be a finite number >= 0, so a missing `elapsed_ms` or any other extra key still fails. ## Verification ```sh pnpm install --frozen-lockfile pnpm test:packed-platform-consumer ``` The script builds both packages itself. With this change it prints `[PASS] modern-mcp-call` and exits 0. On main it fails at the resume-facts `deepStrictEqual`, with a diff showing the extra `elapsed_ms` key.
Rodriguespn
pushed a commit
that referenced
this pull request
Oct 29, 2026
🤖 I have created a release *beep* *boop* --- <details><summary>mcp-server-supabase: 0.15.0</summary> ## [0.15.0](mcp-server-supabase-v0.14.0...mcp-server-supabase-v0.15.0) (2026-10-29) ### Features * `submit_feedback` and `delete_feedback` tools ([#474](#474)) ([f50318a](f50318a)) * mark client-caused tool errors as ToolCallerError ([#480](#480)) ([4a619c1](4a619c1)) * **mcp-server-supabase:** detect instant elicitation cancels ([#483](#483)) ([5ad1a2a](5ad1a2a)) ### Bug Fixes * **mcp-server-supabase:** return a tool error when a confirmation expires ([#490](#490)) ([5ab9a98](5ab9a98)) * **mcp-server-supabase:** use POSIX path resolution for edge function filenames ([#393](#393)) ([55d2d24](55d2d24)) * **mcp:** don't split an UPDATE on a semicolon inside a dollar-quoted value ([#482](#482)) ([9f07410](9f07410)) * **mcp:** don't split an UPDATE on a semicolon inside a quoted value ([#459](#459)) ([6d93b50](6d93b50)) * **pg-meta:** order list_tables columns by ordinal position ([c242e63](c242e63)) * **pg-meta:** order primary key columns by key position and exclude INCLUDE columns ([#382](#382)) ([25d357c](25d357c)) </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.
What kind of change does this PR introduce?
Feature
What is the current behavior?
Claude's cloud surfaces answer our confirmation prompts with
cancelon their own, about half a second after we ask, and never show the user anything (anthropics/claude-ai-mcp#1085). Right now that looks the same as a person closing the prompt, so we can't count it and the model can't tell the user what happened. It came up in SU-495524, where the logs showed ~0.55 s betweeninput_requiredand the cancel.What is the new behavior?
Confirmation state for
execute_sql,apply_migration,run_notebook,create_projectandcreate_branchnow carries a signedissued_at. If acancelcomes back less than 1 s after we asked, the result tells the model the client cancelled before a prompt was likely shown and that nothing ran, e.g. "The client cancelled this confirmation about 0.6 s after it was sent, faster than a person could answer, so it likely never showed you a prompt. The SQL was not run." We measure from when the resume request reaches the tool, so our own platform reads don't count. Normal cancels keep today's text, andstructuredContentstays{ status: 'cancelled' }.I went with 1 s because nobody reads SQL and answers that fast, and the auto-cancels we saw were ~0.55 s. A wrong call only changes the text and the telemetry. It never changes whether anything runs: a cancel the server inspects never runs anything. There's a separate, older gap where a cancel resume that drops the form capability takes the legacy bypass in
execute_sql/apply_migrationand runs the SQL. That's AI-1360 and it's out of scope here.The
input_responseobservation fact now getselapsed_ms, plusinstant: trueon instant cancels, so we can see which clients do this (ties into AI-1273). Nothing changes in hosted/mgmt-api logging.Alternatives considered
I considered one neutral cancel message for every cancel, whatever the timing. It would confirm nothing ran and link the SQL confirmations troubleshooting page for clients that answer elicitations automatically. I ultimately decided against it and kept the threshold instead: the instant text would be wrong after a real human cancel, and the neutral text is too vague, so the model would have to guess what happened. With neutral text, the model also can't tell the user their client likely never showed a prompt. An added benefit to this update is we get the extra telemetry data wrt response times.
Verification
I ran a smoke test on the in-process server with real time and a stubbed platform, using
execute_sqlwith aDROP TABLE. An immediate cancel got the instant text withelapsed_ms: 7, instant: true. A cancel after 1.6 s got the usual "SQL execution was cancelled." withelapsed_ms: 1603and noinstant. Both came back as{ status: 'cancelled' }, and the SQL never ran.Closes AI-1328