Skip to content

fix: stop total request timeouts from cutting long streams - #494

Merged
mrnasil merged 2 commits into
mainfrom
fix/stream-read-timeouts
Nov 25, 2026
Merged

mrnasil merged 2 commits into
mainfrom
fix/stream-read-timeouts

Conversation

@mrnasil

@mrnasil mrnasil commented Nov 25, 2026

Copy link
Copy Markdown
Member

reqwest::ClientBuilder::timeout bounds the whole request, body included. Two clients used it on streams.

MCP. The 60 s client timeout also applied to the legacy transport's long-lived SSE GET, and every answer arrives on that GET. So a server using that transport dropped out about a minute after connecting, and every later tool call failed. The client now sets only a connect timeout, and each of the four POSTs keeps its own 60 s bound (request_timeout()).

SDK and TUI remote. A run that streamed for longer than 600 s was cut off mid-turn. The 600 s bound now applies to the gap between reads (read_timeout). The server pings every 15 s while a run is quiet, so a healthy run is never cut, and a dead connection is still noticed.

Test: the legacy SSE test now waits twice the per-request bound before sending a request whose answer arrives on the GET stream. Putting the timeout back on the client makes this test fail; I checked. Lines missed in mcp/src/http.rs are the same as on main.

🤖 Generated with Claude Code

reqwest's ClientBuilder::timeout bounds the whole request, body included:

- MCP: the 60 s client timeout also applied to the legacy transport's
  long-lived SSE GET, which carries every answer. A server on that
  transport dropped out a minute after connecting. The client now sets
  only a connect timeout; each POST keeps its own 60 s bound.
- SDK and TUI remote: a run streamed longer than 600 s was cut off mid
  turn. The bound is now between reads; the server pings every 15 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mrnasil
mrnasil enabled auto-merge (squash) November 25, 2026 15:21
@mrnasil
mrnasil merged commit a70c72a into main Nov 25, 2026
7 checks passed
@mrnasil
mrnasil deleted the fix/stream-read-timeouts branch November 25, 2026 22:27
@mrnasil mrnasil mentioned this pull request Nov 26, 2026
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