Make switching between multiple Codex accounts easy on macOS#644
Make switching between multiple Codex accounts easy on macOS#644igneous-prose wants to merge 6 commits intosteipete:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c41ad3ad0b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
There is already a menu switcher in |
|
Thanks for the PR @igneous-prose ! This feature was already in the works but since we had the same idea at around the same time, I'll be crediting you for the idea as well :) |
Summary
This PR makes it easy to switch between multiple Codex / ChatGPT accounts on macOS without manually copying auth files or re-running login flows.
CodexBar can now save named local profiles from the current
~/.codex/auth.jsonand restore them later. Because bothCodex.appand thecodexCLI use that auth file, switching a saved profile effectively switches the active account for both Codex Desktop and Codex CLI.CodexBar is the UI for the workflow, but the main user benefit is simple multi-account switching for Codex on macOS.
Why This Matters
Today, switching between Codex accounts on macOS usually means manually replacing
~/.codex/auth.jsonor signing in again.This PR turns that into a one-time setup:
Codex.apporcodex.After a switch, the restored auth is the one used by both
Codex.appand thecodexCLI.What This Adds
Local Profilessection in the Codex provider settings.Switch Local Profilesubmenu in the Codex menu bar menu.Save Current Account…, which copies the current live Codex auth into~/.codex/profiles/<name>.json.~/.codex/auth.json.Codex.appafter a successful switch so the desktop app picks up the restored account.Multi-Account Workflow
This is intended to work for more than two Codex accounts.
The flow is:
Save Current Account…in CodexBar.There is no hard-coded account limit in this change. The practical limit is UI usability rather than the implementation.
Safety And Behavior
~/.codex/profiles.Codex.appand any runningcodexCLI sessions.Codex.appafter a successful switch.~/.codex/auth-backupsbefore switching and prunes older backups.AccountsUI close to the current CodexBar layout and isolates the new workflow in a separateLocal Profilessection.Screenshots
Menu Bar Switching
Settings Local Profiles Section
Settings Help Tooltip
Verification
swift build./Scripts/compile_and_run.shSave Current Account…when the current live auth already matches a saved profilecorepack pnpm checkstill reports an unrelated pre-existing formatting issue inSources/CodexBar/Providers/Codex/UsageStore+CodexAccountState.swiftswift test --filter ...is still blocked by unrelated pre-existing test-compilation failures in existing test files such asSettingsStoreTests.swiftandStatusItemAnimationTests.swiftNotes