Skip to content

fix(codex): migrate windows login hard links - #1150

Merged
nixuuu merged 1 commit into
devfrom
fix/windows-auth-hardlink-issue
Nov 23, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/windows-auth-hardlink-issue

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 23, 2026

Copy link
Copy Markdown
Member

Fixes: #732

Codex CLI 0.171.0 rejects atomic credential replacement when auth.json has another hard link. If the source was already replaced, worker and bot homes can still hold the old file.

  • Remove the hard-link fallback and detach verified legacy aliases, including inactive bot conversations and configured instance homes.
  • Preserve detached files under a backup name in managed homes. Existing bot conversations resume with the current login.
  • Show a Windows Developer Mode hint when Canopy cannot create the symbolic link.

Verification

  • Linux: 26 focused worker tests passed, including an existing bot conversation with a hard link to the same old file as the thread's backup.
  • Linux: Codex CLI 0.171.0 reproduced the hard-link write error and saved through a symbolic link using synthetic credentials.
  • Worker typecheck, edited-file lint and formatting, and git diff --check passed.
  • The native Windows CI job now runs the two migration test files. A real ChatGPT account and Windows desktop session are outside the local verification.

Copy audit

The existing account error now explains that Canopy could not use the device login and names Windows Developer Mode as the action. The detail uses two sentence-case sentences, contains no account data, and conveys the action in text.

@nixuuu
nixuuu marked this pull request as ready for review November 23, 2026 10:27
@nixuuu
nixuuu merged commit 163a47c into dev Nov 23, 2026
16 checks passed
@nixuuu
nixuuu deleted the fix/windows-auth-hardlink-issue branch November 23, 2026 10:27
nixuuu added a commit that referenced this pull request Nov 23, 2026
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
nixuuu added a commit that referenced this pull request Nov 23, 2026
## Change

The built-in `codex/native` instance now uses the device’s existing
Codex CLI home by default on Windows, macOS and Linux. Upgrading the
worker is enough for existing device-login setups with no saved home
selection. Users can retry a failed turn in the same ordinary thread.
This fixes the case where Windows denies the file links previously
required to use the terminal login.

Codex reads the selected CLI store and refreshes its own credentials.
The thread process also uses the CLI configuration, including
instructions, MCP servers and hooks. An explicit **Isolated** choice in
the definition or worker override is respected. Additional Codex
instances default to **Isolated** and can select **Use CLI home**. Own
login, proxy connections and disabled device login use the private home.

The worker resolves the default when applying existing configuration.
Older workers keep their original default and require an update for
explicit **Use CLI home**. Web, desktop and mobile display the default
and preserve an implicit choice when saving unrelated settings.

The private Canopy SQLite index keeps ordinary threads resumable with
their original history. New direct sessions are bound to their CLI home.
Existing imported copies require **Isolated** for native continuation.
With **Use CLI home**, new imports keep their timeline and can continue
in a new thread. Bots and automatic titles use isolated environments and
still require file links for CLI-based authentication.

## Verification

- Reproduced an existing thread blocked by a conflicting private login
lock across a real gateway and worker with a synthetic CLI. Replacing
the worker with the same stored configuration version and no home
selection let the thread complete a turn using the terminal login.
Selecting **Isolated** reproduced the original link conflict.
- Covered implicit profiles, legacy multi-provider configurations,
simulated keyring status, explicit isolation, own login, proxy, disabled
device login and imports. Native CI now exercises the default on Windows
and macOS.
- Exercised Codex 0.164.0 and 0.171.0 on Linux against local model
fixtures, including archived private history and unload. The pinned
0.164.0 passed the connection-switch cases. On 0.171.0 a separate
connection-switch test also fails on the unchanged base revision when
the CLI rejects changing the model provider on resume.
- Checked settings persistence, inheritance, linked-computer sync and
worker delivery. Regenerated contract comments. Scoped lint and gateway,
worker, web and mobile type checks passed during implementation.
- Checked defaults, persistence and overrides in Chromium at wide and
narrow widths. Checked selection and inheritance on an Android emulator.
Real Windows or macOS account login and a full save from a paired phone
were not exercised locally.

## Copy audit

The instance selector describes the CLI settings and new session files
affected. Its isolated option identifies the home used by imported
copies. Login-link errors identify the failed operation and give the
user a next step. Checked labels, wrapping, inheritance and status cues
against the copy checklist.

Fixes: #1150
nixuuu added a commit that referenced this pull request Nov 24, 2026
Acquire the selected profile's login through local app-server RPC. Bind renewal to the admitted user and workspace and require matching credential destinations before using the isolated process's ephemeral store.

Fixes: #1150
nixuuu added a commit that referenced this pull request Nov 24, 2026
Authenticate isolated Codex bots with the selected local profile and preserve session history on Windows.

Fixes: #1150
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