Skip to content

fix(mcp-server-supabase): return a tool error when a confirmation expires - #490

Merged
barryroodt merged 5 commits into
mainfrom
barryroodt/ai-1372-return-a-clear-confirmation-expired-tool-error-instead-of
Oct 27, 2026
Merged

barryroodt merged 5 commits into
mainfrom
barryroodt/ai-1372-return-a-clear-confirmation-expired-tool-error-instead-of

Conversation

@barryroodt

@barryroodt barryroodt commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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 and 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

@barryroodt
barryroodt requested a review from a team as a code owner October 27, 2026 13:46
@coveralls

coveralls commented Oct 27, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 40527234958

Warning

No base build found for commit 0c48ce3 on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 97.615%

Details

  • Patch coverage: 58 of 58 lines across 2 files are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 5755
Covered Lines: 5648
Line Coverage: 98.14%
Relevant Branches: 1121
Covered Branches: 1064
Branch Coverage: 94.92%
Branches in Coverage %: Yes
Coverage Strength: 168.86 hits per line

💛 - Coveralls

@barryroodt barryroodt self-assigned this Oct 27, 2026
@barryroodt
barryroodt merged commit 5ab9a98 into main Oct 27, 2026
5 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Oct 27, 2026
mattrossman added a commit that referenced this pull request Oct 28, 2026
When the management API types check fails, its job summary now links to
the generated update PR if one is open, or links to the workflow to
trigger a new one. Surfaced while reviewing
#490

This also removes the [Node 20 deprecation and Ubuntu migration
annotations](https://github.com/supabase/mcp/actions/runs/40527234719)
from the check.

If no generated PR exists
([run](https://github.com/supabase/mcp/actions/runs/40557170577)):

<img width="2900" height="444" alt="CleanShot 2026-10-27 at 2 23 00
PM@2x"
src="https://github.com/user-attachments/assets/61340bf9-346a-4f82-b3c9-de8c1372c0e4"
/>

If generated PR exists
([run](https://github.com/supabase/mcp/actions/runs/40561647929)), note
since there's no real open PR this one hardcoded to link to this PR:

<img width="2902" height="432" alt="CleanShot 2026-10-27 at 2 41 42
PM@2x"
src="https://github.com/user-attachments/assets/89b2c3a7-6241-49d1-b912-68b3f59f8d26"
/>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants