openai / openai/codex

[Windows Codex CLI] exec_command hangs on trivial PowerShell and cmd.exe commands in both pipe and PTY modes

Open
#39,574 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug tool-calls windows-os
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of Codex CLI is running?

codex-cli 0.148.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.6-sol

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

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

PowerShell7.6.5

Codex doctor report
Running `codex doctor --json` through exec_command also hangs for more than 30 seconds without returning stdout, stderr, or an exit code. It must be terminated manually.
What issue are you seeing?

Local shell commands invoked through Codex's exec_command runner hang indefinitely, even when the command is trivial.

For example, Get-Content and Write-Output remain in the "Script running" state for more than 30 seconds without returning stdout, stderr, or an exit code. The same
behavior occurs in both pipe and PTY modes.

The problem is not limited to PowerShell. Running an equivalent command through cmd.exe also hangs without producing output.

On the same machine, launching PowerShell directly outside Codex completes in approximately 0.6 seconds. This succeeds both with and without loading the PowerShell
profile.

As a result, Codex cannot reliably inspect files, run Git commands, execute tests, or perform other local development tasks.

The evidence suggests that the failure occurs above the PowerShell layer, possibly in the Codex Windows child-process launcher, sandbox helper, unified exec session, or
process-result handoff path. This is only a working hypothesis; I have not confirmed the exact root cause.

What steps can reproduce the bug?
  1. Open a local workspace in the Codex Windows app.

  2. Ask Codex to run the following command:

    Write-Output 'CODEX_EXEC_PROBE'

  3. Wait at least 30 seconds.

Observed result:

  • The command remains in the "Script running" state.
  • No stdout, stderr, or exit code is returned.
  • The execution must be terminated manually.
  1. Repeat the test with a basic file read:

    Get-Content -LiteralPath '.\AGENTS.md' -Raw

  2. Repeat it using cmd.exe instead of PowerShell:

    cmd.exe /d /c "echo CODEX_CMD_PROBE"

  3. Repeat the tests in both pipe and PTY modes.

All Codex-managed executions hang in the same way.

  1. Outside Codex, launch PowerShell directly with and without the profile.

Both direct executions complete successfully in approximately 0.6 seconds.

What is the expected behavior?

Trivial local commands should start and finish within a few seconds. Codex should return stdout, stderr, and the process exit code.

If the child process cannot be launched or its result cannot be collected, exec_command should fail promptly with an actionable error instead of remaining in the "Script
running" state indefinitely.

Additional information

Impact: Blocker. Local file inspection, Git operations, builds, tests, and other command-based development workflows are unavailable.

The following possible causes appear unlikely:

  • PowerShell profile: direct execution succeeds both with and without the profile.
  • PowerShell-specific behavior: cmd.exe reproduces the same hang.
  • PTY-specific behavior: both pipe and PTY modes are affected.
  • Large-output backpressure: the issue reproduces with a single short output line.

Fresh thread: [Reproduces / Does not reproduce / Not tested]
After restarting Codex: [Reproduces / Does not reproduce / Not tested]
After rebooting Windows: [Reproduces / Does not reproduce / Not tested]
Codex unsandboxed execution: [Reproduces / Works / Not tested]
Feedback ID: [Paste the ID returned by /feedback, if available]

Possibly related:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the listed Write-Output, Get-Content, and cmd.exe probes, comparing pipe and PTY modes and direct Windows execution. Then trace the Windows child-process launcher, sandbox helper, unified exec session, and process-result handoff named in the report; done means trivial commands return stdout, stderr, and an exit code or fail promptly with an actionable error.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, rust
Domain
cli, operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.