Skip to content

fix(codex): recover device login after credential rotation - #1163

Merged
nixuuu merged 3 commits into
devfrom
fix/codex-authentication-cross-platform
Nov 23, 2026
Merged

nixuuu merged 3 commits into
devfrom
fix/codex-authentication-cross-platform

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

A native Codex thread could keep a rejected ChatGPT login after its owner signed in again in a terminal. Canopy could report the new account as signed in while the next turn on the same thread still failed.

Account Refresh and worker reprobes now compare the selected credential file's metadata with the last applied configuration. An affected app-server restarts after its turns and background tasks drain. Unchanged credentials keep the process running. Codex's reused or revoked refresh-token diagnostics lead to the existing sign-in action. A turn started after sign-out reports the selected instance's missing login.

Isolated Codex homes share the device file store’s write lock and keep a valid credential link across the gap between terminal sign-out and sign-in. When device login is selected and available, a detached credential file in a managed home is backed up before restoring the link. Custom homes retain their existing protection.

Codex 0.171 serializes writes after the OAuth exchange. Two independent clients sharing a ChatGPT grant can still request refresh concurrently. A separate instance login gives Canopy its own grant when the terminal is also in use. File sharing on Windows requires file-symlink permission.

Verification

  • On Linux, Codex CLI 0.171.0 refreshed a synthetic ChatGPT login twice against a local OAuth endpoint, first from the isolated home and then from the device home. Both rotations reached the selected source file.
  • Focused worker tests exercised logout/login, lock identity, nested bot homes, legacy recovery and notification classification. Gateway↔worker integration covered both private and linked logins, in-flight work and a successful next turn on the original thread.
  • Worker typecheck, edited-file lint and diff checks passed locally. CI runs the store tests on Windows and macOS too. Interactive sign-in to a real ChatGPT account was outside local verification.

Copy audit

An account error for an unusable login lock explains the failure and asks the owner to check the instance directory and permissions. The existing sign-in action also covers rejected refresh tokens. The new detail has two fixed-length sentences and carries no account identifiers or paths.

Fixes: #696

Related: #1150

Restart idle native runtimes when a refreshed account or worker probe observes a new login file. Preserve the credential link across terminal sign-out and share the Codex write lock with isolated homes. Route refresh-token reuse errors to sign-in recovery.

Fixes: #696

Related: #1150
@nixuuu
nixuuu enabled auto-merge (squash) November 23, 2026 15:37
@nixuuu
nixuuu merged commit cdcfa12 into dev Nov 23, 2026
16 checks passed
@nixuuu
nixuuu deleted the fix/codex-authentication-cross-platform branch November 23, 2026 15:57
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.

1 participant