Skip to content

Retry transport failures and name their cause - #40

Merged
rommeld merged 1 commit into
mainfrom
fix/issue-39-transport-retry
Sep 26, 2026
Merged

rommeld merged 1 commit into
mainfrom
fix/issue-39-transport-retry

Conversation

@rommeld

@rommeld rommeld commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Fixes #39

  • Add reqwest's wording to RETRYABLE_PATTERNS. The list was ported from pi and uses Node's fetch wording, so reqwest transport failures never matched it, and the turn ended instead of auto-retrying. Two phrases are added:
    • error sending request: nothing came back. This is pi's fetch failed.
    • error decoding response body: the SSE stream broke mid-response. This is pi's terminated.
  • Print the reqwest error's source() chain in InferenceError::Http, so the retry notice and the session file say why the request failed. Example: …error sending request for url (…): client error (SendRequest): connection error: Connection reset by peer (os error 54). This deviates from pi, whose message is only fetch failed.
  • Tests: both messages are now in transient_errors_are_retryable. The new transport_errors_name_their_cause checks that a refused connection mentions Connection refused.

End-to-end check (a throwaway test, not committed): the real Codex provider and agent loop ran against a local server that resets the first connection.

  • Before: 0 retries, and the turn fails.
  • After: 1 retry, and the turn completes.

A reset in the middle of the SSE stream gave the same result.

Validation: cargo fmt --check; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace (436 passed).

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rommeld
rommeld merged commit 9f0803e into main Sep 26, 2026
2 checks passed
@rommeld
rommeld deleted the fix/issue-39-transport-retry branch September 26, 2026 15:42
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.

transport errors ("error sending request") are never retried and hide their cause

1 participant