Skip to content

Windows Codex Desktop: taskkill stdout is parsed as AppServerConnection JSON-RPC/MCP message #21658

@N2H4-xz

Description

@N2H4-xz

What version of the Codex App are you using (From “About Codex” dialog)?

Codex Desktop 26.429.8261.0

What subscription do you have?

ChatGPT Plus

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

On Windows Codex Desktop, I repeatedly see AppServerConnection parse failures where plain Windows taskkill output is parsed as a JSON-RPC/MCP message.

Observed error:

[AppServerConnection] Failed to parse MCP message
Unexpected token 'S', "SUCCESS: T"... is not valid JSON
linePreview="SUCCESS: The process with PID ... has been terminated."

On Chinese Windows locale, the same issue can appear as mojibake:

Unexpected token '�', "�ɹ�: ����ֹ"... is not valid JSON

I exported a sanitized log excerpt with 147 matching parse-error lines. The errors are logged by AppServerConnection. Some taskkill PID chains end at the spawned codex.exe app-server PID.

I also prepared a minimal Windows repro script:

  • buggy mode feeds taskkill stdout into a JSON line parser and reproduces the same parse error
  • fixed mode captures/isolates cleanup stdout and no parse error occurs

Direct probes of @playwright/mcp and npx/cmd wrapper did not reproduce non-JSON stdout on the MCP stdout channel, so the strongest current hypothesis is Codex Desktop / app-server host-side cleanup stdout pollution.

Codex日志导出-taskkill解析污染-脱敏版.md

What steps can reproduce the bug?

I do not have a single deterministic end-to-end Codex UI repro yet, but I have a deterministic minimal Windows mechanism repro that matches the observed Codex logs.

Observed in Codex Desktop:

  1. Run Codex Desktop on Windows with the app-server stdio transport.
  2. Use Browser Use / MCP-related functionality so Codex starts and later cleans up child processes.
  3. In Codex Desktop logs, AppServerConnection sometimes reports JSON parse failures where the line being parsed is plain Windows taskkill output.

Observed log pattern:

[AppServerConnection] Failed to parse MCP message
Unexpected token 'S', "SUCCESS: T"... is not valid JSON
linePreview="SUCCESS: The process with PID ... has been terminated."
Minimal local repro:

cd
node .\probe-host-cleanup.js
node .\probe-host-cleanup.js --fixed
Expected output from buggy mode:

[host] Failed to parse MCP message
[host] SyntaxError: Unexpected token ...
[host] linePreview="SUCCESS: The process with PID ... has been terminated."
[host] PASS: buggy host reproduced taskkill stdout parse pollution.
Expected output from fixed mode:

[host] PASS: fixed host kept taskkill output out of the MCP parser.
The repro demonstrates the mechanism: if Windows taskkill stdout is allowed to reach a stdio JSON-RPC/MCP line parser, it produces the same kind of Unexpected token parse failure seen in Codex Desktop logs.

I attached:

sanitized Codex Desktop log excerpt
probe-host-cleanup.js minimal repro script

What is the expected behavior?

For stdio JSON-RPC/MCP transports, stdout consumed by the protocol parser should contain only JSON-RPC protocol messages.

Windows taskkill output, cleanup diagnostics, and other non-protocol text should be captured, redirected to stderr/log files, or otherwise isolated from the AppServerConnection JSON parser.

Codex Desktop should not attempt to parse lines like this as JSON:

SUCCESS: The process with PID ... has been terminated.
Cleanup output should not cause:

Failed to parse MCP message
Unexpected token 'S', "SUCCESS: T"... is not valid JSON

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appapp-serverIssues involving app server protocol or interfacesbugSomething 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