Skip to content

fix(retry): treat request-level errors as retryable#2543

Merged
tusharmath merged 2 commits intomainfrom
fix/retry-unexpected-eof
Mar 12, 2026
Merged

fix(retry): treat request-level errors as retryable#2543
tusharmath merged 2 commits intomainfrom
fix/retry-unexpected-eof

Conversation

@tusharmath
Copy link
Copy Markdown
Collaborator

@tusharmath tusharmath commented Mar 12, 2026

Summary

Treat request-level reqwest errors as retryable, fixing the peer closed connection without sending TLS close_notify error from the ChatGPT codex endpoint.

Context

Requests to https://chatgpt.com/backend-api/codex/responses were failing permanently with:

peer closed connection without sending TLS close_notify

This error surfaces as a reqwest::Error with is_request() == true. The existing retry check only covered is_timeout() and is_connect(), so these request-level transport failures were never retried.

Changes

  • Added || e.is_request() to is_req_transport_error — a one-line fix
  • Added one test that simulates a peer dropping the connection and verifies it's retried

Testing

cargo insta test --accept -p forge_repo

Links

@github-actions github-actions Bot added the type: fix Iterations on existing features or infrastructure. label Mar 12, 2026
@tusharmath tusharmath force-pushed the fix/retry-unexpected-eof branch 2 times, most recently from d504005 to 73ae220 Compare March 12, 2026 12:18
The UnexpectedEof error from rustls (peer closed connection without TLS
close_notify) surfaces as a reqwest::Error with is_request() == true,
which was not covered by the existing is_timeout() || is_connect()
check. Adding is_request() retries all request-level transport failures
including this TLS close_notify case.

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
@tusharmath tusharmath force-pushed the fix/retry-unexpected-eof branch from 0e2deea to 9e63198 Compare March 12, 2026 12:59
@tusharmath tusharmath changed the title fix(retry): handle UnexpectedEof and connection closed errors as retryable fix(retry): treat request-level errors as retryable Mar 12, 2026
@tusharmath tusharmath enabled auto-merge (squash) March 12, 2026 20:14
@tusharmath tusharmath merged commit 3ce465e into main Mar 12, 2026
9 checks passed
@tusharmath tusharmath deleted the fix/retry-unexpected-eof branch March 12, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant