Fix Codex workspace account matching#796
Merged
ratulsarna merged 1 commit intosteipete:mainfrom Apr 27, 2026
Merged
Conversation
Treat provider-backed Codex account identities as email plus workspace account ID instead of assuming the workspace ID is globally unique. Different OpenAI users can belong to the same team workspace, so matching only on providerAccountID caused add-account flows to replace an existing email with the newly authenticated email. Prompt for a workspace when the login exposes multiple OpenAI workspaces, persist the selected workspace ID into the managed auth file, and keep workspace labels cached for display. Reconciliation, visible account projection, and promotion no-op checks now use email-aware provider identity matching so live and managed rows for different emails in the same workspace do not collapse. Add regression coverage for selecting and persisting workspaces, preserving same-workspace accounts with different emails, and avoiding live/managed row merging when provider account IDs match but emails differ.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification
pnpm checkswift test --filter CodexAccountProviderIdentityReconciliationTestsswift test --filter ManagedCodexAccountServiceTestsswift test --filter ManagedCodexAccountStoreTestsswift test --filter CodexAccountReconciliationTestsswift test --filter CodexAccountPromotionPlanningTestsswift test --filter CodexAccountPromotionServiceTests./Scripts/compile_and_run.shNotes
./Scripts/compile_and_run.sh --testhit an existing headless AppKit status-bar drawing crash inNSStatusBarButtonCell drawWithFrame, outside the Codex account identity path. The targeted account and promotion test suites above pass, and the app was rebuilt/relaunched successfully with./Scripts/compile_and_run.sh.