Skip to content

[Windows][WSL2] Desktop tools fail to spawn processes despite a working WSL environment and standalone Codex CLI #49777

Open

Description

@15969652028

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

26.928.21956

What subscription do you have?

sub Pro5.x

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

Summary
The Codex desktop app cannot execute even basic read-only commands when the Agent environment is set to WSL.
Every attempt fails during process creation, before the command runs:
exec_command failed: CreateProcess { message: "Rejected("Failed to create unified exec process: No such file or directory (os error 2)")" }
The same commands work when invoked directly through WSL from PowerShell. The standalone Codex CLI also works after repairing a separate npm installation issue.
Restarting the desktop app and creating a new chat in the same project did not resolve the desktop failure.

What steps can reproduce the bug?

# [Windows][WSL2] Desktop execution tools fail to create processes while direct WSL commands and standalone Codex CLI work

## Summary

The Codex desktop app cannot execute basic read-only commands with **Agent environment set to WSL**.

Every execution attempt fails during process creation, before the command runs:

```text
exec_command failed: CreateProcess { message: "Rejected(\"Failed to create unified exec process: No such file or directory (os error 2)\")" }
```

Direct WSL commands launched from PowerShell work. The standalone Codex CLI also successfully executes read-only commands.

Fully restarting the desktop app and creating a new chat in the same project did not resolve the issue.

Personal and project-specific paths below have been replaced with placeholders.

## Environment

| Component | Version / configuration |
|---|---|
| Desktop Windows package | `OpenAI.Codex` |
| Package version reported by `Get-AppxPackage` | `26.928.2636.0` |
| Desktop update tool: `installedVersion` | `26.928.21956` |
| Desktop update tool: `installedBuildVersion` | `12404` |
| Desktop update tool: `installedReleaseChannel` | `prod` |
| Desktop update tool: status | `up_to_date` |
| Agent environment | WSL |
| Default WSL distribution | Ubuntu, running under WSL 2 |
| WSL version | `2.7.14.0` |
| Linux kernel | `6.18.33.2-2` |
| Windows version reported by WSL | `10.0.26200.9457` |
| Standalone Codex CLI | `0.159.3` |
| Node.js used by standalone CLI | `18.19.1` |
| npm used by standalone CLI | `9.2.0` |
| Project storage | Ubuntu Linux filesystem, under `/home/<user>/projects/<project>` |

The desktop version values come from different interfaces. I am reporting both without assuming that the difference indicates a fault.

## Steps to reproduce

1. Open an existing project stored in the Ubuntu Linux filesystem.
2. Set the desktop app’s **Agent environment** to **WSL**.
3. Fully exit and restart the desktop app.
4. Ask the desktop agent to execute:

   ```bash
   pwd
   id
   ```

5. Also ask it to read a known existing file in the project.
6. Observe that all attempts fail during process creation.
7. Create a new chat in the same project and repeat the checks.
8. Observe the same failure.

## Expected behavior

The desktop agent should start a process in the selected WSL environment and execute the read-only commands.

If a required executable, helper, or working directory cannot be resolved, the diagnostic should identify the missing component or path.

## Actual behavior

Each attempt fails with:

```text
exec_command failed: CreateProcess { message: "Rejected(\"Failed to create unified exec process: No such file or directory (os error 2)\")" }
```

No command output is produced.

The following variations were tested and failed:

- Explicit `/bin/bash`.
- Explicit `/bin/sh`.
- Default shell configuration.
- Project working directory.
- `/tmp` working directory.
- Existing chat.
- Newly created chat after restarting the desktop app.

The working directory passed to the tool is only an input parameter. It was not verified by a successful `pwd` inside the desktop execution tool.

## Additional tool error

The Node REPL tool also fails before reading a file:

```text
Mcp error: -32602: js: codex/sandbox-state-meta:
sandboxCwd is not a local file URI:
file:///home/<user>/projects/<project>
```

The path above is redacted.

I do not know whether this shares a root cause with the execution failure, but it may be relevant to Windows/WSL path handling.

