[Windows Desktop] Injected slash_tmp root maps to C:\tmp and blocks apply_patch for otherwise writable workspaces
What version of the Codex App are you using (From “About Codex” dialog)?
26.715.2305.0
What subscription do you have?
pro
What platform is your computer?
Microsoft Windows 10.0.19045.6456 x64
What issue are you seeing?
[Windows Desktop] Injected slash_tmp root maps to C:\tmp and blocks apply_patch for otherwise writable workspaces
What version of Codex is running?
Codex Desktop build 26.715.2305.0.
The same failure was also present in local sandbox logs from Desktop builds:
26.707.12708.026.623.3763.026.623.8305.026.623.9142.0
What platform is your computer?
Microsoft Windows 10.0.19045.6456 x64.
What issue are you seeing?
Codex Desktop injects a special writable root named <special>:slash_tmp, which is materialized as C:\tmp on Windows.
If C:\tmp already exists but is owned by BUILTIN\Administrators and has no Codex sandbox-group ACE, codex-windows-sandbox-setup.exe tries to add the sandbox write ACE, receives ERROR_ACCESS_DENIED (SetNamedSecurityInfoW failed: 5), and aborts the entire sandbox setup refresh.
As a result, apply_patch cannot update an existing file in an otherwise writable workspace on another drive. The patch target itself is not under C:\tmp.
The current session has both:
<special>:tmpdir, which correctly resolves to the current user's%TEMP%;<special>:slash_tmp, which separately resolves toC:\tmp.
%TEMP% and %TMP% are already:
C:\Users\<user>\AppData\Local\Temp
Neither environment variable points to C:\tmp.
The effective ACL on C:\tmp is:
C:\tmp BUILTIN\Administrators:(I)(OI)(CI)(F)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Users:(I)(OI)(CI)(RX)
NT AUTHORITY\Authenticated Users:(I)(M)
NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)
There is no CodexSandboxUsers ACE. The directory owner is BUILTIN\Administrators, while the Codex process is running with a restricted, non-elevated token and cannot change the directory ACL.
This is especially disruptive because ordinary read commands and some new-file creation can still succeed. The failure becomes visible when apply_patch needs its filesystem helper to update an existing source file.
Representative error
The user-visible tool error is:
apply_patch verification failed: Failed to read file to update
D:\workspace\repo\path\ExistingFile.cs:
fs sandbox helper failed with status exit code: 1:
windows sandbox failed: helper_unknown_error:
setup refresh had errors
The corresponding sandbox log is:
setup refresh: spawning ...\codex-windows-sandbox-setup.exe
granting write ACE to C:\tmp for sandbox group and capability SID
write ACE grant failed on C:\tmp: SetNamedSecurityInfoW failed: 5
setup refresh: processed 3 write roots; errors=["write ACE failed on C:\\tmp: SetNamedSecurityInfoW failed: 5"]
setup refresh completed with errors
setup error: setup refresh had errors
What steps can reproduce the bug?
- On Windows, create or retain a pre-existing
C:\tmpdirectory whose owner isBUILTIN\Administratorsand which does not contain a Codex sandbox-group ACE. - Start a Codex Desktop task in
workspace-writemode with:
- a normal writable workspace, for example
D:\workspace\repo; <special>:tmpdir;<special>:slash_tmp.
- Confirm that
%TEMP%and%TMP%point to the user's normal local Temp directory, notC:\tmp. - Use
apply_patchto add a new Markdown file in the workspace. In this case it succeeded. - Use
apply_patchto update an existing source file in the same writable workspace. - Observe that the update fails before reading the target file because sandbox setup cannot add an ACE to
C:\tmp. - Repeat against another existing workspace file. The same setup-refresh failure occurs.
This was reproduced in three consecutive Codex goal turns. The source files remained unchanged.
What is the expected behavior?
An optional compatibility temp root must not prevent apply_patch from operating on an unrelated, authorized workspace path.
At least one of the following should be true:
- On Windows, map the
/tmpcompatibility root to a user-owned per-user directory, preferably%TEMP%or a Codex-owned subdirectory under%LOCALAPPDATA%, instead of hard-codingC:\tmp. - Allow users or managed permission profiles to remap or remove
<special>:slash_tmp. - If a special optional root cannot be stamped, report that root as unavailable but continue initializing authorized workspace roots.
- If
C:\tmpmust be used, provision its sandbox ACL through an installer/update path that has the required authority, rather than attempting an ACL mutation from every restricted task.
The fix should not require users to grant persistent Modify permission on a shared system-level C:\tmp directory.
Actual behavior
Failure to stamp the unrelated C:\tmp root aborts the complete filesystem-helper setup. apply_patch then cannot update any existing workspace file, including files on D:\.
Changing %TEMP% or adding another writable root such as D:\CodexTmp does not solve the problem while <special>:slash_tmp remains in the root list.
Impact
- Existing source files cannot be updated with
apply_patch. - Long-running Codex tasks become blocked even though the repository itself is writable.
- Read-only shell commands may continue working, which makes the failure look path- or tool-specific.
- Project policies that require
apply_patchcannot safely fall back to shell-based file rewriting. - The only operator-side workaround found is a persistent ACL modification on
C:\tmpor restarting with a permission profile that omitsslash_tmp.
Timeline from local logs
The same C:\tmp ACL failure was observed on:
- 2026-06-26: 103 failures;
- 2026-06-29: 83 failures;
- 2026-06-30: 1 failure;
- 2026-07-16: 138 failures;
- 2026-07-17: more than 500 failures.
There were no C:\tmp attempts in the local sandbox logs from 2026-07-01 through 2026-07-15, which suggests the special root is injected only for some task permission profiles or execution paths.
Related issues
- #14585 — Windows sandbox ACL refresh can break repeated
apply_patch. - #22044 — restricted-token sandbox paths without the Codex sandbox SID remain unwritable.
This report may share the same underlying ACL-stamping mechanism, but adds a Desktop-specific failure mode: an internally injected slash_tmp root maps to a pre-existing administrator-owned C:\tmp, and failure to stamp that optional root disables apply_patch for unrelated authorized workspace paths.
Additional note
There is a separate intermittent Windows Desktop failure when Codex directly launches the Microsoft App Execution Alias for pwsh.exe and CreateProcessAsUserW returns error 1920. That issue is intentionally excluded here so this report remains focused on slash_tmp and ACL refresh.
What steps can reproduce the bug?
- On Windows, create or retain a pre-existing
C:\tmpdirectory whose owner isBUILTIN\Administratorsand which does not contain a Codex sandbox-group ACE. - Start a Codex Desktop task in
workspace-writemode with:
- a normal writable workspace, for example
D:\workspace\repo; <special>:tmpdir;<special>:slash_tmp.
- Confirm that
%TEMP%and%TMP%point to the user's normal local Temp directory, notC:\tmp. - Use
apply_patchto add a new Markdown file in the workspace. In this case it succeeded. - Use
apply_patchto update an existing source file in the same writable workspace. - Observe that the update fails before reading the target file because sandbox setup cannot add an ACE to
C:\tmp. - Repeat against another existing workspace file. The same setup-refresh failure occurs.
What is the expected behavior?
_No response_
Additional information
_No response_
6 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Hey are you using a ramdisk?
A fresh reproduction confirms that the advertised writable-root contract can be false even when ordinary repository writes work.
Environment:
0.144.5workspace-writesandbox5.1.26100.8875(powershell.exe) on CLR 4pwsh.exe) is not installed or available on this machine; sandboxed and elevated checks agreeThe session advertised
C:\tmpas a writable root. A bounded archive-inspection step then attempted to create a unique child directory withNew-Item -ItemType Directory -Path C:\tmp\<unique-name>and receivedUnauthorizedAccessException. The same step succeeded when redirected to the repository's ignoredtmp/directory. No file was created underC:\tmp.This also exposed an agent-orientation problem: a repository owner may intentionally designate a repository-local disposable workspace, but the injected writable-root list can appear more authoritative and lead the agent toward a root that is both inappropriate for the repository and unusable in the sandbox.
A useful product contract would provide one preferred scratch-workspace setting globally with a trusted-project override. Codex should resolve that setting into both the sandbox grant and the agent-visible environment, validate writability when the session starts, identify it explicitly as the disposable working location, and report an unavailable optional root without presenting it as writable or blocking the actual workspace. A project override would let repository owners keep temporary extraction, generated inspection data, and recoverable working notes inside an ignored repository directory when that is their intended file-organization boundary.
I appear to be hitting the same issue on another Windows machine, with a slightly different
C:\tmpACL configuration.Codex version:
codex-cli 0.145.0Feedback/session ID:
019fa9f6-3b9e-7462-b357-8c57316f9253The affected chat's sandbox profile contains both:
Codex reports that:
<special>:tmpdirmaps toC:\Users\Sundar\AppData\Local\Temp<special>:slash_tmpmaps separately toC:\tmpapply_patchlaunches:The actual patch target is inside the writable workspace and is unrelated to
C:\tmp. Avoidingapply_patchand writing the same workspace files through ordinary shell operations succeeds.My environment variables do not point to
C:\tmp:C:\tmpis an ordinary directory rather than a junction:Its ACL differs somewhat from the original report:
So ordinary authenticated users have
Modifyaccess to the directory contents, but the non-elevated Codex sandbox helper cannot modify the directory's ACL because it is SYSTEM-owned and its ACL is protected.This seems to independently reproduce the issue's central failure mode:
<special>:slash_tmpon Windows even though%TEMP%and%TMP%point elsewhere.C:\tmphappens to exist, Codex treats it as a writable sandbox root.apply_patchfor valid workspace files.This also suggests the problem is not specific to
C:\tmpbeing owned byBUILTIN\Administrators; a SYSTEM-owned directory with a protected ACL produces the same result.I agree with the proposed fixes in this issue, particularly mapping
slash_tmpto a per-user Codex-owned directory on Windows, allowing the root to be omitted/remapped, or not aborting all workspace patching when this auxiliary root cannot be prepared.Additional confirmed variant on a current Windows Desktop build: sandbox setup refresh reports success, but
<special>:slash_tmpremains stamped with a stale restricted SID.Environment
26.727.6591.00.146.0-alpha.9.210.0.26200x64workspace-writesandbox with three write roots: a workspace, a visualization output root, and<special>:slash_tmpmapped toC:\tmpSanitized observations
<machine>\CodexSandboxOfflineand is a member ofCodexSandboxUsers.C:\tmpis a normal, non-reparse directory owned by the signed-in user.CodexSandboxUsers:(OI)(CI)(M)plus a synthetic restricted-SIDModifyACE left by an earlier sandbox setup.``
text
``setup refresh: processed 3 write roots (read roots delegated); errors=[]
C:\tmpcontains an older synthetic SID instead of the token's third current SID.C:\tmptherefore fails withAccess denied, despite the root being advertised as writable and despiteerrors=[].Control
Adding only the token's third current restricted SID to
C:\tmpas an inheritableModifyACE, using the WindowsSecurityIdentifierAPI, immediately made the same restricted sandbox able to create and delete a 15-byte probe file. No broad user, group, or profile ACL was added.This extends the original report: the failure can occur even when
C:\tmpis user-owned and already has the sandbox-group ACE. The refresh can silently retain a stale synthetic SID and still claim success.Expected behavior
errors=[]should only be emitted after validating the effective token/root mapping.All usernames, machine names, raw SIDs, project paths, task/thread IDs, and business command text have been removed.
Additional diagnostics from another Windows Desktop installation with the same failure family:
The failure occurred before PowerShell/cmd execution. Codex's sandbox log showed:
granting write ACE to C:\Temp for sandbox group and capability SID
write ACE grant failed on C:\Temp: SetNamedSecurityInfoW failed: 5
setup refresh completed with errors: ["write ACE failed on C:\\Temp: SetNamedSecurityInfoW failed: 5"]
Environment:
The issue persisted across app reinstall and Windows restart. It was resolved by changing the user-level TEMP and TMP variables to the user-owned folder:
C:\Users\<user>\AppData\Local\Temp
After fully restarting Codex, a PowerShell command succeeded immediately.
This appears to be the same ACL-stamping failure described here, with C:\Temp as the concrete temp root instead of C:\tmp. In this variant, TEMP/TMP themselves pointed at the administrator-owned directory, so redirecting them to the per-user temp directory removed the failing root. The broader symptom was also reported in #35353.
Suggested improvement: report the failing ACL target and Windows error directly, or skip an optional temp root that cannot be stamped instead of aborting the entire sandbox setup.