Skip to content

fix(codex-pool): skip accounts with zero quota#990

Merged
huangzesen merged 2 commits into
mainfrom
dev3/codex-quota-20260719
Jul 20, 2026
Merged

fix(codex-pool): skip accounts with zero quota#990
huangzesen merged 2 commits into
mainfrom
dev3/codex-quota-20260719

Conversation

@huangzesen

@huangzesen huangzesen commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implement only the agreed zero-quota selection path:

  • internal read_remaining_percent(auth_path) -> float | None uses Codex app-server account/rateLimits/read and reads only the primary window
  • a query failure or malformed/non-finite/out-of-range field returns None
  • new codex-pool selection excludes only accounts explicitly reporting <= 0; None remains eligible
  • surviving weights and original source indices are preserved; existing sessions are untouched
  • if every validated account reports zero, raise CodexPoolAllAccountsExhaustedError("All Codex pool accounts are exhausted")

No public quota API, snapshot/reporting surface, cache/TTL, vision special case, adapter API, dashboard metadata, or extra state machine.

Diff

7 paths, +526 / -14 versus base. This replaces the original +2130 / -32 candidate.

Validation

  • exactly 6 focused feature tests: positive, zero, unavailable fail-open, weights/index, all-zero, immediate reset re-entry — PASS
  • 109 existing test_codex_pool.py regressions — PASS
  • combined: 115 PASS
  • touched production modules compile; git diff --check PASS
  • frozen patch SHA256: fb18a619d1fa4b2ed450bf716e93e8df605945f10a61aab43430c2dba7e895e6
  • independent Terra review of the byte-identical snapshot: PASS, no P0/P1

@huangzesen huangzesen changed the title feat(codex): surface and honor OAuth quota fix(codex-pool): skip accounts with zero quota Jul 19, 2026
@huangzesen
huangzesen merged commit 89fafe9 into main Jul 20, 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.

1 participant