Component
Codex Desktop for Windows / WSL agent startup / app-server CLI resolution
Version / environment
- Codex Desktop:
26.609.4994.0
- CLI observed in WSL:
codex-cli 0.139.0
- Windows OS build:
10.0.26200
- WSL: Ubuntu, WSL2, running
- WSL has a native Linux Codex CLI available at
/home/<wsl-user>/.local/bin/codex
Summary
Switching the Windows Codex app agent environment from Windows native to WSL should start the agent/app-server inside WSL without requiring a user-defined CODEX_CLI_PATH. Instead, I am seeing two failure modes:
- With
CODEX_CLI_PATH unset, Codex Desktop fails to start in WSL agent mode.
- With
CODEX_CLI_PATH set to a Windows codex.exe, Codex Desktop starts but appears to launch that Windows executable through WSL interop, producing a hybrid Windows session rather than a real WSL agent session.
This seems inconsistent with the Windows app docs, which say the agent can be switched from Windows native to WSL in Settings and then restarted: https://developers.openai.com/codex/windows
Expected behavior
After setting the agent environment to WSL and restarting the Windows app, Codex should start the WSL/Linux agent using either:
- a Linux Codex CLI already available inside WSL, or
- a correctly bundled/relocated Linux binary for WSL mode.
A normal user should not need to set CODEX_CLI_PATH for this mode switch.
Actual behavior
With the WSL agent setting enabled and CODEX_CLI_PATH removed, the app shows:
Codex failed to start.
Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.
The desktop log contains this key line:
bundled_executable_relocation_failed destinationPath=C:\Users\<user>\.codex\bin\wsl\codex ... operation=stat_source ... sourcePath="C:\Program Files\WindowsApps\OpenAI.Codex_26.609.4994.0_x64__2p2nqsd0c76g0\app\resources\codex" ... ENOENT
On disk, the installed Windows app resources contain codex.exe, but not codex:
Test-Path ...\app\resources\codex -> False
Test-Path ...\app\resources\codex.exe -> True
When CODEX_CLI_PATH is restored and points to a Windows executable, WSL mode starts but the WSL process list shows the Windows CLI being launched through interop:
/init /mnt/c/Users/<user>/AppData/Local/Programs/OpenAI/Codex/bin/codex.exe ... app-server --analytics-default-enabled
The resulting session behaves like Windows native rather than WSL:
shell: powershell.exe
$PSVersionTable.PSEdition: Desktop
WSL_DISTRO_NAME: empty
Get-Location: C:\
workspace paths resemble C:\mnt\c\... rather than /mnt/c/...
Reproduction steps
- On Windows, ensure WSL2 Ubuntu is installed/running and has a native Linux
codex available.
- Remove any user/global
CODEX_CLI_PATH environment variable.
- In Codex Desktop settings, set the agent environment to WSL. This writes/uses the WSL agent mode setting (
runCodexInWindowsSubsystemForLinux = true).
- Restart Codex Desktop.
- Observe the startup error above.
- Optionally set
CODEX_CLI_PATH to a Windows codex.exe and restart.
- Observe that the app starts, but the app-server appears to be the Windows executable launched from WSL interop, producing a Windows-native/hybrid session.
Suspected cause
The WSL startup path on Windows appears to assume that the Electron/MSIX resources contain a Linux-style app/resources/codex binary and tries to relocate it to %USERPROFILE%\.codex\bin\wsl\codex. In this install, the resource present is app/resources/codex.exe only. Separately, when CODEX_CLI_PATH points at a Windows executable, WSL mode appears to use it without validating that it is a Linux executable, so WSL interop launches the Windows CLI instead of using the native WSL CLI.
Notes
Component
Codex Desktop for Windows / WSL agent startup / app-server CLI resolution
Version / environment
26.609.4994.0codex-cli 0.139.010.0.26200/home/<wsl-user>/.local/bin/codexSummary
Switching the Windows Codex app agent environment from Windows native to WSL should start the agent/app-server inside WSL without requiring a user-defined
CODEX_CLI_PATH. Instead, I am seeing two failure modes:CODEX_CLI_PATHunset, Codex Desktop fails to start in WSL agent mode.CODEX_CLI_PATHset to a Windowscodex.exe, Codex Desktop starts but appears to launch that Windows executable through WSL interop, producing a hybrid Windows session rather than a real WSL agent session.This seems inconsistent with the Windows app docs, which say the agent can be switched from Windows native to WSL in Settings and then restarted: https://developers.openai.com/codex/windows
Expected behavior
After setting the agent environment to WSL and restarting the Windows app, Codex should start the WSL/Linux agent using either:
A normal user should not need to set
CODEX_CLI_PATHfor this mode switch.Actual behavior
With the WSL agent setting enabled and
CODEX_CLI_PATHremoved, the app shows:The desktop log contains this key line:
On disk, the installed Windows app resources contain
codex.exe, but notcodex:When
CODEX_CLI_PATHis restored and points to a Windows executable, WSL mode starts but the WSL process list shows the Windows CLI being launched through interop:The resulting session behaves like Windows native rather than WSL:
Reproduction steps
codexavailable.CODEX_CLI_PATHenvironment variable.runCodexInWindowsSubsystemForLinux = true).CODEX_CLI_PATHto a Windowscodex.exeand restart.Suspected cause
The WSL startup path on Windows appears to assume that the Electron/MSIX resources contain a Linux-style
app/resources/codexbinary and tries to relocate it to%USERPROFILE%\.codex\bin\wsl\codex. In this install, the resource present isapp/resources/codex.exeonly. Separately, whenCODEX_CLI_PATHpoints at a Windows executable, WSL mode appears to use it without validating that it is a Linux executable, so WSL interop launches the Windows CLI instead of using the native WSL CLI.Notes
CODEX_CLI_PATHdoes not appear to be listed as a normal stable public environment setting in https://developers.openai.com/codex/environment-variables