fix(accounts): refresh snapshot by email even when not active#23
Merged
Conversation
Previously the relogin path only refreshed a matching-email snapshot when it was the active one. Re-logging into a non-active account whose canonical email-shaped snapshot already existed threw SnapshotEmailMismatchError. Drop the activeName gate so any snapshot whose recorded email matches the incoming auth email is refreshed in-place.
4 tasks
NagyVikt
added a commit
that referenced
this pull request
May 13, 2026
…erminal (#24) restoreSessionSnapshotIfNeeded materialized the auth symlink only after the session-pin lookups. In a fresh terminal with no pinned session, it early-returned without materializing, leaving ~/.codex/auth.json as a symlink into accounts/<name>.json from older installs. The shell hook then ran `codex login`, which wrote through the symlink and overwrote the previously-active snapshot in place; syncExternalAuthSnapshotIfNeeded afterward saw the corrupted file matched the incoming identity and renamed it, wiping the previous account. Move the materialize step above all early returns so the symlink is flattened before `codex login` ever sees auth.json. Also exclude update-check.json (the npm version cache) from listAccountNames so it stops appearing as a phantom account in `codex-auth list`. Realign the email-shaped-duplicate test with the refresh-by-email behavior introduced in #23: same-email re-login now refreshes the canonical snapshot in place with forceOverwrite=true, instead of spawning a --dup-2 entry. Co-authored-by: NagyVikt <nagy.viktordp@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Drops the activeName gate from email-match branches in resolveExistingAccountNameForIncomingSnapshot and resolveRegistryAccountNameForIncomingSnapshot. Re-logging into a non-active account whose canonical email-shaped snapshot exists with mismatched recorded email no longer throws SnapshotEmailMismatchError; the snapshot whose recorded email matches the incoming auth is refreshed in-place.