Windows elevated sandbox delays every shell_command by ~88 seconds before process creation; unelevated is immediate

Open 💬 2 comments Opened Jul 10, 2026 by chenhengshuo
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

0.144.0

What subscription do you have?

ChatGPT Pro

Which model were you using?

gpt-5.6-sol

What platform is your computer?

_No response_

What terminal emulator and version are you using (if applicable)?

_No response_

Codex doctor report

What issue are you seeing?

Summary

On native Windows, every shell_command invocation is delayed for approximately 88 seconds when the Windows sandbox is configured as elevated.

The delay occurs before powershell.exe is created. PowerShell startup and the requested script itself are fast once the process is finally launched.

Changing only the Windows sandbox mode from elevated to unelevated resolves the problem immediately.

Timing breakdown

For one representative invocation, the total duration was 88.85 seconds:

  • Tool request to powershell.exe process creation: 88.03 seconds
  • PowerShell process creation to script entry: 0.61 seconds
  • Actual script execution: 0.077 seconds
  • Result return: approximately 0.13 seconds

A non-shell tool invocation completed in approximately 22 ms, so the general tool system was responsive.

The abnormal delay is isolated to the shell_command execution path after the request is submitted but before the PowerShell process is created.

Observed behavior

With:

[windows]
sandbox = "elevated"

even trivial commands such as:

Write-Output "OK"
or reading a small local file take approximately 88–90 seconds.

The file read or PowerShell command itself is not slow. Almost the entire delay occurs before process creation.

With:

[windows]
sandbox = "unelevated"

### What steps can reproduce the bug?

[windows]
sandbox = "unelevated"

### What is the expected behavior?

_No response_

### Additional information

_No response_

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 1 month ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #31556

Powered by Codex Action

Speedy1991 · 1 month ago

I can confirm this issue on my machine and wanted to share some additional investigation results that may help identify the root cause.

Environment

  • Windows 11
  • Codex CLI 0.144.3
  • Reproduces in both:
  • Codex CLI
  • JetBrains/PyCharm integration
  • Reproduces with both:
  • sandbox = "elevated"
  • sandbox = "unelevated"

Symptoms

Every shell command incurs an additional 40–70 second delay before execution.

Initially I suspected this was related to PowerShell commands such as:

Get-Content ... | Select-Object -Skip ... -First ...

However, after further investigation, I found that the command itself is not the problem.

The same delay occurs for trivial commands such as:

Write-Output ok
echo hello
Get-Date
git --version
rg

Investigation

I measured the execution time of the commands using Measure-Command.

The actual PowerShell commands consistently complete in approximately 8–70 ms.

The delay occurs entirely before PowerShell starts executing.

The Codex logs consistently show the following sequence:

setup refresh: spawning codex-windows-sandbox-setup.exe
...
setup binary completed
helper launch resolution...
SUCCESS: powershell.exe

For every shell invocation, codex-windows-sandbox-setup.exe takes approximately 40–70 seconds before the command runner is launched.

After the setup process finishes, PowerShell executes almost immediately (roughly 200 ms).

Additional observations

I monitored the setup process while it was running:

Get-Process codex-windows-sandbox-setup | Select CPU,StartTime,Id

The CPU time continuously increased while the process was running, so it does not appear to be blocked waiting on a timeout. It is actively performing work during those 40–70 seconds.

Workaround

I found a workaround that completely eliminates the problem.

Adding the Codex installation directory to Microsoft Defender exclusions causes the delay to disappear immediately.

Excluded path:

C:\Users\<user>\AppData\Local\nvm\v24.16.0\node_modules\@openai\codex

After adding this exclusion:

  • codex-windows-sandbox-setup.exe completes almost instantly.
  • All shell commands execute immediately.
  • The 40–70 second delay disappears completely.

Conclusion

Based on these findings, the delay does not appear to be related to:

  • PowerShell
  • Get-Content
  • rg
  • Git
  • the repository itself

Instead, it appears to occur entirely inside codex-windows-sandbox-setup.exe, and there seems to be a significant interaction with Microsoft Defender's real-time protection.

Hopefully these findings help narrow down the root cause.