Skip to content

fix: sync official login auth across same-account profiles - #1783

Open
Rat0323 wants to merge 1 commit into
BigPizzaV3:mainfrom
Rat0323:fix/sync-official-auth-across-profiles
Open

fix: sync official login auth across same-account profiles#1783
Rat0323 wants to merge 1 commit into
BigPizzaV3:mainfrom
Rat0323:fix/sync-official-auth-across-profiles

Conversation

@Rat0323

@Rat0323 Rat0323 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

Each relay profile stores its own authContents snapshot. When the ChatGPT login refreshes, Codex++ only backfills the currently active profile before switching, so other official / official+API profiles can keep stale tokens. Switching back to one of those profiles may write stale auth into ~/.codex/auth.json, causing Codex to lose the refreshed login.

Change

Before saving a provider switch, sync the current live ChatGPT auth into official profiles that belong to the same account:

  • Only runs when live auth.json is a valid ChatGPT login with a usable account identity.
  • Matches the stable tokens.account_id / JWT chatgpt_account_id when available.
  • Supports legacy snapshots without an account ID by matching their email against the live login.
  • Never treats two unknown identities as the same account.
  • Preserves profiles bound to a different account ID, even when the email is the same.
  • Only touches relayMode = official profiles, including official+API mixes.
  • Leaves pure API / aggregate profiles and non-ChatGPT auth untouched.
  • Strips OPENAI_API_KEY before storing the refreshed login.

The branch is rebased on the current main; unrelated LF-normalization and macOS build-history commits are not part of this PR.

Tests

  • cargo test -p codex-plus-core --test relay_switch
  • cargo test -p codex-plus-core --test relay_config
  • cargo test -p codex-plus-core --lib
  • Manager TypeScript check and frontend tests
  • GitHub Actions Windows and macOS artifact jobs

@Rat0323
Rat0323 force-pushed the fix/sync-official-auth-across-profiles branch from b4cb384 to f006b5b Compare August 12, 2026 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant