Skip to content

Quota exhaustion is returned as retryable rate_limit_error, so Codex shows "exceeded retry limit, 429" instead of the usage-limit message #6000

Closed as not planned

Description

@jpkken1979

Summary

When the main Codex (ChatGPT) account is exhausted, opencodex answers Codex with HTTP 429 rate_limit_error. Codex treats that type as transient, retries until its limit and shows only:

exceeded retry limit, last status: 429 Too Many Requests

Talking to OpenAI directly, the same situation returns usage_limit_reached, which Codex treats as terminal and renders as a clear "usage limit reached, try again at " message. Through opencodex the user gets an opaque error, wasted retries, and no reset time.

Environment

  • opencodex 2.67.0 (latest on npm at the time of writing), Windows 11, scheduler backend
  • Codex Desktop 0.158.0-alpha.2.1, model_provider = "opencodex", authless Desktop mode
  • One openai account (main, plan prolite), no reset credits used

Evidence

  • ocx account list openai --quota --json → "quota": {"weeklyPercent": 99, "weeklyResetAt": ...}
  • Codex rollout rate_limits.primary.used_percent: 99.0, window_minutes: 10080, credits.balance: "0"
  • Every turn with a GPT model failed with the message above, including a one-word prompt; turns routed to other providers (google-antigravity) worked. After the weekly reset (weeklyPercent: 0) GPT turns worked again with no config change.

Where it comes from

src/codex/auth-context.ts — cooldownErrorResponse():

const res = formatErrorResponse(429, "rate_limit_error", cooldownErrorMessage(err, accountSelector));

This path is used for quota cooldowns and for CodexMainAccountHardLockError alike. src/codex/quota-rejection.ts already documents that openai/codex maps quota codes (#44492, #45602) to a terminal QuotaExceeded while keeping rate_limit_exceeded retryable, so the classification seems to be the only missing piece.

A related surprise: the main account is hard-locked at MAIN_ACCOUNT_HARD_LOCK_PERCENT = 98 (src/codex/quota-types.ts), so at 99 % used / 1 % remaining even a trivial request is refused locally, while native Codex would still spend that last percent. That may well be intended (protecting the reserve), but it is not visible to the user and it is not configurable.

Expected

  1. When the cause is quota exhaustion or the main-account hard lock (not a real short-lived rate limit), return an error type Codex treats as terminal (e.g. usage_limit_reached / insufficient_quota, whichever Codex maps to QuotaExceeded), with the reset time in the message.
  2. Optionally: make the 98 % hard lock configurable, or mention it in the error text ("blocked by the 98 % main-account policy until ").

Steps to reproduce

  1. Use the main Codex account until the weekly window is >= 98 %.
  2. Send any prompt with an OpenAI model through opencodex.
  3. Codex retries and fails with exceeded retry limit, last status: 429 Too Many Requests instead of a usage-limit message.

Activity

  1. github-actions commented on Sep 26, 2026

    @github-actions
    Contributor

    Issue closed: use an issue template

    Thanks for taking the time to submit this issue. It was closed automatically because it was not opened with a recognized issue template (Bug report, Feature request, Documentation, or Provider compatibility). Freeform and API-opened issues cannot skip this check.

    • This looks like a bug report but it does not use the Bug report template headings (for example Description/Log entry instead of Summary).

    Please edit the issue to add:

    • Use the Bug report template, or edit this issue to include: Client or integration, Summary, Reproduction, Version, and Operating system.
    • Retitling with [Bug]: and applying the bug label alone is not enough without those section headings filled in.

    See the Contributing guide for details.

    Once the report passes the automated checks, it will be reopened automatically unless a maintainer has changed its state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolOAuth, credentials, Codex pool, quota, failover, plans

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions