Repository navigation
Description
Client or integration
Codex App
Area
Authentication and account pool
Summary
When every Anthropic OAuth account in the pool is out of its five-hour or weekly quota, OpenCodex answers Codex with HTTP 429 rate_limit_error / rate_limit_exceeded. Codex treats that class as transient, keeps retrying ("reconnecting 1/5 ... 5/5") and ends with exceeded retry limit, last status: 429 Too Many Requests. The user sees a long "thinking" state and never learns that the quota is spent or when it resets.
I expected the same terminal class that OpenAI returns for a spent plan: usage_limit_reached with resets_at. Codex renders that class as "Usage limit reached ... try again at " and stops at once.
This is the Anthropic-pool form of #6000, which was closed automatically for the issue template and not fixed.
Reproduction
- Configure an Anthropic OAuth account pool and let every account reach its five-hour (or weekly) limit.
- Send a Codex turn with
anthropic/claude-opus-5-5. - Observe: the pool logs
no eligible replacement; returning 429, and every later turn is refused locally in 2-9 ms withrate_limit_exceeded. Codex retries each turn (one conversation logged 16 refused requests) and shows only the retry-limit message.
Version
2.83.0
Operating system
macOS (Bun 1.4.2), Codex 0.162.1
Provider and model
anthropic / claude-opus-5-5 (any Anthropic OAuth pool model)
Logs or error output
[anthropic-pool] 429 on <account-a>; failing over to <account-b>
[anthropic-pool] no eligible replacement; returning 429
usage.jsonl: provider=anthropic status=429 errorCode=rate_limit_exceeded failureCause=rate-limit durationMs=2..9 (78 rows)
Codex: exceeded retry limit, last status: 429 Too Many RequestsSource-level analysis (v2.83.0)
src/oauth/anthropic-routing.ts:75-80:AnthropicAccountCooldownError("All Anthropic OAuth accounts are temporarily rate-limited"). The pool already knows each cooldown source (retry-after,reset-derived,default, lines 84-100), so it knows when a cooldown is a drained quota window and when it resets.src/server/responses/adapter-dispatch.ts:518-520andsrc/server/responses/passthrough-dispatch.ts:951-953turn that error intoformatErrorResponse(429, "rate_limit_error", ...)withRetry-After.src/lib/errors.ts:448-458maps every 429 torate_limit_exceeded. The quota information is lost here.- The comment at
adapter-dispatch.ts:521-524says "the Codex client ... does not retry a 429", but Codex 0.162.1 does retryrate_limit_exceededand ends with the retry-limit message.
Proposed change
- When
AnthropicAccountCooldownErrorfires and every blocking cooldown isreset-derived(quota window), return HTTP 429 witherror.type = "usage_limit_reached",resets_at= earliest reset (epoch seconds), and a message that names the provider and the reset time. Keeprate_limit_exceededfor shortretry-afterthrottles. - Apply the same rule to the Codex-account cooldown path (
src/codex/auth-context.ts:946). - Test: a reset-derived cooldown yields
usage_limit_reached+resets_at; a retry-after cooldown yieldsrate_limit_exceeded+Retry-After.
Related: #6989 (Retry-After-sourced cooldowns not recovering).
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
docs(providers): translate the Anthropic usage-limit and fresh-read r…
fix(anthropic-pool): answer spent quota as a usage limit and let fres…
fix(anthropic-pool): report only complete window resets and cover the…
docs(providers): translate the Anthropic usage-limit and fresh-read r…
fix(anthropic-pool): answer spent quota as a usage limit and lift Ret…
lidge-jun commentedon Oct 12, 2026
Fixed on
devby #6995 (commitbbe1fc19da), landed through #7009 (merge8f10f238e3). Ships in 2.84.0.fix(responses): carry WS dispatch override, pooled key rotation, usag…