Area
Authentication and account pool
What are you trying to accomplish?
I want new or currently unbound tasks to drain account quota in an explicit reset-window order while preserving the account affinity of healthy bound tasks.
Two workflows are useful:
- Soonest reset first consumes quota that would expire sooner, reducing capacity lost at the next reset.
- Latest reset first concentrates work on the freshest quota window before moving to accounts whose reset is nearer.
The choice should be explicit because the two policies optimize different operator preferences.
What prevents this today?
The current quota, round-robin, and fill-first strategies do not order eligible accounts by their reported reset timestamps. Manual selection order can approximate this once, but it is static: after an account resets and its next reset timestamp advances, the operator must refresh quota and reorder every account again.
This is especially cumbersome for pools whose weekly reset times are staggered across several days. The dashboard already displays per-account reset timestamps, but routing cannot use the same evidence.
What should OpenCodex do?
Add an opt-in reset-window account-pool strategy with an explicit order:
soonest: choose the eligible account with the nearest fresh future reset.
latest: choose the eligible account with the farthest fresh future reset.
The strategy should:
- preserve healthy live thread/session affinity;
- respect pause, reauthentication, cooldown, account usability, and configured selection-order tiers before reset ordering;
- use the provider's governing long quota window (weekly where available, monthly for plans that expose a monthly primary window);
- treat missing, non-finite, elapsed, or stale reset timestamps as unknown evidence;
- prefer accounts with known reset evidence, then fall back deterministically to the existing quota selection when no eligible account has usable reset evidence;
- continue to use
autoSwitchThreshold as the drain point, including its existing 0 behavior that disables percentage-driven switching;
- apply the same observable policy to the Codex and opt-in Anthropic account pools where per-account quota evidence is available;
- expose the strategy and direction through config, CLI/management API, dashboard copy, and documentation.
No existing default should change.
Example usage or interface
{
"accountPoolStrategy": "reset-window",
"accountPoolResetOrder": "latest",
"autoSwitchThreshold": 0
}
With eligible accounts reporting future governing resets at Tuesday, Thursday, and Saturday, latest assigns new/unbound work to Saturday first. It keeps doing so until the account reaches the configured drain condition or becomes unavailable, then chooses Thursday and Tuesday.
{
"accountPoolStrategy": "reset-window",
"accountPoolResetOrder": "soonest",
"autoSwitchThreshold": 90
}
The same pool instead assigns new/unbound work to Tuesday first and moves after the 90% drain point. Healthy bound work remains on its affined account.
Suggested dashboard controls:
Rotation strategy: Reset window
Reset order: Soonest first | Latest first
Alternatives or workarounds
- Refresh quota, manually rewrite every account's Selection order, and repeat after each reset.
- Use
fill-first, which drains one account but follows stable account-id order rather than reset order.
- Use
quota, which balances known usage but does not minimize or maximize reset deadlines.
- Run an external scheduler that rewrites account priorities. This duplicates routing policy outside OpenCodex and can race live quota refreshes.
Additional context
Checks
Area
Authentication and account pool
What are you trying to accomplish?
I want new or currently unbound tasks to drain account quota in an explicit reset-window order while preserving the account affinity of healthy bound tasks.
Two workflows are useful:
The choice should be explicit because the two policies optimize different operator preferences.
What prevents this today?
The current
quota,round-robin, andfill-firststrategies do not order eligible accounts by their reported reset timestamps. Manual selection order can approximate this once, but it is static: after an account resets and its next reset timestamp advances, the operator must refresh quota and reorder every account again.This is especially cumbersome for pools whose weekly reset times are staggered across several days. The dashboard already displays per-account reset timestamps, but routing cannot use the same evidence.
What should OpenCodex do?
Add an opt-in reset-window account-pool strategy with an explicit order:
soonest: choose the eligible account with the nearest fresh future reset.latest: choose the eligible account with the farthest fresh future reset.The strategy should:
autoSwitchThresholdas the drain point, including its existing0behavior that disables percentage-driven switching;No existing default should change.
Example usage or interface
{ "accountPoolStrategy": "reset-window", "accountPoolResetOrder": "latest", "autoSwitchThreshold": 0 }With eligible accounts reporting future governing resets at Tuesday, Thursday, and Saturday,
latestassigns new/unbound work to Saturday first. It keeps doing so until the account reaches the configured drain condition or becomes unavailable, then chooses Thursday and Tuesday.{ "accountPoolStrategy": "reset-window", "accountPoolResetOrder": "soonest", "autoSwitchThreshold": 90 }The same pool instead assigns new/unbound work to Tuesday first and moves after the 90% drain point. Healthy bound work remains on its affined account.
Suggested dashboard controls:
Alternatives or workarounds
fill-first, which drains one account but follows stable account-id order rather than reset order.quota, which balances known usage but does not minimize or maximize reset deadlines.Additional context
autoSwitchThreshold: 0and rejection-driven recovery, which should remain orthogonal to assignment order.reset-windowfor an analogous Combo strategy that prefers the nearest future reset. Reusing that vocabulary would keep routing concepts consistent while the account-pool direction setting adds the explicitlatestworkflow.Checks