-
Notifications
You must be signed in to change notification settings - Fork 87
Accounts can stay stuck in quota_exceeded after an early upstream reset #293
Description
Summary
After what looked like an unexpected early/global quota reset on the OpenAI side, some accounts in codex-lb stayed stuck in quota_exceeded even though their usage data was already fully reset.
In my case, two accounts got stuck like this:
sharen1994@gmail.comjeanna_curran71@outlook.com
The dashboard/API showed all of these at the same time:
status = quota_exceededprimaryRemainingPercent = 100.0secondaryRemainingPercent = 100.0- valid auth / no deactivation reason
So the accounts looked fully reset from the usage side, but were still treated as quota-blocked from the status side.
Why this matters
This is not just a dashboard display issue.
As far as I can tell, the balancer treats AccountStatus.QUOTA_EXCEEDED as a hard exclusion until its stored reset_at is reached, even if fresh usage rows already say the account is back to 100% remaining.
That means an early upstream reset can leave healthy accounts unavailable inside codex-lb.
What I observed
From /api/accounts, the stuck accounts looked like this (abridged):
status: quota_exceededusage.primaryRemainingPercent: 100.0usage.secondaryRemainingPercent: 100.0remainingCreditsPrimary: fullremainingCreditsSecondary: fulldeactivationReason: null- auth still valid
Other accounts in the same pool were shown as active normally.
Suspected cause
My guess is that this happens when:
- an account was previously marked
quota_exceeded codex-lbstored a futurereset_at- OpenAI resets quotas earlier than expected
- fresh usage data now shows the account as fully reset
- but
codex-lbkeeps the oldquota_exceededstatus because the old storedreset_athas not been reached yet
So usage and account status drift apart.
Expected behavior
If fresh usage data shows the quota is fully reset again, codex-lb should be able to clear stale quota_exceeded automatically instead of waiting only for the previously stored reset timestamp.
In other words, early upstream resets should unstick accounts automatically.
Notes
This may be rare in normal operation, but if OpenAI does an unscheduled/global reset, it seems worth handling, because otherwise some accounts stay unavailable until manually reactivated.