Skip to content

Accounts can stay stuck in quota_exceeded after an early upstream reset #293

@SHAREN

Description

@SHAREN

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.com
  • jeanna_curran71@outlook.com

The dashboard/API showed all of these at the same time:

  • status = quota_exceeded
  • primaryRemainingPercent = 100.0
  • secondaryRemainingPercent = 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_exceeded
  • usage.primaryRemainingPercent: 100.0
  • usage.secondaryRemainingPercent: 100.0
  • remainingCreditsPrimary: full
  • remainingCreditsSecondary: full
  • deactivationReason: null
  • auth still valid

Other accounts in the same pool were shown as active normally.

Suspected cause

My guess is that this happens when:

  1. an account was previously marked quota_exceeded
  2. codex-lb stored a future reset_at
  3. OpenAI resets quotas earlier than expected
  4. fresh usage data now shows the account as fully reset
  5. but codex-lb keeps the old quota_exceeded status because the old stored reset_at has 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions