mcp: handle HTTP stream cancellation during disposal - #336921
Merged
Merged
Conversation
Disposing an MCP HTTP transport already aborts its fetch response. Cancelling the errored reader again creates a rejected promise that was previously discarded, surfacing an unhandled AbortError during normal stop/disposal. Skip that redundant cancellation after disposal and await cancellation for active read failures. Add a failing-first disposal regression and a control that keeps genuine stream failures visible. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Dmitriy Vasyura (dmitrivMS)
September 20, 2026 15:08
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused cleanup fix is consistent with stream semantics and is covered by targeted regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents unhandled HTTP MCP stream cancellation rejections during normal teardown.
Changes:
- Skips redundant reader cancellation after disposal.
- Awaits cancellation for active stream failures.
- Adds regression and control tests for both paths.
| File | Description |
|---|---|
src/vs/workbench/api/common/extHostMcp.ts |
Corrects SSE reader cleanup behavior. |
src/vs/workbench/api/test/common/extHostMcp.test.ts |
Tests disposal and active-read failures. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dmitriy Vasyura (dmitrivMS)
marked this pull request as ready for review
September 20, 2026 15:38
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 20, 2026 15:38
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: TylerLeonhardtMatched files:
|
Sandeep Somavarapu (sandy081)
approved these changes
Sep 20, 2026
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.
Stopping or disposing an HTTP MCP server can abort a pending SSE read. The reader is already errored, but the cleanup path called
reader.cancel()and discarded the rejected promise, surfacing an unhandledAbortErrorduring otherwise normal teardown.