Repository navigation
Description
Client or integration
Direct HTTP/API client (OpenCode via /v1/chat/completions, translated to Responses upstream)
Area
Authentication and account pool
Summary
A Codex pool account opted in under "Use credits" (creditCodexAccountIds) with a positive ChatGPT credit balance drops out of rotation as soon as its 5h window reaches 100%. It comes back only for five minutes after a manual WHAM read. Requests then fall through to the main account. Main is also full, so the hard lock refuses them locally:
429 rate_limit_exceeded — Codex main account is blocked by the main-account quota policy (5h ≥ 90%, weekly ≥ 98%). Choose another account, wait for quota to reset, or disable codexMainAccountHardLock in Settings.
The credited account is never tried. Nothing is sent upstream, and no credits are spent.
This is the pool-side variant of #6692. #6669 fixed it for the main account: the background sweep renews main credit evidence from 3 minutes of age (MAIN_CREDIT_RENEWAL_AGE_MS in src/codex/auth-api/pool-mode-gate.ts). In 2.88.0 I could not find an equivalent renewal for pool accounts. @WOULDU-pres predicted exactly this gap in #6692 from reading the code ("traffic quietly rotating away from the credited account rather than a 429. A 429 should show up only when that account is pinned, or when every account is held"). Here is a live reproduction where every other account is held.
Expected: an opted-in pool account with fresh-enough-to-renew spendable credits keeps serving after its included window is full, without a dashboard or a manual refresh.
Reproduction
Setup: codexAccountMode: "pool", strategy quota, sticky 1, auto-switch threshold 80%, two Plus accounts:
__main__: credits off, balance 0, hard lock at defaults.- One pool account: listed in
creditCodexAccountIds,hasCredits: true,allowed: true,overageLimitReached: false, balance about 56.8k.
No dashboard was open. One long OpenCode conversation sent requests of about 720k input tokens each.
Timeline (local time, CEST, 2026-10-19):
| Time | Event |
|---|---|
| ~13:16 | Last WHAM observation of pool credits before the incident (ocx account history: wham row) |
| 13:27–13:30 | Pool account served; response headers raised 5h from 84% to 100% (100% observed at 13:30:45) |
| 13:31:09 | Request routed to openai (main) → local 429 hard lock, 128 ms, failureStage: headers-only, no attempts |
| 13:35:47 | Manual ocx account list openai --quota --refresh → pool credits.observedAt renewed |
| 13:40:18, 13:40:44 | Pool account served again from credits (200), credit evidence 4.5 min old |
| 13:42:03 | Credit evidence 6.3 min old → request routed to main → same local 429 |
During 13:40, credits.observedAt in codex-quota-cache.json stayed at 13:35:47 while the pool account was actively serving. Header-driven updates carry the old credits object forward (src/codex/quota.ts, ...(existing?.credits !== undefined ? { credits: existing.credits } : {})), so traffic never renews it.
Code path as I read it on 2.88.0:
isCodexAccountSelectable→isCodexAccountHeldAtUsageLimit→isCodexAccountHeldForCredits→hasSpendableCodexCreditsrejects evidence older thanCODEX_CREDITS_FRESHNESS_MS(5 min). The pool account then leaves rotation (src/codex/routing/selection.ts).- With no selectable pool account, the request reaches
assertMainAccountPolicyand throwsCodexMainAccountHardLockError(src/codex/auth-context.ts). - The recovery sweep's credit renewal (
runMainAccountHardLockRecovery) only covers__main__.
Workaround: running ocx account list openai --quota --refresh every 4 minutes keeps the pool account admitted.
Version
2.88.0 (npm global, launchd service)
Operating system
macOS 26 (Darwin 25.6.0), Apple Silicon
Provider and model
openai (Codex pool) / gpt-6-astra
Logs or error output
# usage.jsonl, trimmed (provider = account route)
13:30:42 openai-<pool> gpt-6-astra 200
13:31:09 openai gpt-6-astra 429 Codex main account is blocked by the main-account quota policy ...
13:40:18 openai-<pool> gpt-6-astra 200
13:40:44 openai-<pool> gpt-6-astra 200
13:42:03 openai gpt-6-astra 429 Codex main account is blocked by the main-account quota policy ...
# ocx logs explain on the 429: candidates=[openai/gpt-6-astra eligible], affinity=null, attemptSequence=[]
# ocx account history openai <pool> (tail)
11:29:17Z response-header account/short 97%
11:30:45Z response-header account/short 100%
11:35:47Z wham account/short 100%Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
github-actions commentedon Oct 19, 2026
Automated translation bookkeeping — detected language: English.
Ingwannu commentedon Oct 19, 2026
Draft fix #7381 now tracks this gap. The existing sweep/primer renews due pool credit evidence independently of usage-header freshness while retaining opt-in, exhaustion, pause/reauth, per-credential backoff and existing query/generation fences. The pool-only reason performs no native-main work and never extends stale credit validity.
The final focused Linux/Bun 1.4.3 run is 173 passed / 0 failed across quota-prime, main credit renewal and hard-lock recovery files, including actual selection admission and sweep-entry controls. Metadata is mocked; no paid inference or live account refresh was performed. Required current-head CI and independent review remain pending; this is not merged/deployed/released.
lidge-jun commentedon Oct 19, 2026
Fixed on dev by #7393 (squash d3dafd3) (carries #7381): opted-in Pool accounts now renew their credit evidence on the existing sweep using WHAM metadata only, so they no longer leave rotation five minutes after the last credit read. It ships in the next release (2.90.0).