Windows desktop in WSL mode uses the Windows CODEX_HOME inside WSL and creates/stores worktrees on /mnt/c instead of the WSL filesystem
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:
- Worktrees are created on the Windows-mounted filesystem instead of native WSL storage, which makes Git operations much slower.
- 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 availableSqliteError: database is lockedfailed to read CODEX_HOME ... os error 161when trying to move the entire desktopCODEX_HOMEto a WSL UNC path
What steps can reproduce the bug?
- Install Codex Desktop from the Microsoft Store on Windows.
- Enable WSL mode and select an Ubuntu distro.
- Keep the repository inside WSL, for example
/home/<user>/Development/Monest/monest-prompts. - Open that repository in Codex Desktop.
- Use a Git feature that relies on worktrees, such as creating a worktree or selecting a Codex-managed branch/worktree.
- Observe that the worktree path is resolved under
/mnt/c/Users/<user>/.codex/worktrees/...instead of a WSL-native path. - 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_HOMEinside WSL only for Codex Desktop, using a conditional export in~/.profilekeyed onCODEX_INTERNAL_ORIGINATOR_OVERRIDE=Codex Desktop. - After that, the WSL app-server used
/home/matheuspimenta/.codex-appand 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_HOMEinto 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.
27 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
How did you do that?
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 inC:\Users\my-name\.codex\(and config.toml currently doesn't support an import feature).I don't know, Codex did that for me.
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:
Symptoms:
-18000 / 126 files)What Git actually showed in the same checkout:
git rev-parse --show-toplevelmatched the expected WSL repo rootgit branch --show-currentmatched the active branchgit worktree listshowed only the current checkoutgit ls-files --others --exclude-standard | wc -lreturned0git diff --cached --shortstatshowed only a small normal change setSo the large red desktop count did not match actual Git state in the checkout.
What I verified about the Codex environment:
CODEX_HOMEresolving to a Windows-mounted path under/mnt/c/.../.codexWSLENVincludedCODEX_HOME/p, soCODEX_HOMEwas being forwarded from Windows into WSLWhat I tried:
~/.bashrcoverride so Codex Desktop in WSL would use a Linux-sideCODEX_HOMEcodexwrapper that forced Linux-sideCODEX_HOMEand removedCODEX_HOMEfromWSLENVResults:
Current best diagnosis:
CODEX_HOMEpropagation issueThis 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?this is still a problem
Just wasted a couple hours on this this morning. Requested fixes:
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).
Guys this is genuinely a blocker for me to move to Codex
💯
Any update on this? I am also waiting to be able to select the CODEX_HOME within WSL2 in the Codex Windows Desktop App.
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 !
I can confirm a very similar problem on Windows + Codex Desktop + WSL.
Environment
/mnt/c/Users/redde/.codex/mnt/c/Users/redde/.codex/sessionsError
Codex Desktop fails to create a thread with:
What I checked
takeownandicaclswere applied on Windows side toC:\Users\redde\.codexExample:
Output:
So the directory is writable from WSL despite Codex Desktop reporting
permission denied.Mount info
/mnt/cis mounted as:Why this seems related to this issue
CODEX_HOMEinto WSL/mnt/c/Users/<user>/.codexsudo chownis misleading on/mnt/c/..., and in my case it does not address the problem at allLikely implication
This looks like another case where Windows-side
CODEX_HOMEinside WSL is causing incorrect state/session handling, even when the underlying path is writable.Useful direction
A Linux-native
CODEX_HOMEfor WSL mode seems like the right model here as well, for example using a WSL-local path instead of/mnt/c/Users/<user>/.codex.I found a workaround that made WSL mode stable for me on Windows.
CODEX_HOMEonly when the shell is launched by Codex Desktop. I used this in~/.profile:zsh, make sure login/non-interactive startup paths also see that:~/.zprofile:~/.zshenvcan also source shared environment setup if needed.~/.codexinto~/.codex-app:config.tomlauth.jsonAGENTS.mdagents/skills/rules/prompts/Agent environment = WSLIntegrated terminal shell = PowerShellUsing
wslthere seemed to make the UNC-path side of this even more fragile.It should print:
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_HOMEoverride 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_HOMEinto the WSL runtime.I’m surprised this hasn’t been fixed yet. WSL support is one of the few areas where Codex still feels significantly unreliable.
Codex has otherwise been very stable for me, even with the fast pace of new features, which is why this stands out. But the current
CODEX_HOME//mnt/cworktree behavior makes WSL feel only partially supported rather than a first-class environment.A WSL-native default for worktrees/state, or a clearer separation between Windows desktop state and WSL runtime state, would make a big difference.
We need a native development experience similar to VS Code WSL Remote. All project file access should go through the native filesystem, while communication with the Windows Electron GUI happens over TCP.
I want to keep following this issue
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.@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
@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.
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...
I can confirm this behavior on my setup as well.
Environment:
In WSL mode, the running app-server inherited:
CODEX_HOME=/mnt/c/Users/<user>/.codexand the app-server binary was launched from:
/mnt/c/Users/<user>/.codex/bin/wsl/codex app-server --analytics-default-enabledOverriding CODEX_HOME inside WSL for Codex Desktop-launched sessions to:
/home/<user>/.codex-appmade 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.
Additional current repro/evidence from Windows Desktop + WSL mode after a fresh reboot:
Environment:
OpenAI.Codex_26.506.3741.0_x64__2p2nqsd0c76g02.7.3.0, kernel6.6.114.1-1, Windows10.0.26200.8457/mnt/c/Users/<user>/.codex/bin/wsl/codexcodex-cli 0.130.0-alpha.5runCodexInWindowsSubsystemForLinux=truewslObserved after reboot:
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 onCODEX_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:C:\Users\<user>\.codex./home/<wsl-user>/.codex-app.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.
@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.
1)
2) In Codex App Settings set:
Agent environment = WSL&&Integrated terminal shell = WSL3) 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, thenwsl3.2.) Try step 2 again.
Now Codex App is usable in terms of speed - same as VS Code Codex.
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
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.