Skip to content

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

Closed

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.

Activity

  1. added
    bug
    CLI
    windows-os
    TUI
    mcp
    on May 10, 2026
  2. jacobhallgren commented on May 10, 2026

    @jacobhallgren
    Author

    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 into main).

    This issue tracks a separate, uncovered call site: codex-rs/exec-server/src/connection.rs:188-201's kill_windows_process_tree, which uses the same taskkill /T /F pattern 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.

  3. removed
    CLI
    on May 10, 2026
  4. self-assigned this
    on May 10, 2026
  5. killaragorn commented on May 18, 2026

    @killaragorn

    +1

  6. fcoury-oai commented on May 24, 2026

    @fcoury-oai
    Contributor

    Fixed by #22058

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

Metadata

Metadata

Assignees

Labels

TUIbugmcpwindows-os

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions