Windows Codex Desktop + WSL2 workspace: default command/exec fails with os error 2 even though WSL, repo, and bubblewrap are healthy

Open 💬 2 comments Opened May 31, 2026 by cascaasgbrg

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

26.521.10419

What subscription do you have?

execution error: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

Summary:
In a Windows Codex Desktop + WSL2 workspace, the repository exists and can be read from the Codex thread, but many default command/exec calls fail before the requested command starts with:

What steps can reproduce the bug?

Summary:
In a Windows Codex Desktop + WSL2 workspace, the repository exists and can be read from the Codex thread, but many default command/exec calls fail before the requested command starts with:

execution error: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })

The issue is not caused by the repository path, missing basic Linux commands, or missing bubblewrap. WSL itself can run the same commands successfully.

Observed behavior inside a new Codex thread:

pwd succeeds and returns: /home/kyj/code/AI-Usage-Observer
echo "$WSL_DISTRO_NAME" succeeds in one test and returns Ubuntu, but many other basic commands fail.
AGENTS.md can be read successfully with sed.
git status can succeed.
These commands fail with os error 2:
command -v codex || true
which -a codex || true
codex --version || true
echo hello
printenv WSL_DISTRO_NAME
ls -ld .
touch .codex-temp-access-check.txt
printf "modified\n" > .codex-temp-access-check.txt
rm .codex-temp-access-check.txt
plugin/MCP install requests do not occur.

WSL-side diagnostics:

WSL itself works.
Basic Linux commands are present:
/usr/bin/sh
/usr/bin/bash
/usr/bin/echo
/usr/bin/printenv
/usr/bin/touch
/usr/bin/ls
/usr/bin/cat
/usr/bin/sed
/usr/bin/git
/usr/bin/python3
/usr/bin/rm
/usr/bin/test
Running these commands directly through WSL succeeds:
echo hello
printenv WSL_DISTRO_NAME
touch /tmp/codex-wsl-basic-test.txt
cat /tmp/codex-wsl-basic-test.txt
rm /tmp/codex-wsl-basic-test.txt
Result: BASIC_WSL_COMMANDS_OK

Bubblewrap diagnostics:

/usr/bin/bwrap exists.
/bin/bwrap exists.
bubblewrap version: 0.9.0
package: bubblewrap 0.9.0-1ubuntu0.1
bwrap smoke test succeeds:
BWRAP_SMOKE_OK

Codex binary diagnostic from WSL:

command -v codex resolves to:
/mnt/c/Users/kyj/AppData/Roaming/npm/codex
which -a codex shows:
/mnt/c/Users/kyj/AppData/Roaming/npm/codex
Running codex fails with:
Error: Missing optional dependency @openai/codex-linux-x64. Reinstall Codex: npm install -g @openai/codex@latest
Node.js version in that path: v18.19.1
This indicates WSL is picking up a Windows npm Codex shim rather than a Linux-native Codex binary.

Codex state / arg0 diagnostics:

C:\Users\kyj.codex.codex-global-state.json was quarantined during cleanroom reset and is currently missing.
C:\Users\kyj.codex-win-clean.codex-global-state.json exists.
active-workspace-roots:
\wsl$\Ubuntu\home\kyj\code\AI-Usage-Observer
electron-saved-workspace-roots:
\wsl$\Ubuntu\home\kyj\code\AI-Usage-Observer
\wsl.localhost\Ubuntu\home\kyj\code\AI-Usage-Observer
project-order:
\wsl.localhost\Ubuntu\home\kyj\code\AI-Usage-Observer
heartbeat-thread-permissions still contained stale writableRoots such as:
/home/kyj/code/AI Usage Observer
/home/kyj/code/VRF Scheduler
/mnt/c/Users/kyj/Documents/Codex
/mnt/c/Users/kyj/.codex-win-clean/memories
C:\Users\kyj.codex-win-clean\tmp\arg0 was regenerated after quarantine.
The regenerated arg0 tree contains only Windows .bat helpers:
applypatch.bat
apply_patch.bat
Expected WSL/Linux helper entries such as codex-linux-sandbox, codex-execve-wrapper, apply_patch, and applypatch were not visible in the regenerated arg0 listing.

Steps already attempted:

Verified the WSL repository exists and AGENTS.md is readable.
Renamed the project path to remove spaces: /home/kyj/code/AI-Usage-Observer.
Quarantined .codex-global-state.json and tmp/arg0 in both:
C:\Users\kyj.codex
C:\Users\kyj.codex-win-clean
Reopened Codex Desktop and recreated the WSL project entry.
Verified that WSL itself can run basic commands.
Verified bubblewrap is installed and smoke test succeeds.
Verified plugin/MCP install prompts are not involved.
Verified the failure persists in a newly opened Codex thread.

Expected behavior:
In a WSL-backed Codex Desktop workspace, default command/exec should invoke commands inside WSL and basic commands such as echo, printenv, ls, touch, rm, command -v, and which should run successfully. If a cached helper path is stale or incompatible, Codex should rehydrate/rebind the WSL helper runtime instead of failing with os error 2.

Actual behavior:
Default command/exec intermittently or consistently fails before command execution with os error 2, while WSL itself and the repository are healthy. Some commands such as pwd, sed, and git status can succeed, while many basic commands fail.

Impact:
The Codex Desktop app is unreliable for WSL2 project work. File reading sometimes works, but basic shell operations, temporary file writes/deletes, and command discovery fail. The only reliable workaround is using approved WSL shell execution or switching to a WSL-native Codex CLI with a separate CODEX_HOME.

What is the expected behavior?

Please investigate Windows Codex Desktop + WSL2 command/exec runtime rehydration, especially:

stale or cross-runtime tmp/arg0 helper handling;
Windows .bat helper generation in a WSL workspace;
WSL app-server binding to the correct Linux helper runtime;
avoiding Windows npm Codex shims inside WSL;
automatic recovery when the cached helper path returns ENOENT.

Additional information

codex_arg0_diag.txt
codex_bubblewrap_diag.txt
Codex_Cleanroom_Manifest_20260531-134346.txt
codex_os_error2_wsl_diag.txt
codex_state_summary_20260531-140414.txt
codex_wsl_binary_diag.txt

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