Repository navigation
fix(mcp): keep a cancelled call id occupied until its call finishes - #624
Closed
princejain756 wants to merge 1 commit into
Closed
princejain756 wants to merge 1 commit into
princejain756 wants to merge 1 commit into
Conversation
Calls::cancel removed the id's entry while the cancelled call was still running. A new tools/call reusing that id was then admitted, and the two calls shared the registry slot: the cancelled call's thread could take the new call's child and send its output as the response, or the new call got no start slot and answered Cancelled for a request that was never cancelled. Once both finished, the id could no longer be cancelled at all. The registry now keeps the entry in a Cancelled state instead of removing it, and finish is the only place that frees the id. A reused id gets the existing -32600 a call with this id is running refusal until the cancelled call itself completes. Regression test covers the sequence.
Contributor
|
@princejain756 is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
Superseded: #602 landed the same fix on main (keep a cancelled call id occupied until its call finishes, Slot::Cancelled, plus a matching regression test). Closing; thanks for the reviews. |
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.
Fixes #599.
Calls::cancel removed the id's entry while the cancelled call was still running, so a tools/call reusing the same id was admitted and the two calls shared the registry slot: the cancelled call's thread could take the new call's child and send its output as the response, or the new call answered Cancelled for a request that was never cancelled.
The registry now keeps the id in a Cancelled state until its own call's finish frees it, so a reused id gets the existing -32600 "a call with this id is running" refusal until the cancelled call completes.
Verified over a real MCP session: cancelling desktop_wait ms:5000 (id 1) then re-sending id 1 previously answered {"id":1,"result":{"text":"Cancelled"}} from the new call's thread; now it returns {"error":{"code":-32600,"message":"Invalid Request: a call with this id is running"}}. Regression test in calls_tests.rs; cargo test --bin agent-desktop is 229 passed, clippy -D warnings clean.