Skip to content

fix(accounts): avoid team auth snapshot collisions#104

Open
tinywind wants to merge 1 commit intofriuns2:mainfrom
tinywind:bugfix/account-identity-collision
Open

fix(accounts): avoid team auth snapshot collisions#104
tinywind wants to merge 1 commit intofriuns2:mainfrom
tinywind:bugfix/account-identity-collision

Conversation

@tinywind
Copy link
Copy Markdown
Contributor

Summary

  • Store saved Codex auth snapshots by account_id + user_id when the access token exposes a user id
  • Fall back to the previous account_id-only identity for tokens without a user id
  • Keep the runtime auth.json payload unchanged while routing UI switch/remove actions through the unique storage id
  • Update the DB import helper and manual verification notes to use the same storage identity

Why

Multiple users in the same ChatGPT team/workspace can share the same tokens.account_id while having distinct user_id and email claims. Using account_id alone causes reload/import to overwrite the previous user snapshot.

Verification

  • git diff --check
  • Build/test commands were not run per request

@qodo-code-review
Copy link
Copy Markdown

ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

@tinywind tinywind force-pushed the bugfix/account-identity-collision branch from ff717fe to a1c923f Compare April 29, 2026 19:39
@friuns2
Copy link
Copy Markdown
Owner

friuns2 commented Apr 29, 2026

I think there is still a migration bug here.

activeAccountId used to be a unique key. After this change it is not. On first load, resolveActiveStorageId() falls back from the legacy activeAccountId to the first matching account with the same accountId.

That means a team with multiple users sharing one accountId can still silently activate the wrong snapshot after upgrade. The overwrite problem is fixed, but active-account restoration is still ambiguous.

I would not merge this without a deterministic migration story for legacy state.

Use a storage identity derived from account_id plus user_id when available, falling back to account_id for tokens without a user id. This keeps Codex auth payloads unchanged while preventing multiple users in the same workspace from overwriting each other's saved snapshots.
@tinywind tinywind force-pushed the bugfix/account-identity-collision branch from a1c923f to da0539f Compare April 30, 2026 04:59
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