Skip to content

fix(proxy): retry transient stream timeouts - #551

Merged
Soju06 merged 1 commit into
Soju06:mainfrom
Komzpa:fix/retry-transient-stream-timeouts
May 9, 2026
Merged

Soju06 merged 1 commit into
Soju06:mainfrom
Komzpa:fix/retry-transient-stream-timeouts

Conversation

@Komzpa

@Komzpa Komzpa commented May 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Treat first-event stream timeouts and incomplete upstream websocket closes as transient stream failures.
  • Retry those failures through the existing same-account retry path before failing over to another account.
  • Keep downstream-visible streams fail-closed once bytes have already been emitted, so retries do not duplicate output/tool events.

Why

Proxy request budget exhausted is emitted for proxy stream/request budget expiry, not necessarily account quota exhaustion. When it arrives as the first stream event, the proxy can safely reconnect/retry instead of surfacing a terminal response.failed to Codex/OpenClaw.

Verification

  • .venv/bin/pytest tests/integration/test_proxy_transient_retry.py -q

Related issues

@Komzpa
Komzpa force-pushed the fix/retry-transient-stream-timeouts branch from ae960e2 to 199a07f Compare May 5, 2026 15:00
@Soju06

Soju06 commented May 9, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Soju06
Soju06 merged commit 77944c9 into Soju06:main May 9, 2026
18 checks passed
@Soju06

Soju06 commented May 9, 2026

Copy link
Copy Markdown
Owner

@all-contributors please add @Komzpa for code, test

xirothedev added a commit to xirothedev/codex-lb that referenced this pull request May 10, 2026
…l fetch timeouts, image rewrite)

Upstream batch v1.16.0 highlights:
- proxy: expose drain status for graceful deploys (Soju06#564)
- proxy: narrow budget-safe gate to primary usage (Soju06#561)
- proxy: handle model fetch timeouts (Soju06#541)
- proxy: inline-rewrite input_image file references (Soju06#571)
- proxy: retry transient stream timeouts (Soju06#551)
- proxy: use DEFAULT_HOME_DIR for oversized response.create dumps (Soju06#575)
- accounts: split compact quota row + recover quota status (Soju06#562, Soju06#559)
- db: size background pool for burst traffic (Soju06#563)
- upstream: drop top_p for gpt-5 (Soju06#538)

Conflict resolved:
- app/modules/proxy/service.py: kept fork's multi-line import + FailurePhase
  (used by deterministic failover at line 8294).

Merge cleanup:
- app/main.py: removed pre-existing duplicate InFlightMiddleware class +
  duplicate _is_benign_metrics_bind_failure helper that shadowed canonical
  versions and broke new upstream test (test_in_flight_middleware_does_not_count_drain_status).

Verification:
- pytest tests/unit: 1459 passed, 17 failed (all pre-existing on backup
  branch backup/pre-upstream-merge-20260511 — date-bound API key tests,
  test_db_migrate.py SQLite env, settings duplicate validators).
- openspec validate --specs: 19/19 passed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
vitalNohj pushed a commit to vitalNohj/codex-lb that referenced this pull request Jul 17, 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.

2 participants