codex - ✅(Solved) Fix Windows: taskkill output leaks into TUI from exec-server stdio cleanup (parallel path to #20845) [1 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#22050Fetched 2026-05-11 03:20:09
View on GitHub
Comments
2
Participants
2
Timeline
18
Reactions
0
Assignees
Timeline (top)
labeled ×5cross-referenced ×3mentioned ×3subscribed ×3

Error Message

taskkill runs silently. Codex still observes exit status to detect failure (and warn!s appropriately if it does fail).

Fix Action

Fix / Workaround

This is closely related to #20845, #21658, and #20869 — all about the rmcp-client MCP teardown path — being addressed by @fcoury-oai's PR #21759. However, #21759 only patches rmcp-client/src/stdio_server_launcher.rs. There's a parallel uncovered code path in exec-server/src/connection.rs::kill_windows_process_tree that uses the same taskkill /T /F pattern with the same problem.

PR fix notes

PR #22058: fix(exec-server): suppress Windows taskkill output

Description (problem / solution / changelog)

Summary

This is the exec-server follow-up to #21759.

#21759 fixed the Windows taskkill output leak for the rmcp-client MCP teardown path, but #22050 showed that exec-server still had a parallel taskkill /T /F cleanup path in exec-server/src/connection.rs. Because that command inherited the parent stdio handles, Windows could still print SUCCESS: lines into the user's terminal during stdio child cleanup.

This change silences that remaining exec-server callsite by redirecting taskkill stdin, stdout, and stderr to Stdio::null().

What Changed

  • add a Windows-only Stdio import in exec-server/src/connection.rs
  • redirect the taskkill command in kill_windows_process_tree to Stdio::null() for stdin, stdout, and stderr
  • keep the existing kill semantics unchanged by still checking .status() and preserving the existing fallback/logging behavior

How to Test

Manual validation is Windows-only, so I did not run the UI repro path locally here.

  1. On Windows, use a Codex build from this branch.
  2. Exercise an exec-server stdio flow that spawns a child process tree and then triggers transport cleanup.
  3. Confirm the child process tree is still torn down.
  4. Confirm the terminal no longer shows SUCCESS: The process with PID ... has been terminated. lines during cleanup.

Targeted tests:

  • cargo test -p codex-exec-server client::tests::dropping_stdio_client_terminates_spawned_process -- --exact
  • cargo test -p codex-exec-server client::tests::malformed_stdio_message_terminates_spawned_process -- --exact

Notes:

  • cargo test -p codex-exec-server still hits unrelated local macOS sandbox-exec: sandbox_apply: Operation not permitted failures in tests/file_system.rs.

References

  • Fixes the remaining callsite discussed in #22050
  • Related earlier fix: #21759

Changed files

  • codex-rs/exec-server/src/connection.rs (modified, +5/-0)

Code Example

> SUCCESS: The process with PID 1282520 (child process of PID 1309580) has been terminated.
SUCCESS: The process with PID 1309580 (child process of PID 1301732) has been terminated.
  gpt-5.5 high · ~ · gpt-5.5 · Jacob
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

codex-cli 0.130.0 (also reproduces on 0.129.0)

What platform is your computer?

Windows 11

What terminal emulator and version are you using?

Reproduces in Windows Terminal, VS Code's integrated terminal, and bare PowerShell.

What issue are you seeing?

When codex's exec-server terminates a stdio child process tree on Windows, taskkill /T /F's SUCCESS: status lines get written to the inherited stdout — the same terminal the TUI is rendering in. The result is garbled output landing in the input area mid-session:

> SUCCESS: The process with PID 1282520 (child process of PID 1309580) has been terminated.
SUCCESS: The process with PID 1309580 (child process of PID 1301732) has been terminated.
  gpt-5.5 high · ~ · gpt-5.5 · Jacob

This is closely related to #20845, #21658, and #20869 — all about the rmcp-client MCP teardown path — being addressed by @fcoury-oai's PR #21759. However, #21759 only patches rmcp-client/src/stdio_server_launcher.rs. There's a parallel uncovered code path in exec-server/src/connection.rs::kill_windows_process_tree that uses the same taskkill /T /F pattern with the same problem.

Reproduction

  1. Configure any stdio MCP server (or use any tool call that spawns a child process tree on Windows).
  2. Trigger cleanup (exit, /mcp refresh, or anything that causes the supervisor to terminate the child).
  3. Observe SUCCESS: ... lines appearing in the TUI input area.

Suspected cause

Both Windows taskkill call sites in codex inherit the parent's stdio handles by default:

  • codex-rs/rmcp-client/src/stdio_server_launcher.rs:339-345 (covered by #21759)
  • codex-rs/exec-server/src/connection.rs:188-201 (uncovered)

Default Rust std::process::Command::new("taskkill") inherits stdout/stderr.

Proposed fix

Branch: https://github.com/jacobhallgren/codex/tree/fix/win-taskkill-noise

Apply the same .stdout(Stdio::null()).stderr(Stdio::null()) redirection to both call sites. Exit status is still observed via .status(), so kill semantics are unchanged.

Diff: 2 files, 4 insertions, 0 deletions. The rmcp-client portion mirrors @fcoury-oai's already-approved PR #21759; the exec-server portion is the additional uncovered case.

Expected behavior

taskkill runs silently. Codex still observes exit status to detect failure (and warn!s appropriately if it does fail).

Note

I haven't opened a PR per CONTRIBUTING.md (invitation-only). The branch is public and the diff is small enough to be picked up under another author if that fits the workflow better. Happy to open a PR if a maintainer wants to invite.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

taskkill runs silently. Codex still observes exit status to detect failure (and warn!s appropriately if it does fail).

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - ✅(Solved) Fix Windows: taskkill output leaks into TUI from exec-server stdio cleanup (parallel path to #20845) [1 pull requests, 2 comments, 2 participants]