mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 08:15:56 +01:00
* mcp: fix concurrent request response collection race - JsonRpcProtocol.handleMessage now returns JsonRpcMessage[] containing responses generated by incoming requests, rather than delegating response collection to callers via side-channel state - McpGatewaySession simplified by removing _pendingResponses and _isCollectingPostResponses fields, which were susceptible to racing under concurrent HTTP POSTs. Now directly uses handleMessage's return value for the response body - _send callback still invoked for all messages (backward compatible with McpServerRequestHandler and SSE notification broadcast) - Updated tests to assert on handleMessage return values Fixes #297780 (Commit message generated by Copilot) * mcp: address review comments on jsonRpcProtocol changes - Adds JSDoc to handleMessage clarifying what is returned (only responses for incoming requests), ordering guarantees for batch inputs, and that responses are still emitted via _send callback to avoid double-sending - Tightens _handleRequest return type from Promise<JsonRpcMessage> to Promise<JsonRpcResponse>, enforcing that only valid responses are returned. Introduces JsonRpcResponse type alias for better type safety - Expands error handling tests to assert that returned replies match what is emitted via _send for both JsonRpcError and generic error paths Fixes #297780 (Commit message generated by Copilot)