Skip to content

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

Open

Description

@Seongil-Yoon

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:

Activity

  1. added
    bug
    on Aug 20, 2026
  2. changed the title [-][Windows Codex App] exec_command hangs on trivial PowerShell and cmd.exe commands in both pipe and PTY modes[/-] [+][Windows Codex CLI] exec_command hangs on trivial PowerShell and cmd.exe commands in both pipe and PTY modes[/+] on Aug 20, 2026
  3. added
    app
    windows-os
    tool-calls
    on Aug 20, 2026
  4. github-actions commented on Aug 20, 2026

    @github-actions
    Contributor
  5. Ra13s commented on Aug 30, 2026

    @Ra13s

    Adding an independent Windows repro plus a possible workaround.

    Environment:

    • Windows 11, build 10.0.26200
    • Codex Desktop; bundled CLI used for the workaround test: 0.151.0-alpha.7.2
    • A separate older CLI install on the same machine reports 0.145.0
    • approval_policy = "never"
    • sandbox_mode = "danger-full-access"
    • [windows] sandbox = "unelevated"
    • Windows-native run; WSL distros were stopped

    Observed behavior:

    • Even cmd.exe /d /c echo OK intermittently failed to return within 30 seconds.
    • Tiny file reads also timed out. Once wedged, subsequent shell calls in the affected conversation were unreliable across app restarts.
    • This continued after freeing disk space: C: had 51.01 GiB free, so a full disk/VHD was not the immediate cause.
    • The original incident coincided with an unclean machine reboot while a parallel exec/tool call was in flight.
    • The affected long-lived thread has a 391.9 MiB rollout. Its SQLite row reports tokens_used = 3,867,434,503, and resume logs contain Custom tool call output is missing for call id: ... for the interrupted call. The large/corrupt thread may be an amplifier, but it does not explain why trivial commands also hung in a fresh thread.

    Workaround attempted:

    [features]
    unified_exec = true

    The config was recognized as unified_exec stable true. A fresh bundled-CLI test then ran cmd.exe /c echo CODEX_UNIFIED_EXEC_OK successfully in 0 ms, and the Codex process exited cleanly. I do not yet know whether this workaround is durable, but it switches Windows away from the default non-unified exec path and is the first clean result after the hangs.

    The conversation-scoped persistence also looks related to #34842.

  6. bzy5354-collab commented on Aug 31, 2026

    @bzy5354-collab

    Additional reproduction from Codex Desktop on 2026-08-31.

    Environment:

    • Windows 11 25H2, build 26200.9168
    • Codex Desktop command runner: codex-command-runner 0.151.0-alpha.7.2
    • Bundled runtime version: 26.826.12353
    • Windows sandbox mode: elevated
    • Workspace is on a local NTFS drive

    Measurements from the same session:

    • cmd.exe startup: 24.79 ms
    • Reading a small workspace file: 10.51 ms
    • git status: 66.75 ms
    • git ls-files: 79.21 ms for 16,324 tracked files
    • A trivial echo command completed essentially immediately in the child process, but Codex Desktop returned the tool result about 37.7 seconds later
    • Other trivial reads and echo commands often took 30 to 90 seconds to return through Codex

    CPU usage was low during the delay. Lowering model reasoning effort or selecting a faster response mode did not change it.

    This appears to distinguish filesystem or shell execution time from Codex result delivery time: the child process and local filesystem are fast, while the delay seems to occur in the Windows unified-exec result collection or handoff path.

    Fresh task: reproduces
    After restarting Codex: not conclusively tested in this measurement run
    After rebooting Windows: not tested
    Unelevated sandbox: not tested; elevated is the current reproducing configuration

    No private repository paths or source content are included in this report. This may be worth correlating with the unified-exec changes released around Codex CLI 0.150.0.

  7. guszzpp commented on Sep 18, 2026

    @guszzpp

    I can reproduce what appears to be the same blocker on Windows 11.

    Environment:

    • Codex CLI: 0.155.0
    • Auth: ChatGPT Plus
    • Model: gpt-5.6-sol
    • Local workspace on a Windows drive
    • PowerShell itself works normally outside Codex

    Observed behavior:

    • Codex cannot reliably receive readable terminal results even for trivial commands.
    • After attempting to inspect the repository, the model reports that the terminal “does not return legible results even for a minimal command”, so it cannot verify Git state, files, or tests.
    • This makes the CLI unusable for normal repository work.

    I also see a closely related failure in the Codex Desktop app on the same machine: the shell UI can visibly show successful output (for example, Write-Output OK or Get-Location), while the model says it received no output. In another attempt, the UI showed a one-line path, but the model received only: Output exceeded the available model context and was truncated.

    This persists across fresh Codex sessions. The same PowerShell commands work when run directly outside Codex.

    Impact: blocker — Codex cannot inspect the repository, run Git commands, read files, or execute tests reliably.

  8. joejoejoe12533-coder commented on Oct 2, 2026

    @joejoejoe12533-coder

    Additional reproduction in the Codex desktop app on native Windows, observed on 2026-10-02/03 (Asia/Shanghai). Posting at the affected user's explicit request. The symptoms overlap with this issue; a shared root cause has not been established.

    Confirmed observations

    • A minimal exec_command running Get-Location with login: false did not return output after more than 30 seconds.
    • An explicit C:\Windows\System32\cmd.exe invocation with cmd: "echo local-exec-ok" and login: false also remained pending without output for more than 30 seconds. No PTY comparison was performed in this reproduction.
    • node_repl running only nodeRepl.write('local-runtime-ok'); timed out after approximately 10 seconds with js execution timed out; kernel reset, rerun your request.
    • The user ran Write-Output 'terminal-ok' and a basic Get-Item file-metadata check in Windows PowerShell outside Codex. Both succeeded. This was confirmed from the user's screenshot, without reading the file contents.
    • After the user reported restarting the desktop app, the minimal command and JavaScript checks still failed.
    • A newly created local conversation for the same workspace reproduced the command failure. It waited approximately 31 seconds, then another 11 seconds, and received no command output or underlying launch error before the tool wait was terminated. It could not establish whether the child process actually started.
    • Desktop project listing, conversation creation, and conversation-status retrieval continued to work during the failure.

    Recovery observed

    After the user reported rebooting the computer, command execution and file-metadata reads returned again (the first successful execution reported approximately 2.6 seconds of command wall time). Subsequent file edits, TypeScript checks and local integration tests also completed. The JavaScript runtime responded again as well.

    This is a single observed recovery after reboot, not proof of the cause or a reliable permanent fix. Unsandboxed execution was not compared while the hang was present. Exact desktop-app/bundled-CLI and Windows build versions were not collected; the versions in the original issue should not be assumed to apply to this reproduction.

    Expected behavior: trivial commands should return promptly, or the execution/transport layer should return an actionable error and recover without requiring a computer reboot.

    No project paths, source code, credentials, screenshots or private session transcripts are attached.

  9. dollarm865 commented on Oct 8, 2026

    @dollarm865

    I am seeing a similar symptom in the Windows desktop app. I have not confirmed that it has the same root cause as this issue.

    Submitted feedback ID:
    01a0f4f7-2310-7f41-93bd-d0af3bd6492f

    Observed on 2026-10-08, timezone UTC+08:00.

    Nine existing tool sessions could not return usable execution results:
    84929, 42426, 96351, 8753, 58535, 3701, 69227, 36616, 64216.

    These are tool session_id values, not Windows PIDs. They must not be interpreted as nine confirmed processes.

    The calls concern six private validation tests, one additional wrapper invocation, and two preparation-file reads.

    Each session was polled twice using write_stdin with empty input: 18 polls in total. Every poll returned the same session_id, empty output, and no exit_code. No explicit error code or rejection reason was returned.

    It remains unknown whether the underlying test processes started or exited. I have not established that all local commands are affected.

    No tests were replayed and no processes were terminated during this result-recovery attempt. Existing records have been retained.

    The configured PowerShell runtime is 7.6.5 x64. The exact desktop app version has not yet been verified.

    Could maintainers advise whether there is a supported way to recover the output/completion state of these existing sessions, or inspect their existing execution associations?

    If recovery requires restarting an app/executor or terminating a session, please explain the effect on already-started child processes and retained records. Closing the app should not be assumed to prove that all child processes have exited.E

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbugtool-callswindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions