VS Code extension (Windows sandbox): apply_batch rejected because codex-windows-sandbox-setup.exe is missing
What version of the VS Code extension are you using?
0.4.62
What subscription do you have?
plus/api
Which IDE are you using?
VS Code
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What issue are you seeing?
When Windows sandbox mode is enabled in the Codex VS Code extension, file edit application via apply_batch fails. The VS Code UI shows the operation as "rejected" without an actionable reason.
Observed logs:
- Extension log:
windows sandbox: spawn setup refresh ~/.sandbox/sandbox.log: error indicatingsetup refresh: failed to spawn codex-windows-sandbox-setup.exe: program not found.
Suspected root cause:
- The VS Code extension appears to ship and invoke its own bundled
codexbinary by default. - That bundled copy does not include
codex-windows-sandbox-setup.exe, so sandbox initialization fails. - A separately installed Codex CLI (e.g. via npm) includes the exe and works, which explains why the standalone CLI succeeds while the extension fails.
Impact / risk:
- The UI only shows "rejected", and the model/tool response also lacks the underlying error cause. This can lead the model to misinterpret it as a permission/approval problem and either stop work or attempt workarounds (e.g., apply modification by shell code) that may bypass VS Code’s file-edit tracking / sandbox intent.
What steps can reproduce the bug?
- In VS Code on Windows, install the Codex extension.
- Open the Codex Chat tool and start a Codex agent session (either Full agent or the non-full mode).
- In the agent UI, open the top-right settings/menu and enable Windows Sandbox.
- Ask the agent to make a small file change that requires applying edits via the extension (i.e., an
apply_patch/ patch-apply edit).
Example prompt: “Edit README.md and change the first heading text, then apply the patch.”
- Observe that the patch application fails (the UI shows the action as rejected / the edit is not applied).
What is the expected behavior?
- When Windows sandbox mode is enabled, the extension should either:
1) successfully initialize the sandbox and apply edits via apply_batch, or
2) fail with a clear, actionable error explaining the exact cause (e.g., missing codex-windows-sandbox-setup.exe) instead of a generic “rejected”.
- The tool response sent back to the model should include the underlying failure reason (e.g., ENOENT / missing helper binary), not only “rejected”.
- Safety/behavior: if an editor-mediated file edit tool fails, the assistant should not default to suggesting command-line file writes that bypass the editor/sandbox flow unless the user explicitly asks for such a workaround.
- The extension should document and support selecting the Codex CLI path (e.g., via
chatgpt.cliExecutable, or by resolvingcodexfrom PATH) so users can use a working installed CLI when the bundled one is incomplete/outdated.
Additional information
Workaround / mitigation:
In VS Code settings.json, point the extension to a separately installed Codex CLI that includes the Windows sandbox helper:
{
"chatgpt.cliExecutable": "C:\\Path\\To\\Working\\codex.exe"
}
Do not use codex.cmd. It doesn't work.
6 Comments
Hey I would like to work on this issue !
I am seeing this behavior as well in VS Code on Windows 10 Pro. I have the Windows sandbox enabled through my config.toml file. When the agent tries to create a file, a Windows error box pops up outside of VS Code stating "Windows cannot find 'codex-windows-sandbox-setup.exe".
@etraut-openai +1 this seems high-impact (Windows sandbox mode in the VS Code extension becomes unusable) and now has multiple confirmations.
Given the symptoms, this really looks like a packaging/regression in the extension-bundled Windows CLI: missing
codex-windows-sandbox-setup.exe.Two concrete improvements that would help immediately:
Also noting @Yuvraj-cyborg offered to work on this — could be worth assigning if you want community help.
I've submitted a consolidated fix for several Windows-specific issues in PR #10648, including a fix for the missing \codex-windows-sandbox-setup.exe\ error reported here.
I've updated the sandbox orchestrator to proactively verify the helper's existence and surface a clear, actionable error message instead of a generic 'rejected' status. Additionally, the PR addresses the common 'Apply_Patch' inconsistency on Windows by normalizing line endings (CRLF to LF) during the verification step, which should resolve the flakiness seen during sandbox edits.
For extension users, while pointing \chatgpt.cliExecutable\ to a full Codex CLI installation is a valid workaround, this fix aims to make the out-of-the-box experience reliable.
This has been fixed:
I believe this is fixed. I will close this issue for now.