Fix MCP connection errors, slow stepping, and stale debug state#96
Open
ksa-real wants to merge 2 commits into
Open
Fix MCP connection errors, slow stepping, and stale debug state#96ksa-real wants to merge 2 commits into
ksa-real wants to merge 2 commits into
Conversation
Three reliability/perf fixes to the extension: - Server: run StreamableHTTPServerTransport in stateful session mode so GET /mcp opens a real server->client SSE stream. Register GET/DELETE /mcp at startup (previously nested in the POST error handler, so GET returned a bare 404). Cursor's client treated the failed SSE open as a fatal transport error and tombstoned the connection as "errored" even though POST tool calls worked. - Stepping: replace the 1s blind-poll waitForStateChange with an event-driven wait on vscode.debug.onDidChangeActiveStackItem / onDidTerminateDebugSession, cutting per-step latency from ~1s to ms. - State: derive current file/line from the DAP top stack frame instead of scraping the active editor, fixing stale "paused at line N" reports.
Cover the three reliability/perf fixes that the existing suite missed: - debugMCPServer.security.test.ts: a "Streamable-HTTP session lifecycle" suite that drives the real handshake — initialize over POST mints an mcp-session-id, GET /mcp with that id returns a live text/event-stream (the regression that left Cursor flagging the server "errored"), and GET /mcp with a missing/unknown session is rejected with 400. - debuggingHandler.test.ts: waitForStateChange tests (via handleStepOver) asserting the fast-path resolves in ms when the new line is already observable or the session ended, and that the bounded timeout (not a blind 1s sleep) governs the no-change case.
Author
|
@microsoft-github-policy-service agree |
|
@ozzafar Do you take contributions? I see a bunch of PRs are hanging for a while. |
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.
Summary
Three reliability/perf fixes to the extension, with regression tests:
StreamableHTTPServerTransportin stateful session mode soGET /mcpopens a real server→client SSE stream, and register theGET/DELETE /mcproutes at startup (they were previously nested inside thePOSTerror handler, soGETreturned a bare 404). Cursor's MCP client treated the failed SSE open as a fatal transport error and tombstoned the connection as "errored" even thoughPOSTtool calls were working.waitForStateChangewith an event-driven wait onvscode.debug.onDidChangeActiveStackItem/onDidTerminateDebugSession, cutting per-step latency from ~1s to milliseconds.Tests
debugMCPServer.security.test.ts— a "Streamable-HTTP session lifecycle" suite driving the real handshake:initializeoverPOSTmints anmcp-session-id,GET /mcpwith that id returns a livetext/event-stream(the regression that flagged the server "errored"), andGET /mcpwith a missing/unknown session is rejected with 400.debuggingHandler.test.ts—waitForStateChangetests (viahandleStepOver) asserting the fast-path resolves in ms when the new line is already observable or the session ended, and that a bounded timeout (not a blind 1s sleep) governs the no-change case.No version bump or
package.jsonchange; this is implementation + tests only.