Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions mcp/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ func call(ctx context.Context, conn *jsonrpc2.Connection, method string, params
call := conn.Call(ctx, method, params)
err := call.Await(ctx, result)
switch {
case err == nil:
// The response arrived and decoded. It is returned even if ctx has
// been cancelled in the meantime: the request is complete, so there
// is nothing to cancel, and the spec permits notifications/cancelled
// only for requests believed to still be in progress.
return nil
Comment on lines +304 to +309

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only change i would keep. This PR is aiming to fix a very niche issue and I would prefer to keep the code less convoluted

@vbcherepanov vbcherepanov Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, done. The PR now only adds the case err == nil branch in call, plus the regression test. The Await change and its tests are gone. The test still fails on main and passes with the branch, so the one case covers it.

case errors.Is(err, jsonrpc2.ErrClientClosing), errors.Is(err, jsonrpc2.ErrServerClosing):
return fmt.Errorf("%w: calling %q: %v", ErrConnectionClosed, method, err)
case ctx.Err() != nil:
Expand Down
Loading