Skip to content

Conversation

@findleyr
Copy link
Contributor

When POST requests in the streamableClientConn return a transient error, return this error to the caller rather than permanently breaking the connection.

This is achieved by using the special sentinel ErrRejected error to the jsonrpc2 layer. In doing so, the change revealed a pre-existing bug: ErrRejected had the same code as ErrConnectionClosing, and jsonrpc2.WireError implements errors.Is, so the two sentinel values could be conflated. This is fixed by using a new internal code.

There's more to do for #683: we should also retry transient errors in handleSSE.

For #683

When POST requests in the streamableClientConn return a transient error,
return this error to the caller rather than permanently breaking the
connection.

This is achieved by using the special sentinel ErrRejected error to the
jsonrpc2 layer. In doing so, the change revealed a pre-existing bug:
ErrRejected had the same code as ErrConnectionClosing, and
jsonrpc2.WireError implements errors.Is, so the two sentinel values
could be conflated. This is fixed by using a new internal code.

The new test required some additional machinery in our fake server: the
ability to handle multiple requests to the same logical key.

There's more to do for modelcontextprotocol#683: we should also retry transient errors in
handleSSE.

For modelcontextprotocol#683
@findleyr findleyr merged commit 875d1d3 into modelcontextprotocol:main Dec 12, 2025
5 checks passed
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.

2 participants