Windows: PowerShell fails with error 8009001d (NTE_PROVIDER_DLL_FAIL) in sandbox
Description
On Windows 11 (10.0.26200), Codex CLI v0.111.0 always uses powershell.exe as the shell for command execution. However, PowerShell fails to start with error 8009001d (NTE_PROVIDER_DLL_FAIL - cryptographic provider DLL initialization failure) when spawned by Codex.
Environment
- OS: Windows 11 Pro 10.0.26200
- Codex CLI: v0.111.0
- PowerShell: 5.1.26100.7705
- Node: via npm global install
Steps to Reproduce
- Install codex-cli on Windows
- Run any command:
````
codex exec --full-auto "echo hello"
- Observe that all PowerShell invocations fail with:
````
Windows PowerShell のキャリブレーションがエラー 8009001d で失敗しました
Key Findings
powershell.exe -NoProfile -Command "echo test"works fine when called from bash/cmd directlycodex sandbox windows -- powershell.exe -NoProfile -Command "echo test"fails with 8009001dcodex sandbox windows -- cmd.exe /c "echo test"works fine- Error persists with ALL sandbox modes:
read-only,workspace-write,danger-full-access - Error persists with both
[windows] sandbox = "elevated"and"unelevated"config - Error persists with
--dangerously-bypass-approvals-and-sandbox
Root Cause Analysis
The Windows restricted token created by Codex's sandbox (even in full-access mode) appears to strip privileges or SIDs required by PowerShell's cryptographic service provider initialization. Error 0x8009001d (NTE_PROVIDER_DLL_FAIL) indicates the RSA/AES crypto provider DLL cannot initialize under the restricted process token.
Since cmd.exe doesn't require cryptographic services, it works fine under the same restricted token.
Current Workaround
The model (gpt-5.3-codex) can self-correct by falling back to cmd.exe /c commands after PowerShell failure, but this wastes tokens on every session. Adding instructions to AGENTS.md to prefer cmd.exe helps.
Expected Behavior
Either:
- Codex should use
cmd.exeas the default shell on Windows (since PowerShell requires crypto providers that the restricted token blocks) - Or the restricted token should preserve the privileges needed for PowerShell crypto initialization
- Or provide a config option to select the shell (e.g.,
[windows] shell = "cmd")
Feature Flags
Relevant feature flags from codex features list:
elevated_windows_sandbox: removedexperimental_windows_sandbox: removedpowershell_utf8: stable (true)shell_tool: stable (true)
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