Codex Security 0.1.14 Deep Scan fails with spawn EPERM on Windows when CODEX_CLI_PATH is unset
Summary
Codex Security 0.1.14 Deep Scans fail before discovery on Windows when CODEX_CLI_PATH is unset and PATH resolves codex to the extensionless npm shim.
The Deep Scan worker ultimately calls Node's child_process.spawn with the literal command codex. On this PATH layout, Windows selects %APPDATA%\npm\codex (the extensionless npm shim) and Node returns EPERM. The plugin should resolve a Windows-executable launcher (codex.cmd / codex.exe) or use the Codex executable bundled with the desktop app.
Environment
- Windows 10.0.26200.8894, x64
- ChatGPT desktop app 26.721.4979.0
- Codex Security plugin 0.1.14 (hosted catalog)
- Codex CLI: reproduced with 0.145.0; the minimal launcher reproduction remains on 0.146.0
- Node.js v24.15.0
- PowerShell 5.1.26100.8894
- Codex CLI installed globally through npm
CODEX_CLI_PATHunset
Steps to reproduce
- On Windows, install Codex CLI globally through npm so
%APPDATA%\npmis onPATHand contains the extensionlesscodexshim. - Leave
CODEX_CLI_PATHunset. - In the ChatGPT desktop app with Codex Security 0.1.14, start a Deep Security Scan on a local Git repository.
- Complete setup and allow the preflight to pass.
- Wait for discovery workers to launch.
Actual behavior
Deep discovery terminates immediately with spawn EPERM. No worker completes and no candidates are produced. Sanitized coordinator result:
{
"status": "failed",
"discoveryCount": 0,
"failure": {
"phase": "discovery",
"message": "spawn EPERM",
"kind": "Error:EPERM"
}
}
The standalone launcher behavior is reproducible:
node -e "const {spawn}=require('child_process'); spawn('codex',['--version'])"
# Error: spawn EPERM
Spawning the direct npm-installed codex.exe from Node succeeds and prints codex-cli 0.146.0.
Expected behavior
Deep Scan should resolve and launch a valid Windows Codex executable without requiring users to configure CODEX_CLI_PATH manually.
Workaround
Set CODEX_CLI_PATH to the direct npm-installed codex.exe and restart the desktop app.
Suggested fix
On Windows, avoid passing the bare literal codex to child_process.spawn when the extensionless npm shim may win PATH resolution. Resolve codex.cmd / codex.exe, use the SDK's platform binary resolver, or pass the desktop-bundled executable path to the plugin MCP process.
2 Comments
I can reproduce this on a newer build, with an important variation:
CODEX_CLI_PATHis configured in the thread shell environment and points to a working direct npm-installed binary, but the Codex Security MCP Deep Scan worker still fails withspawn EPERM.Environment
Deep Scan result
Capability preflight completed successfully and deterministic setup completed. Discovery then failed before any worker produced output:
The failed discovery execution reached attempt 4. The scan was then terminal and could not be resumed.
Binary-resolution checks
In the same Codex thread shell:
Spawning the packaged executable used by the desktop app reproduces the Deep Scan error:
Both unpacked per-user executables work:
This suggests the Deep Scan MCP process is not inheriting the thread's configured
CODEX_CLI_PATH, or it is receiving/resolving a different value that points to the protected WindowsApps package. The failure appears specific to the MCP/SDK worker launch boundary rather than repository code or general Node child-process creation.Related WindowsApps executable-resolution reports: #20048 and #19271.
I can reproduce this again on a newer Codex Security version, after this issue was closed as completed.
Environment
0.147.0-alpha.6.60.1.19Reproduction
Codex Security Deep Scan failed before source discovery with:
spawn EPERMDiagnostics showed that the worker launcher ultimately resolved
codexto the protected MSIX executable:C:\Program Files\WindowsApps\OpenAI.Codex_...\app\resources\codex.exeDirect Node reproduction:
child_process.spawn("codex", ["--version"])→
EPERMSpawning the absolute WindowsApps
codex.exealso returned EPERM.However, the user-local native Codex CLI worked:
C:\Users\<user>\AppData\Local\OpenAI\Codex\bin\<build-hash>\codex.execodex-cli 0.147.0-alpha.6.6pwsh.exeandcmd.exealso spawned successfully from Node, so this was not a general child-process restriction.After prepending the directory containing the native user-local
codex.exeto PATH, the exact Node spawn mechanism succeeded:spawnSync("codex", ["--version"])status = 0error = undefinedstdout = codex-cli 0.147.0-alpha.6.6After this workaround, Deep Scan was able to proceed past worker launch.
Additional ENOENT failure mode
There was also an intermediate failure mode when running from Codex CLI:
spawn codex ENOENTThe Security MCP environment contained npm/PowerShell wrappers such as
codex.ps1andcodex.cmd, but no directly spawnable nativecodex.exein the effective PATH.Node
child_process.spawn("codex", ...)does not use PowerShell to resolve.ps1wrappers.Prepending the actual native Codex binary directory fixed this as well.
Expected behavior
Codex Security discovery workers should resolve and launch an executable that is valid in the current Windows execution context.
On Windows, the launcher should prefer an accessible native CLI / validated
CODEX_CLI_PATHinstead of resolving to the protected WindowsApps executable or depending on a shell-specific wrapper.Related issue
This may also be related to #29365, where Codex Desktop generates a wrapper that selects the protected WindowsApps
codex.exeinstead of the accessible localCODEX_CLI_PATH.The important point here is that the original Codex Security
spawn EPERMfailure is still reproducible with Codex Security 0.1.19.