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

Open
0 of 2 issues completed

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.

Sub-issues

Sub-issues

0 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. added
    app
    on Mar 6, 2026
  2. added
    bug
    windows-os
    on Mar 6, 2026
  3. phob commented on Mar 7, 2026

    @phob

    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.

    How did you do that?

  4. mirumirumi commented on Mar 9, 2026

    @mirumirumi

    I agree.
    Opening a local repository in WSL certainly works, but it's ridiculous that I have to duplicate and manage the ~/.codex/* assets I've been using with Codex CLI for this app in C:\Users\my-name\.codex\ (and config.toml currently doesn't support an import feature).

  5. matheuspimentaa commented on Mar 9, 2026

    @matheuspimentaa
    Author

    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.

    How did you do that?

    I don't know, Codex did that for me.

  6. limitless10101 commented on Mar 12, 2026

    @limitless10101

    I’m seeing a closely related Windows 11 + WSL issue that may be part of the same bug family, and it may also connect to #13721, #13764, and #14182.

    Setup:

    • Codex Desktop on Windows 11
    • WSL agent enabled
    • repo stored inside WSL on the Linux filesystem
    • normal Git operations work from WSL terminal

    Symptoms:

    • Codex Desktop shows a very large red Git/review count (roughly -18000 / 126 files)
    • the app is noticeably laggy
    • staging, committing, and pushing still work normally from Git

    What Git actually showed in the same checkout:

    • git rev-parse --show-toplevel matched the expected WSL repo root
    • git branch --show-current matched the active branch
    • git worktree list showed only the current checkout
    • git ls-files --others --exclude-standard | wc -l returned 0
    • git diff --cached --shortstat showed only a small normal change set

    So the large red desktop count did not match actual Git state in the checkout.

    What I verified about the Codex environment:

    • session metadata pointed to the same WSL workspace path
    • shell snapshots showed CODEX_HOME resolving to a Windows-mounted path under /mnt/c/.../.codex
    • WSLENV included CODEX_HOME/p, so CODEX_HOME was being forwarded from Windows into WSL

    What I tried:

    1. Added a conditional ~/.bashrc override so Codex Desktop in WSL would use a Linux-side CODEX_HOME
    2. Verified that fresh interactive shells could see the Linux-side path
    3. Added a local WSL codex wrapper that forced Linux-side CODEX_HOME and removed CODEX_HOME from WSLENV

    Results:

    • these workarounds helped confirm the env propagation problem
    • but Codex Desktop still showed the phantom large red diff count and remained laggy

    Current best diagnosis:

    • there is a real Windows -> WSL CODEX_HOME propagation issue
    • there is also a separate desktop review-state / Git-state problem, because the app’s red count does not match actual Git output in the same checkout
    • the lag may be a related WSL-agent issue rather than repo dirtiness

    This feels like the same broader Windows/WSL app bug cluster as:

  7. matheuspimentaa commented on Mar 13, 2026

    @matheuspimentaa
    Author

    I’m seeing a closely related Windows 11 + WSL issue that may be part of the same bug family, and it may also connect to #13721, #13764, and #14182.

    Setup:

    • Codex Desktop on Windows 11
    • WSL agent enabled
    • repo stored inside WSL on the Linux filesystem
    • normal Git operations work from WSL terminal

    Symptoms:

    • Codex Desktop shows a very large red Git/review count (roughly -18000 / 126 files)
    • the app is noticeably laggy
    • staging, committing, and pushing still work normally from Git

    What Git actually showed in the same checkout:

    • git rev-parse --show-toplevel matched the expected WSL repo root
    • git branch --show-current matched the active branch
    • git worktree list showed only the current checkout
    • git ls-files --others --exclude-standard | wc -l returned 0
    • git diff --cached --shortstat showed only a small normal change set

    So the large red desktop count did not match actual Git state in the checkout.

    What I verified about the Codex environment:

    • session metadata pointed to the same WSL workspace path
    • shell snapshots showed CODEX_HOME resolving to a Windows-mounted path under /mnt/c/.../.codex
    • WSLENV included CODEX_HOME/p, so CODEX_HOME was being forwarded from Windows into WSL

    What I tried:

    1. Added a conditional ~/.bashrc override so Codex Desktop in WSL would use a Linux-side CODEX_HOME
    2. Verified that fresh interactive shells could see the Linux-side path
    3. Added a local WSL codex wrapper that forced Linux-side CODEX_HOME and removed CODEX_HOME from WSLENV

    Results:

    • these workarounds helped confirm the env propagation problem
    • but Codex Desktop still showed the phantom large red diff count and remained laggy

    Current best diagnosis:

    • there is a real Windows -> WSL CODEX_HOME propagation issue
    • there is also a separate desktop review-state / Git-state problem, because the app’s red count does not match actual Git output in the same checkout
    • the lag may be a related WSL-agent issue rather than repo dirtiness

    This feels like the same broader Windows/WSL app bug cluster as:

    Did you figure it out? Are you currently able to use the Codex App in WSL, with the project located in the WSL filesystem, and when you create a worktree, does it get created inside WSL instead of Windows, in the mnt/c/ directory?

  8. richardwhatever commented on Mar 26, 2026

    @richardwhatever

    this is still a problem

  9. brucek2 commented on Apr 2, 2026

    @brucek2

    Just wasted a couple hours on this this morning. Requested fixes:

    1. The windows desktop app should automatically know that if execution environment is WSL, then any created worktrees must be on a WSL filesystem.
    2. It would probably make sense to allow the user to easily configure their desired worktrees root in any event (separate from overall codex home)
    3. I tried working around this with symlinks made from either windows or wsl side, but they both have problems. While many operations correctly traverse the symlink, the desktop app falsely warns the working directory does not exist, probably because it's doing some sort of naive string comparison on cwd.

    One more note on impact, it's not just a performance issue. On my setup it is that the entire repo appears dirty immediately on creation due to the differing permissions implementations between wsl and windows.

    Maybe there's a better workaround I just didn't reach in the two hours I invested, but my current conclusion is the windows desktop is not suitable for wsl use if you want the worktrees feature (which was the whole advantage for me over cli).

  10. Madder commented on Apr 4, 2026

    @Madder

    Guys this is genuinely a blocker for me to move to Codex

  11. richardwhatever commented on Apr 7, 2026

    @richardwhatever

    💯

  12. shurkanTwo commented on Apr 9, 2026

    @shurkanTwo

    Any update on this? I am also waiting to be able to select the CODEX_HOME within WSL2 in the Codex Windows Desktop App.

  13. madhankumar388 commented on Apr 17, 2026

    @madhankumar388

    WSL integration seems to be rushed and buggy, accessing WSL files via windows path is slow, git work trees is broken, opening wsl terminal shows powershell icon, selecting agent environment option disappears randomly . It’s a real blocker , moving back to Claude code and copilot until codex fixes the issues . Vs code is the currently the best for wsl development from widows . Codex app features are very exciting but these issues are a real blocker , hope they fix it soon !

  14. 5 remaining items

  15. constansino commented on May 1, 2026

    @constansino

    I want to keep following this issue

  16. eschulma commented on May 1, 2026

    @eschulma

    I have solved this and a number of related issues by symlinking each repo directory from Windows to WSL, and referring to them by the WSL path only in my config.toml, not UNC. My CODEX_HOME lives on WSL and is also symlinked, that way I can run both the app and the CLI without issues.

  17. Ramxnan commented on May 5, 2026

    @Ramxnan

    @eschulma , can you explain more?
    I tried doing the same but ran into database read error where the codex app on windows just does not like the sqlite locks in the codex_home in wsl

  18. eschulma commented on May 5, 2026

    @eschulma

    @Ramxnan I recommend having your agent help you, I did not have that particular issue. I put some notes on what I did in the Reddit r/codex group a day or two ago. Symlinking was the fundamental idea to fix the Got watcher bug. I want to be able to run both the CLI and the app, it was the simplest way.

  19. akonyer commented on May 9, 2026

    @akonyer

    I am struggling with a similar issue as well, although I can not fully tell if it's working correctly.

    I keep having Windows tell me "Using a performance intensive operation like git on your windows drives will have poor performance. consider moving moving your project files to the linux file system..."

    All of my code is checked out in linux. I am not even sure if I have git installed on the windows side, if I do it's unintentional. So something is misconfigured and not working correctly...

  20. satyalyadav commented on May 11, 2026

    @satyalyadav

    I can confirm this behavior on my setup as well.

    Environment:

    • Codex Desktop: 26.506.3741.0
    • Windows: 10.0.26200.8246
    • WSL: 2.6.3.0
    • Distro: Ubuntu 24.04.4 LTS

    In WSL mode, the running app-server inherited:

    CODEX_HOME=/mnt/c/Users/<user>/.codex

    and the app-server binary was launched from:

    /mnt/c/Users/<user>/.codex/bin/wsl/codex app-server --analytics-default-enabled

    Overriding CODEX_HOME inside WSL for Codex Desktop-launched sessions to:

    /home/<user>/.codex-app

    made startup noticeably better and keeps Codex runtime/worktree-related paths on the WSL ext4 filesystem instead of /mnt/c.

    This matches the expected behavior described in the issue: WSL mode should default runtime/worktree state to a WSL-native location instead of using the Windows-side Codex home.

  21. MisterRound commented on May 15, 2026

    @MisterRound

    Additional current repro/evidence from Windows Desktop + WSL mode after a fresh reboot:

    Environment:

    • Codex Desktop package: OpenAI.Codex_26.506.3741.0_x64__2p2nqsd0c76g0
    • WSL: 2.7.3.0, kernel 6.6.114.1-1, Windows 10.0.26200.8457
    • WSL app-server binary in session: /mnt/c/Users/<user>/.codex/bin/wsl/codex
    • Codex CLI reported by that binary: codex-cli 0.130.0-alpha.5
    • Desktop WSL mode enabled: runCodexInWindowsSubsystemForLinux=true
    • Integrated terminal shell: wsl

    Observed after reboot:

    CODEX_HOME=/mnt/c/Users/<user>/.codex
    cwd=/mnt/c/Users/<user>
    PATH contains /mnt/c/Users/<user>/.codex/tmp/arg0/codex-arg0...
    activeWorkspaceRoots=["C:\\Users\\<user>\\.codex"]
    savedWorkspaceRoots include WSL UNC roots such as \\wsl.localhost\Ubuntu\home\<wsl-user>\...
    

    The app shows the WSL filesystem performance warning on launch even when the actual repos are under /home/<wsl-user>/.... This appears to be because the WSL runtime itself is rooted through the Windows Codex home (/mnt/c/Users/<user>/.codex) before any project-specific work starts.

    I tested the common workaround of forcing Codex Desktop-launched WSL shells to use a WSL-native CODEX_HOME, e.g. /home/<wsl-user>/.codex-app, by guarding on CODEX_INTERNAL_ORIGINATOR_OVERRIDE=Codex Desktop. It does move runtime state toward ext4 and is consistent with the workaround discussed above, but I reverted it because it creates risky split-brain behavior:

    • Windows Desktop UI/settings still operate around C:\Users\<user>\.codex.
    • WSL app-server runtime starts reading/writing /home/<wsl-user>/.codex-app.
    • Auth/config/skills/plugins/session state can drift unless manually synced.
    • Future Desktop updates may assume the Windows-managed Codex home layout and clobber or bypass the WSL-side home.

    So I agree with the requested product fix: WSL mode needs first-class separation of Windows Desktop UI state from WSL-native runtime/worktree/cache state, not a user shell-profile override. At minimum, Desktop should expose an explicit WSL runtime/worktree root setting and show which config/home is authoritative.

  22. dzhygun commented on May 22, 2026

    @dzhygun

    I found a workaround that made WSL mode stable for me on Windows.

    1. Keep a separate Linux-side Codex home, for example:

    /home//.codex-app
    2. In WSL, override CODEX_HOME only when the shell is launched by Codex Desktop. I used this in ~/.profile:

    if [ "${CODEX_INTERNAL_ORIGINATOR_OVERRIDE:-}" = "Codex Desktop" ]; then
    export CODEX_HOME="$HOME/.codex-app"
    fi
    3. If you use zsh, make sure login/non-interactive startup paths also see that:

    1. ~/.zprofile:

    . "$HOME/.profile"
    2. ~/.zshenv can also source shared environment setup if needed.
    3. Create the Linux-side directories up front:

    mkdir -p ~/.codex-app/{sessions,tmp,worktrees}
    5. Copy the basic Codex runtime files from the old WSL ~/.codex into ~/.codex-app:

    1. config.toml

    2. auth.json

    3. AGENTS.md

    4. agents/

    5. skills/

    6. rules/

    7. prompts/

    8. In the Windows app:

      1. Agent environment = WSL
      2. keep Integrated terminal shell = PowerShell

      Using wsl there seemed to make the UNC-path side of this even more fragile.

    9. Verify from WSL:

    env CODEX_INTERNAL_ORIGINATOR_OVERRIDE='Codex Desktop' zsh -c 'echo $CODEX_HOME'
    It should print:

    /home//.codex-app
    After this, worktrees started resolving under the Linux filesystem instead of /mnt/c/..., which fixed the main issue for me.

    One extra note: the desktop app may still have stale cached references to old Windows-side worktree paths. In my case, the CODEX_HOME override fixed new worktrees, but I still had to clean up one old cached path separately.

    So the workaround is real, but I still think the app should handle this automatically in WSL mode instead of propagating the Windows CODEX_HOME into the WSL runtime.

    @timurkhakhalev, thanks!

    You helped me to solve terrible a performance of the Codex App.

    For me it was not just about working trees. It was, that bad, that if you ask a simple question like what is your cwd, - it took 15 seconds, compared to 5 seconds in the Codex VS Code extension.

    I have, however, made some different setup from yours.

    cp -r ~/.codex ~/codex-app && \
    cat <<'EOF' >> ~/.profile
    
    if [ "${CODEX_INTERNAL_ORIGINATOR_OVERRIDE:-}" = "Codex Desktop" ]; then
       export CODEX_HOME="$HOME/.codex-app"
    fi
    EOF
    1. In Codex App Settings set: Agent environment = WSL && Integrated terminal shell = WSL

    2. Restart Codex App and ask via chat: what is your CODEX_HOME?
      3.1) (optional step, because I forgot, if I have done it) If it is not $HOME/.codex-app, but old (windows). Then exit from Codex App & open PowerShell and: wsl --shutdown, then wsl
      3.2.) Try step 2 again.

    Now Codex App is usable in terms of speed - same as VS Code Codex.

  23. eschulma commented on May 22, 2026

    @eschulma

    A big problem with using WSL instead of Windows Native for the desktop runtime, that came up after this issue was created: You lose access to the plugins for Browser and Chrome within the entire app. Those are very high value.

    As a result, I've gone back to Windows Native. I could create the WSL repo project by pasting in the network path directly, and you also need to explain to the app how to interact with it using wsl.exe. I still can't use the browser plugins within that particular project, but at least it's available elsewhere.

  24. Loongphy commented on May 22, 2026

    @Loongphy

    A big problem with using WSL instead of Windows Native for the desktop runtime, that came up after this issue was created: You lose access to the plugins for Browser and Chrome within the entire app. Those are very high value.

    As a result, I've gone back to Windows Native. I could create the WSL repo project by pasting in the network path directly, and you also need to explain to the app how to interact with it using wsl.exe. I still can't use the browser plugins within that particular project, but at least it's available elsewhere.

    No. You can call the relevant software directly by using pwsh.exe

    pwsh.exe -Command "Start-Process 'C:\Program Files\Google\Chrome\Application\chrome.exe'"
    

    OpenAI could definitely support this.

  25. eschulma commented on May 22, 2026

    @eschulma

    A big problem with using WSL instead of Windows Native for the desktop runtime, that came up after this issue was created: You lose access to the plugins for Browser and Chrome within the entire app. Those are very high value.
    As a result, I've gone back to Windows Native. I could create the WSL repo project by pasting in the network path directly, and you also need to explain to the app how to interact with it using wsl.exe. I still can't use the browser plugins within that particular project, but at least it's available elsewhere.

    No. You can call the relevant software directly by using pwsh.exe

    pwsh.exe -Command "Start-Process 'C:\Program Files\Google\Chrome\Application\chrome.exe'"
    

    OpenAI could definitely support this.

    Oh, I can start it, sure. But that's not the same as high-level fast control. A few times I even had the agent install software and modify registry keys to get it working -- only to have it break with the next update.

    Windows is already a second-class citizen for the app. WSL in Windows is even farther down.

  26. naipi11 commented on Aug 18, 2026

    @naipi11

    For WSL-mode users whose worktrees land on /mnt/c: the WSL app-server inherits the Windows CODEX_HOME, so give the WSL runtime its own Linux-side home.

    Method:

    1. Create a Linux-side Codex home, e.g. mkdir -p ~/.codex-app/{sessions,tmp,worktrees}.
    2. Copy the runtime files Codex needs from the old WSL ~/.codex into it (config.toml, auth.json, AGENTS.md, agents/, skills/, rules/, prompts/).
    3. In WSL ~/.profile, override CODEX_HOME only for Desktop-launched shells:
    if [ "${CODEX_INTERNAL_ORIGINATOR_OVERRIDE:-}" = "Codex Desktop" ]; then
      export CODEX_HOME="$HOME/.codex-app"
    fi

    (zsh users should also source ~/.profile from ~/.zprofile so non-interactive logins see it.)
    4. Verify in WSL: env CODEX_INTERNAL_ORIGINATOR_OVERRIDE='Codex Desktop' zsh -c 'echo $CODEX_HOME' prints the Linux path.
    5. Restart the Desktop task; new worktrees then resolve under the WSL filesystem.

    Evidence: a commenter in this thread confirmed this exact guarded override fixed worktree placement (and a second user reports large per-turn latency improvements); reporters confirmed the app-server inherited CODEX_HOME=/mnt/c/Users/<user>/.codex before the change. Note: one-time cleanup of stale Windows-side worktree references may still be needed.

    Independent community workaround; not an official OpenAI fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbugwindows-osworktrees

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions