Windows: /mcp prints taskkill “SUCCESS” process termination logs

Resolved 💬 12 comments Opened May 3, 2026 by RE-codes Closed May 10, 2026

What version of Codex CLI is running?

codex-cli 0.128.0

---

What OS and shell are you using?

  • Windows 11
  • PowerShell

---

What steps can reproduce the bug?

  1. Configure an MCP server (e.g. Context7)
  2. Start Codex CLI
  3. Run /mcp

---

What is the expected behavior?

/mcp should display MCP server status without OS-level process logs.

---

What is the actual behavior?

    SUCCESS: The process with PID 14276 (child process of PID 5280) has been terminated.
    SUCCESS: The process with PID 5280 (child process of PID 14200) has been terminated.
    SUCCESS: The process with PID 14200 (child process of PID 14748) has been terminated.
    SUCCESS: The process with PID 14748 (child process of PID 2024) has been terminated.

appear every time /mcp is run.

---

Additional context

  • Context7 MCP server works correctly; this is cosmetic noise
  • Reproduces with:
  • npx directly
  • cmd /c npx
  • custom env
  • startup_timeout_ms
  • This appears to be Windows-specific (not observed under WSL2)

---

Impact

Low functional impact, but degrades CLI UX—especially when /mcp is used frequently.

View original on GitHub ↗

12 Comments

dupl · 2 months ago

I encountered the same problem.

EurekaMXZ · 2 months ago

Same issue:

<img width="1068" height="468" alt="Image" src="https://github.com/user-attachments/assets/897f756a-ae5f-4513-9bbe-84e2c297a122" />

<img width="752" height="555" alt="Image" src="https://github.com/user-attachments/assets/600fa9bc-6a7c-4059-9787-ed2f50eafe02" />

Relevant code:

The Windows termination path currently appears to invoke taskkill without redirecting its stdio, see codex-rs/rmcp-client/src/stdio_server_launcher.rs:

#[cfg(windows)]
fn terminate(&self) {
    let _ = std::process::Command::new("taskkill")
        .arg("/PID")
        .arg(self.pid.to_string())
        .arg("/T")
        .arg("/F")
        .status();
}

Since no stdio is specified, taskkill inherits Codex's stdout/stderr. As a result, taskkill status messages are printed directly into the terminal used by the TUI.

Possible fix:

Redirect the taskkill process stdio to null:

#[cfg(windows)]
fn terminate(&self) {
    use std::process::{Command, Stdio};

    let _ = Command::new("taskkill")
        .arg("/PID")
        .arg(self.pid.to_string())
        .arg("/T")
        .arg("/F")
        .stdin(Stdio::null())
        .stdout(Stdio::null())
        .stderr(Stdio::null())
        .status();
}

Optionally, also set CREATE_NO_WINDOW on Windows:

#[cfg(windows)]
fn terminate(&self) {
    use std::os::windows::process::CommandExt;
    use std::process::{Command, Stdio};

    const CREATE_NO_WINDOW: u32 = 0x08000000;

    let _ = Command::new("taskkill")
        .arg("/PID")
        .arg(self.pid.to_string())
        .arg("/T")
        .arg("/F")
        .stdin(Stdio::null())
        .stdout(Stdio::null())
        .stderr(Stdio::null())
        .creation_flags(CREATE_NO_WINDOW)
        .status();
}
EurekaMXZ · 2 months ago

I prepared a possible fix: EurekaMXZ/codex@134409d

However, I am unable to create a Pull Request for this commit, as it only allows invited collaborators to do so.

If this approach matches the intended direction, I’d be happy to open an invited PR.

dupl · 2 months ago

@etraut-openai Please fix this bug. Thank you so much!

zhao004 · 2 months ago

<img width="895" height="318" alt="Image" src="https://github.com/user-attachments/assets/9837e2e1-ad71-4a62-8c34-513bde135a37" />

Same problem

AngeloTadeucci · 2 months ago

Same. thread ID 019df5b9-d5f8-77a3-8629-36c48d1879b1

falvarez1 · 2 months ago

Same... version codex-cli 0.128.0

<img width="1214" height="182" alt="Image" src="https://github.com/user-attachments/assets/692a24ee-18ce-438a-a2a6-8ad6f67dc205" />

dupl · 2 months ago

@rhan-oai Please fix this bug. Thank you so much!

dupl · 2 months ago

@fcoury-oai Please fix this bug. Thank you so much!

EurekaMXZ · 2 months ago

Fixing this bug could still take a long time; this repository does not accept PRs from external contributors, and there are currently over 3,000 open issues.

EurekaMXZ · 2 months ago

Currently, in the latest version of Codex, if this issue occurs, you can resize the terminal window; this triggers a re-layout of the Codex TUI, thereby clearing the stdout output by taskkill that has leaked into the TUI.

Chris0Jeky · 2 months ago

As of today (May 10) the issue is still present for me and triggers regularly

<img width="1052" height="599" alt="Image" src="https://github.com/user-attachments/assets/4b8eca3f-cf78-4f48-8eff-b070de78466e" />