Skip to content

Windows: taskkill output leaks into TUI from exec-server stdio cleanup (parallel path to #20845) #22050

@jacobhallgren

Description

@jacobhallgren

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:

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.

Metadata

Metadata

Assignees

Labels

TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't workingmcpIssues related to the use of model context protocol (MCP) serverswindows-osIssues related to Codex on Windows systems

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions