mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
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
181 B
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)