feat(codex): prefer accounts near quota reset - #4080
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks 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 |
|
⏳ DRAFT
What to do
Review readiness checklist
✅ 4/4 boxes ticked. This pull request was already a draft. Its draft status will be preserved after every issue above is resolved. |
리뷰 · 우선순위 61 / 80설명 이 PR은 Codex 계정 풀에 옵트인 전략 동작 요약. 이미 적격이고 구현 축: 게이트: Draft + 라인 - 이게 무슨 문제다 게이트 30일( 비영어 locale 문서 - fr/ja/ko/ru/… providers.md에 reset-first 설명 문단이 영어 그대로 들어가 있다. 표의 전략 enum만 번역되고 본문 설명은 영어. i18n 일관성·docs lint 정책에 걸릴 수 있다. 각 locale 문장으로 옮기거나, 공통 영어 note 위치를 문서 규칙에 맞게 정리하자.
Affinity 교체 - threshold를 넘긴 뒤에야 reset 순으로 갈아탄다. quota 전략의 “더 시원한 계정으로 선제 이동”과는 다르다. 문서 hint(“bound tasks switch only at the threshold or on failure”)와 일치한다. 제품으로 OK.
메인테이너의 판단이 필요한 지점
너의 추천 #4079를 닫는 구현으로 방향이 맞다. 지금 당장 머지는 말고 스폰서 후 Ready. 다음 스텝: (1) 메인테이너 스폰서, (2) locale 영어 문단 정리 또는 번역, (3) 30d 제외를 UI/문서에 명시, (4) CI green 후 이 댓글은 grok-bot이 작성했습니다 |
Summary
Add the opt-in Codex-only
reset-firstaccount-pool strategy so usable quota whose 5-hour or weekly window resets soonest is consumed first. Existing eligibility, priority tiers, and the maximum-usage threshold run before reset ordering; ties or missing/elapsed reset evidence use lowest usage and stable pool order. Bound tasks retain affinity until the threshold or a failure requires a replacement, with matching preview and failover selection.The dashboard, CLI help, management API, config type, and configuration docs expose the strategy. Threshold
0preserves reset ordering while disabling usage filtering; if every eligible account exceeds the threshold, the existing best-effort lowest-usage fallback remains. Default strategies and Anthropic routing are unchanged; there are no dependencies or migrations.Closes #4079. Related to the ordering portion of #3376 and #2874 / #2881. This is a narrower alternative: Codex only, minimum of the future 5-hour and weekly resets, no latest-first direction, history storage, capacity estimation, or Anthropic expansion. It does not close the broader umbrella issue.
Verification
bun run typecheck— passed.bun run test— passed: 21,962 pass, 40 skip, 0 fail across seven runner groups.bun test tests/codex-integration/codex-pool-rotation.test.ts— 74 pass, including dual-window order, threshold crossing, affinity, preview, failover, expiry, priority and disabled-threshold behavior.bun test tests/server/account-pool-management-api.test.ts— 22 pass; includes reset-first persistence and config reload.cd gui && bun test tests/account-pool-strategy.test.tsx tests/codex-account-auto-switch.test.tsx— 34 pass; after adding the reset-first rendering case, the strategy file separately passed all 14 tests.cd gui && bun run lint:i18n && bun run build— passed (existing bundle-size warning).cd gui && bun run lint— passed after removing the temporary browser preview entry.cd docs-site && bun install --frozen-lockfile && bun run build— passed, 425 pages.bun run privacy:scanandgit diff --check— passed.GUI screenshot (isolated component preview):
Checklist
Remote gate:
hygienereportsunsponsored_surfaceforsrc/codex/auth-api.ts; a maintainer must review it and applymaintainer-sponsored. Local validation is green.Maintainer review is requested for the existing management route's expanded strategy validation; this change adds no endpoint, credential operation, or auth bypass. Contributor draft is intentional; no self-approval or merge is requested.
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.