Skip to content

Windows desktop in WSL mode uses the Windows CODEX_HOME inside WSL and creates/stores worktrees on /mnt/c instead of the WSL filesystem #13762

Description

@matheuspimentaa

What version of the Codex App are you using (From “About Codex” dialog)?

23.35.950

What subscription do you have?

Plus

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What issue are you seeing?

When Codex Desktop is installed on Windows and WSL mode is enabled, the WSL app-server inherits the Windows CODEX_HOME (C:\Users\<user>\.codex) instead of using a WSL-native home directory.

As a result, worktrees are resolved under /mnt/c/Users/<user>/.codex/worktrees/... even when the repository itself lives entirely inside WSL, for example under /home/<user>/Development/....

This causes two classes of problems:

  1. Worktrees are created on the Windows-mounted filesystem instead of native WSL storage, which makes Git operations much slower.
  2. The desktop app can keep stale references to Windows-side worktree paths even after the real worktree exists in WSL, which breaks branch/worktree/Git features intermittently.

During debugging I also saw related failures such as:

  • WSL mode is enabled but no eligible distro is available
  • SqliteError: database is locked
  • failed to read CODEX_HOME ... os error 161 when trying to move the entire desktop CODEX_HOME to a WSL UNC path

What steps can reproduce the bug?

  1. Install Codex Desktop from the Microsoft Store on Windows.
  2. Enable WSL mode and select an Ubuntu distro.
  3. Keep the repository inside WSL, for example /home/<user>/Development/Monest/monest-prompts.
  4. Open that repository in Codex Desktop.
  5. Use a Git feature that relies on worktrees, such as creating a worktree or selecting a Codex-managed branch/worktree.
  6. Observe that the worktree path is resolved under /mnt/c/Users/<user>/.codex/worktrees/... instead of a WSL-native path.
  7. In some cases, after restarting the app or moving state around, Git features start failing and the UI may still try to access the old Windows path even though the actual worktree is already in WSL.

What is the expected behavior?

When WSL mode is enabled, the WSL app-server should use a WSL-native Codex home/worktree root by default, separate from the Windows desktop app state.

Expected behavior:

  • Worktrees should be created on the Linux filesystem, not under /mnt/c/..., when the repo is inside WSL.
  • The app should not keep stale references to previous Windows-side worktree paths.
  • Windows desktop state (for example SQLite/UI state) and WSL worktree storage should be handled separately so that fixing worktree location does not require moving the entire desktop database into WSL.

Additional information

Relevant paths from my machine:

  • Repository root: /home/matheuspimenta/Development/Monest/monest-prompts
  • Legacy Windows-side worktree path that the app still referenced: /mnt/c/Users/matheus.pimenta/.codex/worktrees/a923/monest-prompts
  • Actual WSL worktree path that worked correctly: /home/matheuspimenta/.codex-app/worktrees/a923/monest-prompts

What I found while debugging:

  • The desktop WSL app-server was launched with CODEX_HOME=/mnt/c/Users/matheus.pimenta/.codex.
  • The reliable workaround was to override CODEX_HOME inside WSL only for Codex Desktop, using a conditional export in ~/.profile keyed on CODEX_INTERNAL_ORIGINATOR_OVERRIDE=Codex Desktop.
  • After that, the WSL app-server used /home/matheuspimenta/.codex-app and worktrees resolved correctly on the Linux filesystem.
  • I still needed a compatibility symlink for an old path because the desktop app had cached/referenced /mnt/c/Users/matheus.pimenta/.codex/worktrees/a923/monest-prompts.

This looks like the root issue:

  • In WSL mode, the desktop app should not blindly propagate the Windows CODEX_HOME into the WSL runtime.
  • The WSL runtime should choose a Linux-native default for worktrees and internal state, or at least split WSL worktree storage from Windows desktop state explicitly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appbugSomething isn't workingwindows-osIssues related to Codex on Windows systemsworktreesIssues related to worktree management

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions