Repository navigation
fix: distinguish server requests from MCP responses with matching IDs - #5393
Merged
milind-soni merged 1 commit intoNov 12, 2026
Merged
Conversation
|
@Afloat16 is attempting to deploy a commit to the SupaMaus Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 52 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
4 of 5 tasks
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.
Problem
MCP peers allocate request IDs independently. A server can send a ping or another reverse request using the same ID as an in-flight client request. The HTTP transport currently matches only the ID, so it accepts that server request as the client's response and resolves the tool call with undefined before its actual result arrives.
Changes
Require a JSON-RPC response shape (no method and an own result or error field) before matching a pending client ID. Apply the check consistently to JSON response batches, streamable HTTP SSE responses, and the legacy SSE listener. Null results remain valid. Extend the fake server with an optional reverse-request ID for deterministic coverage.
Recorded verification
The following results were recorded for this branch on base
9d6678adcaf62645513a3e3419999134742bb458.This fixes JSON-RPC direction correlation in the HTTP transport. It is separate from the connector cache reply matching in #5092 and the SSE end-of-stream framing change in #5251.
Current upstream check
The complete source and regression-test patch applies cleanly to main
613ed01fdc2b04860ef63e3dbdcb46d7e6b1666das checked on 2026-11-11. Current main still matches JSON and streamable HTTP responses by ID alone and matches legacy SSE pending IDs without response-shape validation. The complete patch applies cleanly over final-event framing added by #5251.Head branch:
Afloat16:fix/mcp-response-id-direction(44ca476b871926f3cbbe71c1ece2f5da1bd1cfbf).