Skip to content

fix(streamable-http): fail request when resumable SSE stream can't complete#2732

Open
Epochex wants to merge 4 commits into
modelcontextprotocol:mainfrom
Epochex:fix/1577-streamable-http-disconnect-error
Open

fix(streamable-http): fail request when resumable SSE stream can't complete#2732
Epochex wants to merge 4 commits into
modelcontextprotocol:mainfrom
Epochex:fix/1577-streamable-http-disconnect-error

Conversation

@Epochex
Copy link
Copy Markdown

@Epochex Epochex commented May 30, 2026

Fixes #1577.

When a POST responds with ext/event-stream and the stream disconnects before a terminal JSON-RPC response/error arrives, the client transport tries to resume via GET + Last-Event-ID. If the server is gone (session 404s) or resumption otherwise can't succeed, the current code returns silently after exhausting retries.

Because ClientSession defaults to
ead_timeout_seconds=None, the original send_request() waits forever on the missing response.

Changes:

  • If an SSE response stream ends without completion and we have no resumable event id, send a CONNECTION_CLOSED JSON-RPC error for the original request id.
  • If resumption retries are exhausted, send the same request-scoped error (includes the last event id in data).

Tests:

  • Adds an interaction regression test that closes a call's SSE stream and deletes the server-side session on the first reconnect GET, asserting the call fails (no hang).

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.

Client tool call hangs forever if server crashes or connection dies when using streamable-http

1 participant