Skip to content

fix: generate a new request id on each client request subscription - #1280

Open
prathamgoyal787 wants to merge 1 commit into
modelcontextprotocol:mainfrom
prathamgoyal787:fix/client-request-id-reuse-on-retry
Open

prathamgoyal787 wants to merge 1 commit into
modelcontextprotocol:mainfrom
prathamgoyal787:fix/client-request-id-reuse-on-retry

Conversation

@prathamgoyal787

Copy link
Copy Markdown

McpClientSession.sendRequest generated the JSON-RPC request id once, when the Mono was assembled. Subscribing to the returned Mono again, for example with retry() after an error response, sent the same id a second time. JSON-RPC requires that a request id is not reused within a session.

The id is now generated per subscription.

Added a test to McpClientSessionTests that retries a request and asserts each attempt gets a different id. It fails on main and passes with this change. #1134 and #287 also touch sendRequest, so whichever lands second may need a small rebase.

McpClientSession.sendRequest generated the JSON-RPC request id once, when
the Mono was assembled. Subscribing to the returned Mono again, for
example with retry() after an error response, sent the same id a second
time, while JSON-RPC requires that a request id is not reused within a
session.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant