Windows: taskkill output leaks into TUI from exec-server stdio cleanup (parallel path to #20845)
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
- Configure any stdio MCP server (or use any tool call that spawns a child process tree on Windows).
- Trigger cleanup (exit,
/mcprefresh, or anything that causes the supervisor to terminate the child). - 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.
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
For triagers: this isn't a duplicate of the flagged issues. Most of those are about the rmcp-client taskkill call at
codex-rs/rmcp-client/src/stdio_server_launcher.rs:339— that's been resolved by @fcoury-oai's PR #21759 (now merged intomain).This issue tracks a separate, uncovered call site:
codex-rs/exec-server/src/connection.rs:188-201'skill_windows_process_tree, which uses the sametaskkill /T /Fpattern and has the same problem (cf. @lask3802's detailed analysis in #21957 — same root cause, parallel code path).The proposed fix at https://github.com/jacobhallgren/codex/tree/fix/win-taskkill-noise applies the same
Stdio::null()redirection to that uncovered location.+1
Fixed by https://github.com/openai/codex/pull/22058