Files
OmniRoute/changelog.d/fixes/7737-codex-multiaccount.md
Diego Rodrigues de Sa e Souza cb604309ae fix(oauth): require chatgptUserId agreement for Codex account dedup (#7737) (#7825)
Codex OAuth completion (persistOAuthConnection, and the duplicated
exchange/poll/poll-callback pre-checks in the OAuth completion route)
matched an incoming login to an existing connection by email alone
whenever neither side had a workspaceId, silently overwriting a
second distinct Codex account that happens to share an email with
the first. createProviderConnection already disambiguates by
chatgptUserId (#6706), but that path was never reached because the
pre-checks always found an email match first.

Extract the matching logic into a shared
findExistingOAuthConnectionMatch() helper in connectionPersistence.ts
and use it at all 4 OAuth-completion call sites. When neither the
incoming nor existing Codex connection has a workspaceId, only merge
if chatgptUserId agrees; otherwise fall through to
createProviderConnection so its existing disambiguation applies.

Regression test: tests/unit/oauth-connection-persistence-codex-dedup.test.ts
2026-07-20 01:43:39 -03:00

181 B

  • fix(oauth): stop Codex OAuth completion from collapsing distinct accounts that share an email but have no workspaceId, by requiring chatgptUserId agreement before merging (#7737)