Skip to content

[codex] distinguish ChatGPT accounts by email and plan#66

Open
ThWink wants to merge 1 commit into
Lampese:mainfrom
ThWink:email-plan-account-identity
Open

[codex] distinguish ChatGPT accounts by email and plan#66
ThWink wants to merge 1 commit into
Lampese:mainfrom
ThWink:email-plan-account-identity

Conversation

@ThWink

@ThWink ThWink commented Jun 4, 2026

Copy link
Copy Markdown

Summary

  • distinguish ChatGPT accounts by normalized email + plan type
  • allow the same email to be added when the plan differs, such as Plus vs Team
  • automatically disambiguate duplicate display names with a plan suffix
  • add attribution in the README for the original project and author

Root Cause

The storage layer only enforced uniqueness by display name. Same-email accounts with different ChatGPT plans were hard to manage because the UI could present them as the same account, and duplicate display names blocked adding a second account cleanly.

Validation

  • cargo test --manifest-path src-tauri/Cargo.toml --quiet
  • npm run build

@emreertunc emreertunc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I found one real issue and two minor cleanup points.

Real issue
The duplicate ChatGPT identity rule is only enforced when adding a new account. add_account rejects an existing same email + same plan pair, but later refresh paths can still update an account’s email/plan without checking whether that makes it collide with another stored ChatGPT account. This can happen through token refresh / metadata refresh. If the goal is “same email + same plan must not exist twice”, the invariant needs to be enforced on metadata/token updates too, not only on initial add.

Minor / cleanup
ensure_unique_account_name now applies to all account types, so duplicate API-key account names may be silently renamed to something like Name (account) instead of failing as before. If intentional, fine; if this PR is only about ChatGPT email+plan identity, this is a small scope creep.

Minor / cleanup
The README attribution says this project is based on Lampese/codex-switcher, but this PR targets Lampese/codex-switcher itself. That attribution makes sense in a fork, but looks odd in the upstream repo.

@emreertunc
emreertunc marked this pull request as ready for review June 18, 2026 21:37
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.

2 participants