Repository navigation
Description
Area
Authentication and account pool
What are you trying to accomplish?
We want new sessions to use quota that resets soon without concentrating every new session on one account. Among eligible accounts, the account whose weekly reset is closest should receive about half of new-session assignments, while the other eligible accounts share the remaining half by round-robin. Existing session bindings must stay on their account.
What prevents this today?
2.97.0 has reset-first for the Codex pool and generic OAuth pools, but the Anthropic pool rejects it. reset-first is also all-or-nothing: it always prefers the earliest reset account, so one account can receive all new sessions. There is no weighted half allocation.
- Anthropic strategy parsing accepts only
quota,round-robin, andfill-first(src/oauth/pool-kernel.ts:31-43,src/server/management/oauth-account-routes.ts:686-694). - Codex reset-first is implemented at
src/codex/routing/selection.ts:535. - Generic OAuth reset-first is implemented at
src/oauth/generic-account-failover.ts:358. - The gap is the weighted mix and Anthropic support.
We currently run a local patch for this behavior and want to retire it when upstream provides an equivalent opt-in strategy.
What should OpenCodex do?
Add an opt-in reset-near-weighted strategy for Codex and Anthropic account pools. For each new session, consider accounts with:
- a weekly reset within 24 hours,
- 5-hour usage below 60%,
- weekly remaining above 2%,
- usage evidence fresh within 15 minutes.
The earliest-reset eligible account gets weight N-1 (about half of new assignments); the other eligible accounts share the rest by round-robin. If no account qualifies, or evidence is missing or stale, fall back to equal round-robin. Preserve existing bindings and never move a healthy bound session. Keep existing cooldown, pause, reauthentication, and model/priority rules. Do not use missing, future-dated, or stale quota data.
Example usage or interface
ocx account pool codex --strategy reset-near-weighted
ocx account pool anthropic --strategy reset-near-weighted{
"providers": {
"codex": { "accountPool": { "strategy": "reset-near-weighted" } },
"anthropic": { "accountPool": { "strategy": "reset-near-weighted" } }
}
}Alternatives or workarounds
reset-first for Codex (#4079, #7167) consumes the earliest reset but can concentrate all new sessions on one account. Equal round-robin ignores reset urgency. Manual account switching is the current workaround.
Additional context
Related: #3376 (quota history and reset ordering umbrella), #4079 (Codex reset-first), #7167 (generic reset-first), #7234 (closed quota-weighted draft). This request is a weighted half allocation, not pure reset-first or remaining-quota scoring. We can provide the local patch and test evidence if useful.
Checks
- I searched existing issues and documentation.
- This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
- I removed secrets and personal data.
Activity
github-actions commentedon Nov 5, 2026
Automated translation bookkeeping — detected language: English.
vibewriter-hand commentedon Nov 5, 2026
Implementation draft: #8180. The PR is draft because the auth/management surface requires maintainer sponsorship; local typecheck and focused routing tests pass.
Ingwannu commentedon Nov 7, 2026
Confirmed on
dev(aaa3c20f3f):quota,round-robinandfill-first(src/oauth/pool-kernel.ts:30).reset-firstexists only for the Codex pool (src/codex/routing/selection.ts:535) and generic OAuth pools (src/oauth/generic-account-failover.ts:358).This fits under the #3376 reset-scheduling umbrella.
Scope: a new strategy needs an owner decision.
src/oauth/anthropic-routing.ts). Adding reset-driven scheduling there is a policy change, not just a new value for the parser to accept.reset-firstalready exists there.Design questions:
weekly_allwindow, or a model-scoped row (e.g. Fable) when the request targets that family? This depends on the open [Bug]: Inactive weekly_scoped (Fable) limits are still dropped after #8088, hiding real per-account Fable usage from the pool #8110 decision about inactive scoped rows.stickyLimit. The weighting applies per new session, so the "about half" target needs a defined interaction withstickyLimit> 1.#8180 (draft) implements this. It changes pool strategy parsing and the management routes, so it needs the completed readiness checklist and a maintainer review first. This comment does not approve it.
lidge-jun commentedon Nov 19, 2026
Implemented by #8180, merged into
devas 7d9de0d. The Codex and Anthropic pools have a newweightedstrategy. The eligible account whose quota resets soonest gets about half of new-session assignments, and the remaining accounts share the rest by round-robin. Existing session bindings stay on their account.Weighted placement only uses fresh five-hour and weekly quota evidence that belongs to the current credential. When that evidence expires, routing falls back to plain round-robin. The dashboard settings and the English and Spanish docs describe the strategy.