Skip to content

Fix Codex same-email multi-workspace account correctness#629

Open
monterrr wants to merge 2 commits intosteipete:mainfrom
monterrr:codex-same-email-workspace-correctness
Open

Fix Codex same-email multi-workspace account correctness#629
monterrr wants to merge 2 commits intosteipete:mainfrom
monterrr:codex-same-email-workspace-correctness

Conversation

@monterrr
Copy link
Copy Markdown

@monterrr monterrr commented Mar 31, 2026

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.
codex-same-email-workspace-switcher-stripped

Settings view: personal and team accounts using the same email can coexist as separate selectable accounts.
codex-same-email-workspace-settings-stripped

What this fixes

  • same-email accounts from different workspaces can coexist correctly
  • team-selected accounts no longer fall back to Personal
  • OpenAI web/dashboard state is scoped by workspace-aware identity
  • compact switcher labels remain distinguishable for same-email accounts

Validation

  • corepack pnpm check
  • ./Scripts/compile_and_run.sh
  • focused Codex tests covering the changed surfaces

Co-Authored-By: Craft Agent <agents-noreply@craft.do>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Author

@monterrr monterrr Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@monterrr
Copy link
Copy Markdown
Author

monterrr commented Apr 1, 2026

Follow-up for the remaining Codex multi-account menu work is here: #633

It covers the All | Single mode, the compact all-accounts overview, and the simple sort control.

It builds on top of this PR, so it should make the most sense once #629 lands.

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