Fix unknown MCP cancellation suppresses a later reused request ID - #7131
Conversation
🦋 Changeset detectedLatest commit: fb61bff The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
no API key found — this repo is configured to use To fix: add the key as a GitHub Actions secret (referenced from your workflow's Open repo secrets → · Configure model → · Setup docs → · Ask in Discord →
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Added a changeset describing the MCP cancellation fix.
- Fixed
McpServercancellation by tracking active request IDs per client and only honoringnotifications/cancelledwhen the target ID is currently active, preventing unknown cancellation IDs from suppressing later requests that reuse the same ID. - Added regression tests for reusing an unknown cancelled identifier and for ignoring cancellation of an already-completed request identifier.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|

Summary
Every valid cancellation ID is inserted into cancelledRequests before active-request existence is known. The next Exit for the same client and typed ID is deleted from that set and discarded, including a later unrelated request that reuses X.
Important
This PR starts with focused failing reproduction tests. Add the implementation fix to this same branch; CI is expected to fail until that fix is included.
Unknown MCP cancellation suppresses a later reused request ID
Module:
packages/effect/src/unstable/ai/McpServer.tsAudit ID:
relsem-mcp-stale-cancel-idSeverity / confidence: medium / high
What happens
Every valid cancellation ID is inserted into cancelledRequests before active-request existence is known. The next Exit for the same client and typed ID is deleted from that set and discarded, including a later unrelated request that reuses X.
Why it happens
The owning implementation diverges from relation unstable-services-004.
Expected behavior
MCP cancellation for an unknown request identifier is ignored; suppression applies only to the response of the matching active cancelled request.
Relevant implementation
These links and excerpts are pinned to audit base
b206fa5d7655c1634c9993410a9203f6616a5ca2.packages/effect/src/unstable/ai/McpServer.ts:670View problematic code at
packages/effect/src/unstable/ai/McpServer.ts:670View exact lines on GitHub
Reproduction
Observed failure: Independently rerun; failed at the intended semantic assertion.
Implementation handoff
The initial reproduction tests on this branch are the regression specification for the implementation fix that should follow in this PR.
Audit provenance
b206fa5d7655c1634c9993410a9203f6616a5ca2b206fa5d7655c1634c9993410a9203f6616a5ca2relsem-mcp-stale-cancel-idCloses EFF-563