## Successful checks outside the desktop tools

Direct execution through PowerShell works:

```powershell
wsl -d Ubuntu -- /bin/bash -lc 'whoami'
```

Additional direct WSL checks confirmed that:

- The project directory exists.
- The tested file exists.
- The directory and file are owned by the expected Linux user.
- The file permissions allow reading.

The standalone Codex CLI `0.159.3` also successfully:

- Read the project’s instruction file.
- Executed `pwd`.
- Executed `id`.

**The desktop execution tools still fail despite these successful checks.**

## Separate CLI installation issue — resolved

During diagnosis, the standalone npm-installed CLI initially reported:

```text
Missing optional dependency @openai/codex-linux-x64
```

The declared dependency was:

```json
{
  "@openai/codex-linux-x64": "npm:@openai/[email protected]"
}
```

An installation attempt using the existing npm registry configuration returned `ETARGET`. An explicit query to the npm public registry confirmed that the platform version exists.

After repairing the installation using the public registry, the standalone CLI became functional.

**This did not fix the desktop failure.** I am not assuming that the desktop app uses the separately installed CLI.

## Additional observation

Direct WSL startup reports a warning that a localhost proxy configuration was detected but was not mirrored into WSL in NAT mode.

Local commands still execute successfully despite this warning. There is no confirmed evidence that it causes the desktop process-creation failure.

## Impact

The desktop agent cannot read project files, edit files, or run validation commands.

The standalone CLI is usable, but the desktop execution tools remain unavailable.

## Diagnostic assistance requested

Could you advise:

1. Which executable or helper might be failing to start?
2. Whether the `sandboxCwd` URI error is related to Windows/WSL path mapping?
3. Which targeted, sanitized diagnostics would help investigate this without deleting configuration, authentication data, or session history?

