Classify every Codex turn failure and route it where work continues - #248
Conversation
Codex ends the turn on any in-stream failure it does not recognize, so the proxy previously only rescued the two capacity codes it knew. Failures now classify by who can fix them, and the default for a code this proxy has never seen is absorb, not forward: forwarding an unknown code loses the turn, absorbing it costs one Azure attempt and restores the original error if Azure refuses it. - Client-caused (context length, invalid prompt, policy, unsupported parameters): forwarded untouched; every provider refuses them the same way. - Quota (usage_limit_reached, insufficient_quota, usage_not_included, rate_limit_exceeded): the account is marked exhausted the way a 429 would mark it. SSE turns are then served from Azure; WebSocket turns close 1012 without pinning so the reconnect lands on another pool account, reaching Azure only when no pool account can start it. Terminal quota events no longer reach the client on either transport. - Everything else, known or future: SSE turns divert to Azure pre-content (preamble tolerance grown to response.in_progress, four events); WebSocket turns pin, close 1012, and the reconnect's 426 pushes the session onto the HTTP transport where the pin serves it. A 402 pool status now also qualifies for the fallback, and a stream quota mark uses the account-wide pool key, matching the WebSocket relay.
|
Warning Review limit reached
Next review available in: 12 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex ends the turn on any in-stream failure it does not recognize, so the proxy previously rescued only the two capacity codes it knew. This classifies every failure by who can fix it, with absorb as the default for unknown/future codes: forwarding an unknown code loses the turn, absorbing it costs one Azure attempt and restores the original error if Azure refuses it.
usage_limit_reached,insufficient_quota,usage_not_included,rate_limit_exceeded): account marked exhausted like a 429. SSE turns then serve from Azure; WebSocket turns close 1012 without pinning so the reconnect lands on another pool account, reaching Azure only when nothing in the pool can start it. Terminal quota events no longer reach the client on either transport (supersedes the ws half of Fail over Codex streaming quota errors #212).response.in_progress, four events); WebSocket pins, closes 1012, and the reconnect's 426 pushes the session onto HTTP where the pin serves it.Tests: full suite PASS,
-race ./internal/proxyPASS, vet clean. Two existing ws quota tests updated to the new contract (event absorbed + 1012 instead of forwarded).Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Classifies all Codex in‑stream failures and routes turns where work can continue. Previously only two capacity codes were absorbed; forwarding unknown failures lost the turn. Now failures classify by who can fix them, and unknown/future codes default to provider-side absorb.
usage_limit_reached,insufficient_quota,usage_not_included,rate_limit_exceeded): account is marked exhausted like a 429. SSE turns then serve from Azure; WebSocket turns absorb the event and close 1012 without pinning so the reconnect lands on another pool account. Terminal quota events no longer reach the client on either transport.response.in_progress, up to four events). WebSocket pins to Azure, closes 1012, and the reconnect gets 426 to push the session onto HTTP where the pin serves the turn. A 402 pool status also triggers the fallback.Written for commit a25bd59. Summary will update on new commits.