Fix Codex same-email multi-workspace account correctness#629
Fix Codex same-email multi-workspace account correctness#629monterrr wants to merge 2 commits intosteipete:mainfrom
Conversation
Co-Authored-By: Craft Agent <agents-noreply@craft.do>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c41d168e8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| visibleByID[visibleID] = CodexVisibleAccount( | ||
| id: existing.id, | ||
| email: existing.email, | ||
| workspaceLabel: existing.workspaceLabel, |
There was a problem hiding this comment.
Use live workspace label when merging account rows
This merge path keeps existing.workspaceLabel even when the live system account resolved the same identity with a newer authoritative workspace name. In the migrated/stale-label case (for example, stored as Personal but live resolves team workspace), the UI continues showing the stale label and fails the intended same-email workspace disambiguation until the account is re-authenticated. Use the live normalized workspace label here (with fallback to existing only when live is missing).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 91af1f10. When a stored and live Codex account reconcile to the same visible identity, the merged row now prefers the live authoritative workspace label instead of preserving a stale stored one. I also added a regression test covering the stale Personal vs live team label case.
Co-Authored-By: Craft Agent <agents-noreply@craft.do>
|
Follow-up for the remaining Codex multi-account menu work is here: #633 It covers the It builds on top of this PR, so it should make the most sense once |
|
Majority of the work that this PR is doing has been merged into main. Thanks @monterrr ! Added you as co-author the commit. |
Context
This is a follow-up to the earlier Codex multi-account work around #545, first proposed in #588 and later merged in #613.
After using and testing the merged flow more, I found a remaining correctness gap in the same-email / different-workspace case.
Summary
The same-email / different-workspace case could collapse distinct Codex accounts into one identity. In practice, that could block adding the second account entirely, or let a team-selected account still be persisted/displayed as
Personal.This PR makes account identity workspace-aware across persistence, reconciliation, OpenAI web scoping, and compact switcher labeling.
Screenshots
Switcher view: same-email accounts remain distinguishable in the compact top-bar switcher.

Settings view: personal and team accounts using the same email can coexist as separate selectable accounts.

What this fixes
PersonalValidation
corepack pnpm check./Scripts/compile_and_run.sh