Skip to content

Codex re-auth updates managed credentials but matching system account keeps using revoked token #3558

Description

@Nek-12

Summary

On CodexBar 0.58.0 (141), a saved Codex account that also matches the system Codex login stays at Needs re-auth after repeated successful reauthentication through CodexBar settings.

Reauthentication produces a valid credential in CodexBar's managed account home, but the visible account continues using the revoked credential in ~/.codex/auth.json. Selecting OAuth API as the quota usage source does not resolve the mismatch.

Environment

  • macOS, Apple Silicon; CodexBar 0.58.0 (141).
  • Two saved OpenAI/Codex accounts; only the account matching the system login is affected.
  • Advanced Account Security enabled on the affected account. This is context, not an established cause: its freshly authenticated credential successfully fetched usage.

Reproduction observed

  1. Have a saved Codex account also represented by the system Codex login.
  2. The system credential becomes invalid/revoked.
  3. Re-authenticate that account through CodexBar account settings.
  4. Authentication succeeds, but usage continues showing Needs re-auth.
  5. Repeat authentication and explicitly select OAuth API; the failure persists.

Diagnostic evidence

The saved account snapshot used selectionSource.kind = liveSystem, with a different credential fingerprint from the managed account's fresh login.

Read-only GET requests to https://chatgpt.com/backend-api/wham/usage, using the respective existing credentials and the same account header, returned:

Credential Result
System ~/.codex/auth.json HTTP 401, token_revoked: Encountered invalidated oauth token for user, failing request
Fresh CodexBar managed account auth.json HTTP 200 with usage data

The system access token was issued September 1, 2026 and expired September 11. The managed credential was issued September 11 and expires September 21. No refresh-token redemption was attempted during this comparison.

Relevant implementation

In Sources/CodexBarCore/Providers/Codex/CodexVisibleAccountProjection.swift, the matching live-system account replaces the managed account draft with selectionSource: .liveSystem and the live credential fingerprint, while retaining the saved account ID and reauthentication capability.

ManagedCodexAccountService.authenticateManagedAccount authenticates into a new managed home and updates the stored account. This appears to leave the visible account reading a different credential than the one just renewed.

The live-system projection preference is also present in the v0.59.0 source; runtime reproduction was on v0.58.0 only.

Expected behavior

After successful reauthentication of a visible account, its usage fetch should use the newly authenticated credential. If repairing the system login requires separate consent, the UI should explain that and offer the appropriate action instead of repeatedly renewing an unused credential.

Verified local repair

After backing up the system auth file, replaced it atomically with the already-working managed auth file for the same account. CodexBar CLI usage with --provider codex --source oauth then succeeded, and the user confirmed the menu recovered.

No security setting changes or additional sign-in were necessary.

Potentially related: #3523 / #3534 concern renewal guidance, but this report specifically concerns reauthentication updating one credential while the visible account continues using another.

Activity

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

    P0Emergency: data loss, security bypass, crash loop, or unusable core runtime.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.impact:ux-release-blockerA non-technical user is blocked without terminal, logs, config, or support.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions