Repository navigation
fix(provider): render transport error phase and causes instead of reqwest kind - #106
Merged
Merged
Conversation
…west kind `transport_error` displayed `reqwest::Error` directly, whose `Display` prints only the kind label and drops the source chain. `bytes_stream` files every body read failure under `Kind::Decode`, so a read timeout, peer reset, or truncated chunked body all surfaced as the bare `provider request failed: error decoding response body`. Observed in run 09853b7b981dc894968872a9f5fb2555: LiteLLM returned 200 text/event-stream headers, then sent nothing for the 300 s READ_TIMEOUT. The run failed with the decode message and no hint that it was a stall. `describe_transport` now names the phase (connection, headers, body, redirect), reports which deadline expired with its configured seconds for timeouts, and appends the non-reqwest causes from the source chain. The URL stays out; the redaction pass is unchanged. Regression tests cover a stalled body under a short read timeout and a truncated chunked body; the design doc records the rendering contract.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A session failed with:
transport_errorincrates/qq-provider/src/http.rsdisplayedreqwest::Errordirectly. reqwest'sDisplayprints only its kind label and drops the source chain, andResponse::bytes_stream()files every body read failure underKind::Decode. So a read timeout, a peer reset, and a truncated chunked body all surfaced as the same "error decoding response body" — nothing about JSON or SSE decoding was involved.Observed run (
09853b7b981dc894968872a9f5fb2555,litellm/us.anthropic.claude-fable-5-1): turn 12 received200 text/event-streamheaders and then no bytes for 300 s. reqwest'sReadTimeoutBodyfiredTimedOut→ wrapped asKind::Body→ re-wrapped bybytes_streamasKind::Decode→ rendered as the message above. The run failed 304 s after the previous turn completed, matchingREAD_TIMEOUT.Change
New
describe_transportnames the phase itself and appends the non-reqwest causes from the source chain:provider request failed: error decoding response body(stall)provider request failed: timed out waiting for response body (no bytes for 300s, or request past 1800s)provider request failed: error decoding response body(peer cut mid-body)provider request failed: response body failed: error reading a body from connection: end of file before message length reachedConnect/header timeouts, connection failures, redirects, and builder errors get their own phase labels. The URL stays excluded (may carry credentials; the caller names the provider) and the existing redaction pass is unchanged.
Not in scope: the behavior that made the stall unrecoverable. The stream had yielded zero events so it was retry-eligible, but the
AttemptPolicy30 s total budget was exhausted after the 300 s wait, so it gave up on attempt 1. Whether a first-byte stall should be retried outside the budget, or whether 300 s idle is too generous before the first SSE event, is a policy decision for a separate issue.Tests
stalled_body_transport_error_names_the_timeout— server sends 200 + SSE headers then nothing, against a 100 ms read timeout; asserts the message names the body timeout and does not contain the reqwest label.truncated_body_transport_error_carries_the_cause— chunked body cut mid-chunk; asserts the phase prefix and a non-empty cause chain.Verification
cargo test -p qq-provider— 210 passedcargo test -p qq-provider --no-default-features --features test-support— 163 passedcargo test --workspace— greencargo clippy --workspace --all-targets --all-features -- -D warnings— cleancargo fmt --all -- --check— cleanImpact
Error-path only; no change to the streaming hot path.
docs/design/providers.mdrecords the rendering contract.Linear: the
linear_mcpOAuth connection needs reauthorization, so no DEV issue is linked yet; will link once reconnected.