Skip to content

log undeliverable late responses in processResult - #1153

Open
o-mid wants to merge 2 commits into
modelcontextprotocol:mainfrom
o-mid:fix/log-late-response-write-errors
Open

log undeliverable late responses in processResult#1153
o-mid wants to merge 2 commits into
modelcontextprotocol:mainfrom
o-mid:fix/log-late-response-write-errors

Conversation

@o-mid

@o-mid o-mid commented Aug 8, 2026

Copy link
Copy Markdown

Summary

  • Report processResult response write failures through OnInternalError instead of dropping them.
  • Add a unit test that a failed response write invokes the hook with the wrapped write error.

Fixes #1147.

Motivation

When a handler finishes after the client has already torn down the stream (e.g. client-side timeout), c.write fails and that error was discarded. Server logs then look like nothing happened. Maintainer guidance on the issue was to log at that site; MCP already wires OnInternalError to slog in mcp/transport.go.

Test plan

  • go test ./internal/jsonrpc2/ -run TestProcessResultWriteFailureReportsInternalError
  • go test ./internal/jsonrpc2/...
  • CI green

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.

jsonrpc2.Connection.processResult silently discards write errors for late responses, giving no signal when a response can't be delivered

1 participant