Windows workspace-write sandbox launches PowerShell in a way that triggers profile access/language-mode errors; danger-full-access works
What version of the Codex App are you using (From “About Codex” dialog)?
26.325.31654
What subscription do you have?
Plus
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
Summary
On Windows, Codex fails in sandbox_mode = "workspace-write" because commands appear to be launched through a PowerShell path that triggers profile loading / constrained-language-style startup errors.
The same setup works with:
sandbox_mode = "danger-full-access"
allow_login_shell = false
So this looks specific to the Windows sandboxed execution path, not to my PowerShell profile itself.
Environment
- OS: Windows
- Codex: latest available at the time of filing
- Shell involved: PowerShell
- Config variations tested:
sandbox_mode = "workspace-write"-> failssandbox_mode = "danger-full-access"-> worksallow_login_shell = falsehelps in the non-sandboxed/full-access path, but does not fully prevent the error inworkspace-write
Symptoms
With sandbox_mode = "workspace-write", commands fail with errors like:
.: Access to the path 'C:\Users\nick\Documents\PowerShell\Microsoft.PowerShell_profile.ps1' is denied.
Earlier variants of the same failure also included PowerShell language mode errors such as:
Cannot dot-source this command because it was defined in a different language mode.
Cannot set property. Property setting is supported only on core types in this language mode.
What I tested
1. My PowerShell profile itself is not the root cause
I removed my user profile file entirely, and the same startup/language-mode style errors still occurred in the failing path.
So this does not seem to be caused by the contents of:
C:\Users\nick\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
2. Changing the terminal UI setting was not sufficient
Even when selecting other terminal types, Codex still appeared to execute through PowerShell on the actual command path, and the same problem remained.
3. danger-full-access works, workspace-write fails
This is the most reproducible distinction:
danger-full-access+allow_login_shell = false-> worksworkspace-write-> PowerShell profile access error returns
4. allow_login_shell = false partially helps
This appears to avoid the issue in the full-access path, likely because PowerShell is started without loading the normal profile path there.
However, in workspace-write, the sandboxed path still seems to hit a PowerShell startup/profile-loading behavior that causes failure.
Request
Could you investigate whether the Windows workspace-write sandbox path is launching PowerShell differently from the danger-full-access path, especially around:
- profile loading
-NoProfile- PowerShell language mode / constrained language behavior
- any startup wrapper or injected script used only in the sandboxed path
This looks like a Windows sandbox integration bug rather than a user profile configuration problem.
What steps can reproduce the bug?
Repro config
A minimal failing config is roughly:
sandbox_mode = "workspace-write"
allow_login_shell = false
A working config is roughly:
sandbox_mode = "danger-full-access"
allow_login_shell = false
What is the expected behavior?
Expected behavior
On Windows, workspace-write should not fail merely because PowerShell has a profile path in the user Documents directory.
Ideally, the sandboxed Windows execution path should do one of the following:
- launch PowerShell with
-NoProfile, or - avoid touching the user profile path entirely, or
- use a startup path that does not trip language-mode / profile-access behavior inside the sandbox
Actual behavior
workspace-write fails before normal command execution with PowerShell startup/profile errors, while danger-full-access works.
Additional information
_No response_
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Additional version-pinned, no-model app-server evidence
I reproduced the same PowerShell language-mode failure through the stable
app-server
command/execAPI. This test did not use a model turn, Codex thread,experimental API, private Desktop IPC, rollout parsing, or UI observation.
Environment
0.149.014b7e6b2356e82d1d9275579eaa588757b4e0a501b65dcc19fccdf77bd83dc00291files0a400c60c044a11fe75cbd31478d2cb33e63892155296d0783b0a68889e8f9f95.1powershell.exepath with-NoProfile -Filecommand/execover stdioreadOnlyoutputBytesCapwas suppliedPowerShell matrix
Four independent requests were intended to test:
7;All four PowerShell processes started, but all four returned:
exitCode: 1;defined in a different language mode.`;
338-354 ms.The write target was absent.
Result:
0/4intended PowerShell semantics reached their probe oracle.Native control
The same
command/execAPI andreadOnlysandbox were then tested with theabsolute current
python.exeand direct argv tokens, again without a customoutput cap.
All four intended semantics passed:
0;7;Result: native Python control
4/4 PASS.This makes the failure specific to the tested Windows PowerShell execution
boundary rather than to
command/exectransport or the read-only sandbox ingeneral.
Evidence integrity and limits
49fff9c58c937b523d26d2e490da55835c50fba002a6a84f58b2b64ad35111385fc26edcd43693e32c58ea71b7d7ec40774e113e3e6f52e559c211a35e2ab997temporary residue remained.
reproducer: the request shape and result hashes were retained, but the
disposable probe script bytes were not retained.
Questions
-Fileexpected to be supported bycommand/execunder the WindowsreadOnlyorworkspaceWritesandbox?cross-language-mode failure?
boundary be documented explicitly?
Related historical report: #7777.
Same symptom here, plus a workaround that keeps the sandbox
On this machine the Windows sandbox cannot create a process when the executable is PowerShell.
cmd.exein the same directory works. Since the sandbox wraps every command in the default shell(
pwsh), every command fails -- includinggit --version, which makes it look as if the toolswere missing rather than the shell being blocked.
Naming
cmd.exeexplicitly as the exec shell makes commands succeed with the sandbox stillenforced. That seems materially better than the two workarounds currently documented
(
danger-full-access, which removes the sandbox, and switching to WSL2), so I am writing it up incase it helps others hitting this.
All of the below was measured on 2026-08-26.
Environment
openai.chatgpt-26.820.60940-win32-x64)config.toml:[windows] sandbox = "unelevated"Note that #26896 reports the same failure after removing its antivirus, so that is not by
itself the explanation.
SeAssignPrimaryTokenPrivilegenorSeIncreaseQuotaPrivilege(i.e. an ordinary user).
Error
-1073283067is0xC0070005-- facility 7 (Win32), code 5 (ERROR_ACCESS_DENIED).An earlier build reported the same condition as plain
5.What I ruled out (each measured, not inferred)
| Hypothesis | Result |
|---|---|
| A broken Store-app alias for
pwsh| No -- it fails with the realC:\Program Files\WindowsApps\...path too || The working directory is unreachable under the restricted token | No -- identical failure with cwd set to a temp dir,
C:\, and a user-profile dir || ACLs on the executable's directory | No --
cmd.exeandpowershell.exelive in the sameSystem32and only one fails || The sandbox mode | Fails under both
read-onlyandworkspace-write; succeeds underdanger-full-access|The discriminating measurement
Asking the model to make three exec calls with the
shellparameter set explicitly:So what is blocked is the PowerShell executable under a modified token -- not the path, not
the working directory, and not the command.
Why this presents as "the tools are missing"
Because the sandbox routes commands through the default shell, a request to run
gitbecomes:...which fails on the shell's account. Every probe (
git,rg,python,node,where)returned the identical
CreateProcessAsUserWerror, and none of those binaries was ever launched.With
shell: "cmd.exe"the samegit --versionreturnsgit version 2.54.0.windows.1.The workaround, and what it preserves
With
shell: "cmd.exe":gitworkstypecomes back byte-identical (the consolecode page is already 65001)
and -- verified on the filesystem rather than by trusting the model's own report -- no file
appeared
rgis simply not on PATH here (anot recognizedmessage, not a denial)Suggestion
This issue already suggests launching PowerShell with
-NoProfile, or via a startup path thatavoids the profile/language-mode constraints. Independently of that, it would help a lot if the
exec shell were configurable (for example a
[windows] exec_shell = "cmd.exe"key).Today the model has to discover that PowerShell is blocked and retry with another shell, so
whether a given run succeeds depends on how persistently it retries. On an affected machine that
makes results non-deterministic: in one run the agent reached
cmd.exeon its third attempt andread the file it needed; in another it gave up after two attempts and reported that it could not
read anything -- while still exiting 0.