No sandbox bypass, project permission changes, or configuration-directory deletion has been used as a workaround.

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    app
    on Oct 1, 2026
  2. added
    bug
    windows-os
    tool-calls
    on Oct 1, 2026
  3. 15969652028 commented on Oct 1, 2026

    @15969652028
    Author

    Additional diagnostic evidence

    A read-only pwd test with TTY enabled produced a more specific error:

    Failed to create unified exec process:
    Unable to spawn
    /mnt/c/Users/<user>/.codex/tmp/arg0/codex-arg0<id>/codex-linux-sandbox
    because it doesn't exist on the filesystem
    (ENOENT: No such file or directory)
    

    Test parameters:

    • Command: pwd
    • Shell: /bin/bash
    • Working directory: /tmp
    • Login shell: disabled
    • TTY: enabled
    • No sandbox escalation or configuration changes

    This identifies an unavailable sandbox-helper path and closely matches
    the observations in #49731 and #49365.

    I have not verified whether the directory was deleted, a symlink target
    became unavailable, or which process caused the condition.

    The separate Node REPL sandboxCwd URI error remains unresolved;
    a shared root cause has not been established.

    Please consolidate this report with the appropriate tracking issue if
    these observations confirm a duplicate.

  4. 15969652028 commented on Oct 1, 2026

    @15969652028
    Author

    WSL2 desktop sandbox fails with ENOENT while the backend still holds a lock in an inaccessible arg0 directory

    Summary

    Sandboxed desktop commands fail before executing even a minimal pwd. The running backend still has an open file descriptor whose symlink points into an arg0 launcher directory that is no longer accessible. A bounded attempt to recreate that directory failed with File exists, although both WSL and Windows report that the directory does not exist.

    This is a new symptom after the previous /mnt/wslg/distro mount issue was worked around by disabling WSLg. That mount is currently absent.

    Environment

    • Windows desktop Codex using a WSL2 Linux backend.
    • Backend version previously verified as codex-cli 0.159.2.
    • Current executable: /mnt/c/Users/<windows-user>/.codex/bin/wsl/65bf23c0b8844a0d/codex.
    • Executable SHA-256: 1748767b230ebfc3d4ab7e4e254920d0c0ad9691fd8c11f190e7d44511a4a92e.
    • Backend CODEX_HOME: /mnt/c/Users/<windows-user>/.codex.
    • Backend CODEX_SQLITE_HOME: /home/<linux-user>/.codex/sqlite.
    • The Windows drive is exposed to WSL through a 9p/DrvFS mount.
    • Previously verified bubblewrap version: 0.9.0.
    • Observed on 2026-10-01, approximately 05:12–05:14 UTC.

    Observed behavior

    Ordinary desktop command:

    command: pwd
    shell: /usr/bin/bash
    login: false
    working directory: /home/<linux-user>/projects/openaster
    

    Result:

    Failed to create unified exec process: No such file or directory (os error 2)
    

    The same shell and working directory work with escalated read-only execution. Bash, the backend executable, and the working directory exist. Ordinary commands had briefly worked after a desktop restart before this failure returned.

    Launcher-directory evidence

    The current backend PID was 250437. Reading /proc/250437/fd/3 returned:

    /mnt/c/Users/<windows-user>/.codex/tmp/arg0/codex-arg0COmvdm/.lock
    

    However:

    • WSL ls -ld reports that the corresponding directory does not exist.
    • Enumerating its parent does not list that directory.
    • Its codex-linux-sandbox helper is inaccessible.
    • Windows [System.IO.Directory]::Exists(...) returns False.
    • Windows Get-Item -LiteralPath ... -Force returns ItemNotFoundException.

    Other Codex processes using /home/<linux-user>/.codex/tmp/arg0 still had accessible sandbox helpers at the time of inspection. This is only a comparison, not proof that the storage location caused the failure.

    Bounded recovery attempt

    With explicit user authorization, we rechecked the running executable and open-lock path, confirmed that the target was neither visible nor a visible symlink, and attempted a single mkdir for the missing directory. The intended next step was to restore only codex-linux-sandbox as a symlink to the exact running executable.

    The directory creation failed:

    mkdir: cannot create directory '.../codex-arg0COmvdm': File exists
    

    Because the script used set -eu, the symlink creation did not run. No lock was created or replaced. A subsequent ordinary sandbox pwd still failed with ENOENT. Further repair attempts were stopped.

    Expected behavior and questions

    Launcher directories needed by a running backend should remain usable, or the backend should safely recover/recreate its helpers and report the missing path explicitly.

    Could you investigate:

    1. Whether arg0 cleanup can remove or invalidate a directory still referenced by a live backend, especially when CODEX_HOME is on a Windows-mounted filesystem.
    2. How active locks are checked across Windows/WSL processes, and whether another Codex invocation can affect those directories.
    3. The inaccessible-but-EEXIST directory behavior, and whether it could represent pending deletion or a mount/filesystem interaction.
    4. Whether an official fix or supported configuration avoids this failure without disabling the sandbox.

    We have not identified the deleting process or proven any of these proposed causes. The recovery experiment did not reach symlink restoration, so it does not prove that restoring the helper would resolve the error. No authentication files, raw environment dump, customer data, or full session transcript are included.

  5. anhbtn269-pixel commented on Oct 14, 2026

    @anhbtn269-pixel

    I can reproduce this on Windows + WSL Ubuntu.

    Codex Desktop fails before any command starts:
    Failed to create unified exec process: No such file or directory (os error 2)

    Repro:

    1. Agent environment: Windows Subsystem for Linux / Ubuntu
    2. Create a new Codex chat
    3. Ask it to run: command -v bash
    4. The same error occurs.

    What I verified:

    • Commands work in Ubuntu terminal directly.
    • lark-cli authentication is healthy (bot and user are ready).
    • Restarting ChatGPT/Codex, running wsl --shutdown, and selecting WSL again did not resolve it.
    • The failure also occurs for simple commands, so it is unrelated to Feishu or MCP.

    Codex Desktop version: [Settings → About]
    Windows version: [Windows Settings → System → About]
    WSL distro/version: Ubuntu / [output of wsl -l -v]

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

    appbugtool-callswindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions