Skip to content

Desktop: propagate account/token changes to active threads and retry stale-auth limit failures #32173

Open

Description

@zebriot

What variant of Codex are you using?

Codex App (macOS)

What feature would you like to see?

When account or token A reaches its usage limit, I explicitly switch Codex to account or token B, which still has quota. Threads that were already running remain bound to A. They may continue for a while, but as each thread makes another model request it eventually fails on A's usage limit. I then have to open every affected thread, type continue, and submit it manually; that new turn finally uses B.

This is especially disruptive with several long-running threads. The global account/token switch appears successful, but it does not propagate to the in-memory authentication state of active threads.

This request is not for automatic multi-account rotation. It is about honoring an explicit user-initiated account/token change everywhere in the running app.

Expected behavior

  • An explicit account/token change should invalidate and refresh authentication for all active thread/app-server workers.
  • Any model request started after the switch should use the newly active credential.
  • If a turn fails only because it used a superseded credential, Codex should rebind and retry or resume it once automatically, without requiring a manual continue.
  • The retry should resume from a safe interruption boundary and must not replay already-completed tool side effects.
  • The UI should show which account/token a thread is using, or clearly report when a thread could not be rebound.

Additional information

Steps to reproduce

  1. Sign in with account/token A.
  2. Start several long-running threads concurrently.
  3. Let A reach its usage/rate limit.
  4. While those threads are still active, explicitly switch or sign in to account/token B with available quota.
  5. Observe that existing threads continue using A and later stop with A's usage-limit error.
  6. Open an affected thread and send continue.
  7. Observe that the thread resumes using B.

The screenshot below shows one task stopping at the usage limit and resuming only after I manually send continue.

Related issues

Distinct scope: propagate an explicit credential change across all concurrently active Desktop threads, plus a safe one-time retry for turns interrupted by stale authentication.

Image

Activity

  1. added
    appIssues related to the Codex desktop app
    authIssues related to authentication and accounts
    rate-limitsIssues related to rate limits, quotas, and token usage reporting
    app-serverIssues involving app server protocol or interfaces
    on Jul 10, 2026
  2. briancl2 commented on Aug 6, 2026

    @briancl2

    Adding direct managed-ChatGPT-auth evidence from a sanitized investigation: https://github.com/briancl2/build-meta-analysis/issues/1559#issuecomment-5207186363

    During active delegated work, refresh-token failure produced terminal task_complete events classified unauthorized with no final agent message. A new turn in the persisted task failed again, and a fresh replacement failed before tools. The stored thread, GitHub issue/PR, branch, worktree, and artifact state all survived. After ordinary app re-auth, new turns/tasks worked.

    This supports the requested propagation/rebind behavior and adds one important distinction: current documented thread read/resume plus a new turn preserved work, but no exact failed-turn auto-resume contract was found. A safe repair needs a paused-for-auth state or idempotent resume/rebind boundary that cannot replay completed tool effects.

    Claim ceiling: one bounded macOS Desktop auth-expiry episode; no account-switch, all-host, or product-fix claim.

  3. karolzlot commented on Sep 7, 2026

    @karolzlot

    Reproduced a related app-server bug with stock Codex CLI 0.147.0 and 0.153.4, using a local mock provider and synthetic credentials: complete a WebSocket turn on account A, leave the thread idle, await account/login/start with chatgptAuthTokens for B, confirm B through account/read, then start another turn on the same thread. The next request still uses the WebSocket authenticated as A.

    Two controls distinguish this from a login-ordering problem: HTTP requests correctly use B, and when the preceding WebSocket turn ends with usage_limit_reached, Codex discards that connection and the next turn after switching opens a new socket authenticated as B.

    In 0.153.4, the WebSocket reuse check does not compare the connection’s authenticated identity with the newly applied auth. This provides a concrete transport-level mechanism for stale-account requests after successful login; Desktop’s account-switch propagation was not exercised. Further findings: happier-dev/happier#350.

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

    appIssues related to the Codex desktop appapp-serverIssues involving app server protocol or interfacesauthIssues related to authentication and accountsenhancementNew feature or requestrate-limitsIssues related to rate limits, quotas, and token usage reporting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions