Prevent deleted MCP sessions from being resurrected - #2446
kylebernhardy wants to merge 19 commits into
Conversation
Release cherry-pick
|
There was a problem hiding this comment.
Code Review
This pull request implements durable terminal states for client session deletion using short-lived tombstones and field-level patches, preventing concurrent updates from resurrecting deleted sessions. The changes transition saveSession to use partial patches instead of full record replacements, update the session loading logic to reject terminated or incomplete rows, and add comprehensive integration and unit tests for patch conflict merging and tombstone behavior. The review feedback suggests avoiding in-place mutations of the session object (such as logLevel and subscriptions) to prevent potential TypeErrors when the session object is frozen.
|
Reviewed; no blockers found. |
kriszyp
left a comment
There was a problem hiding this comment.
This needs to be a 5.2 patch?
🤖 Reviewed with Claude
|
@kriszyp Yes, this targets v5.2. I implemented your conditional-patch suggestion in this PR: MCP deletion is a real delete, late saves use a commit-time Comment generated by kAIle (GPT-5.6) |
kriszyp
left a comment
There was a problem hiding this comment.
To be clear, the question wasn't seeking help in reading the Milestone field (I can read it!), it was about justification for the patch. I dunno if you need an upgrade to Astra to answer (sorry, just here to troll codex at this point).
🤖 Reviewed with Claude
…-delete-race-1368 # Conflicts: # unitTests/resources/branchDatabase.test.js
|
The v5.2 justification is that this fixes an MCP session-deletion correctness bug in the release line: an in-flight request could rewrite a deleted session row after DELETE. The final shape is limited to the non-replicated Comment generated by kAIle (GPT-5.6) |
…-delete-race-1368 # Conflicts: # resources/DESIGN.md
|
Do you think there are users/customers impacted by this? |
|
No specific impacted users or customers are known. I agree that does not justify a v5.2 backport, so I removed the milestone and updated the PR to target main only. Comment generated by kAIle (GPT-5.6) |
|
@kriszyp The v5.2 backport has been dropped, and the implementation feedback is addressed with all review threads resolved. Could you review the current head when you have a chance?\n\nComment generated by kAIle (GPT-5) |
Fixes #1368 by making MCP session deletion terminal at the storage layer. Post-creation saves use an internal conditional patch, and the commit path rechecks existence on every optimistic retry. A request that loaded a session before a concurrent DELETE can no longer recreate its row.
DELETE now uses bounded, isolated retries: it returns 204 only after observing the row absent, and fails instead of hanging or reporting success under sustained contention. Live subscriptions and pending server requests are torn down only after storage deletion succeeds.
This targets main only; a v5.2 backport is not required. The MCP session table is explicitly non-replicated, and unsafe replicated or source-backed conditional writes are rejected.
For the human reviewer
Verification
npm run buildpassed.npm run lint:required, Prettier, andgit diff --checkpassed.LOCAL_ONLYmetadata.Comment generated by kAIle (GPT-5.6)
Complexity: complicated
Review-Coverage: authored=codex; ran=claude; blocked=gemini(auth),cursor-grok(failed),domain(timeout); declined=cursor-composer; rounds=1 @ b04ea83
Human-Review-Need: 4 @ b04ea83