Repository navigation
Description
What version of the Codex App are you using (From "About Codex" dialog)?
26.623.13972.0
Desktop package:
OpenAI.Codex_26.623.13972.0_x64__2p2nqsd0c76g0
Codex CLI/runtime:
codex-cli 0.142.5
What subscription do you have?
Pro 5x
What platform is your computer?
Windows 11 Home 25H2, 64-bit, build 26200.8655.
Registry version fields:
ProductName : Windows 10 Home
DisplayVersion : 25H2
CurrentBuild : 26200
CurrentBuildNumber : 26200
UBR : 8655
EditionID : Core
InstallationType : Client
Codex environment also reported:
Microsoft Windows NT 10.0.26200.0 x64
Note: Windows compatibility APIs still report ProductName = Windows 10 Home
and NT version 10.0, but the 25H2 display version and 26200 build identify
this as a Windows 11 system.
Shell: PowerShell
What issue are you seeing?
Codex Desktop on Windows currently forces a choice between two broken sandbox
configurations:
-
With
[windows] sandbox = "unelevated":- normal shell commands work
apply_patchcan create filesapply_patchupdate/delete fails before patching workspace files
-
With
[windows] sandbox = "elevated":apply_patchcreate/update/delete works- normal shell commands fail before PowerShell starts
So there does not appear to be a working Windows Desktop setup where both safe
file edits and ordinary diagnostic/build/test commands work in the same session.
This looks related to both existing issues:
- Codex desktop app on Windows injects split writable roots, causing
apply_patchto fail before patching workspace files, forcing agents to fallback to bypass the sandbox and write files using powershell #30712: Desktop injects split writable roots andapply_patchcannot enforce
them under the unelevated Windows sandbox. - Windows sandbox command runner fails with CreateProcessAsUserW failed: 1312 #30024: Windows sandbox command runner fails with
CreateProcessAsUserW failed: 1312.
Current relevant config for the latest repro:
approval_policy = "never"
sandbox_mode = "danger-full-access"
[windows]
sandbox = "elevated"Observed with [windows] sandbox = "elevated":
windows sandbox: runner error: CreateProcessAsUserW failed: 1312
This happens even for simple read-only commands.
Observed with [windows] sandbox = "unelevated":
apply_patch verification failed: Failed to read file to update <workspace file>:
failed to prepare fs sandbox:
failed to prepare windows sandbox wrapper:
windows unelevated restricted-token sandbox cannot enforce split writable root sets directly; refusing to run unsandboxed
What steps can reproduce the bug?
- Use Codex Desktop on Windows with a normal managed workspace-write session.
- Set:
[windows]
sandbox = "unelevated"- Restart Codex Desktop.
- In a workspace, run a normal shell command such as
Get-Location. - Observe that shell commands work.
- Use
apply_patchto create a new file. - Observe that file creation works.
- Use
apply_patchto update or delete an existing workspace file. - Observe that
apply_patchfails with:
windows unelevated restricted-token sandbox cannot enforce split writable root sets directly; refusing to run unsandboxed
- Change config to:
[windows]
sandbox = "elevated"- Restart Codex Desktop.
- Use
apply_patchto create/update/delete a workspace file. - Observe that
apply_patchworks. - Run a simple shell command such as
Get-Location,codex --version, or a
file read command. - Observe that shell execution fails before PowerShell starts with:
windows sandbox: runner error: CreateProcessAsUserW failed: 1312
What is the expected behavior?
There should be at least one Windows Desktop sandbox configuration where both of
these are true:
apply_patchcan create/update/delete files inside the active workspace root.- ordinary shell commands can run for diagnostics/build/test operations.
If the unelevated Windows sandbox cannot enforce split writable root sets, Codex
Desktop should avoid injecting a sandbox shape that breaks apply_patch, or
apply_patch should use a sandbox strategy that supports the Desktop-managed
profile.
If the elevated Windows sandbox is the intended workaround for apply_patch,
ordinary shell commands should still launch successfully instead of failing with
CreateProcessAsUserW failed: 1312.
Additional information
Troubleshooting already tried without resolving the issue:
-
Changed
[windows] sandboxtounelevated.- Result: shell commands worked, but
apply_patchupdate/delete failed with
the split writable roots error.
- Result: shell commands worked, but
-
Changed
[windows] sandboxback toelevated.- Result:
apply_patchworked, but normal shell commands failed with
CreateProcessAsUserW failed: 1312.
- Result:
-
Restarted Codex Desktop after config changes.
- Result: no change.
-
Ended older Codex tasks/processes and restarted Codex again.
- Result: no change.
-
Tried launching/restarting Codex "as administrator".
- Result: process token checks still reported Codex processes as not elevated
(Elevated=0), and shell commands still failed in elevated sandbox mode.
- Result: process token checks still reported Codex processes as not elevated
-
Tried:
[windows]
sandbox = "elevated"
sandbox_private_desktop = false- Result: normal shell commands still failed with
CreateProcessAsUserW failed: 1312.
- Tried excluding temp writable roots:
[sandbox_workspace_write]
exclude_tmpdir_env_var = true
exclude_slash_tmp = true- Result: the Desktop managed permission profile still exposed extra writable
roots such asC:\tmp;apply_patchstill failed inunelevatedmode.
-
Tried a custom permission profile with only the workspace root writable.
- Result: the config parsed and a direct
codex sandbox -P <profile> ...
check worked, but Desktop managed sessions still injected the extra
writable roots, so app session behavior did not change.
- Result: the config parsed and a direct
-
Tried direct elevated launch attempts for the packaged app:
- Direct
Start-Processagainst theWindowsAppspackage executable failed
with access denied due to package ACLs. Start-Processviashell:AppsFolder\OpenAI.Codex_2p2nqsd0c76g0!App
returned success but appeared to focus/reuse the existing non-elevated app
instance instead of starting an elevated Codex process.
- Direct
-
Rechecked after explicitly ending old Codex tasks and restarting as admin.
- Result: current Codex process token checks still showed
Elevated=0.
- Result: current Codex process token checks still showed
The report intentionally redacts the local user profile and workspace paths.
Activity
github-actions commentedon Jul 6, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
apply_patchto fail before patching workspace files, forcing agents to fallback to bypass the sandbox and write files using powershell #30712Powered by Codex Action
pellorao commentedon Jul 10, 2026
I can reproduce the same unelevated sandbox failure with Codex CLI v0.144.1 on Windows.
Configuration:
The session uses workspace-write. I have no [sandbox_workspace_write] section and no user-configured writable_roots.
apply_patch fails with:
Runtime diagnostics show the workspace plus runtime-managed special temp roots such as
:special slash_tmpand:special tmpdir.I also tried setting both TEMP and TMP to a directory inside the workspace before launching Codex, but the failure remained. This suggests that the special temp-root representation itself still causes a split writable-root set.
Codex CLI v0.142.5 with the unelevated sandbox previously allowed apply_patch on the same machine, so this may also be a regression affecting v0.144.1.
bhayden1 commentedon Jul 14, 2026
Additional reproduction from Codex Desktop on Windows 10 Home:
26.707.72221.sandbox_mode = "workspace-write"and invoked theunelevatedWindows sandbox wrapper.C:\tmp, and a Codex visualization directory.apply_patchfailed before reading the target:The misleading Full access UI state is important: the patch path still behaved as sandboxed/unelevated in the active task.
Saru-github commentedon Jul 20, 2026
Additional controlled A/B reproduction from Codex Desktop on Windows (2026-07-20). I originally posted this datapoint on #30009, but this issue appears to be the canonical tracker for the split-root Windows sandbox failure.
Environment:
26.715.4045.0Microsoft Windows NT 10.0.26200.0 x64Managed
workspace-write/ restricted-filesystem mode:apply_patchAdd File stalled for about 60 seconds.{}, and the file had been created correctly.apply_patchDelete File was still unresponsive after about 20 seconds and the task was interrupted.After changing only the task permission profile to
danger-full-access/ unrestricted in the same workspace:This isolates the long stall/hang to the Windows restricted sandbox/wrapper path rather than patch parsing or the workspace filesystem.
Original comment with the same measurements: #30009 (comment)
ryrun commentedon Sep 2, 2026
I can reproduce this outside the Codex Desktop app through Zed's ACP integration.
Environment:
codex-acp1.8.0codex-cli 0.152.1workspace-writeprofile\\<server>\<share>\<workspace>apply_patchcan create new files, but updating existing files fails with:Session logs show that
apply_patchworked on the same UNC workspace with Codex 0.142.4. The failure appeared with 0.145.0 and remains reproducible with 0.152.1.This appears to be the same CLI/runtime issue as #32168, but it is also reproducible when Codex is hosted through ACP, without using the Desktop app.
#35864 seems to be a related fix.