Skip to content

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

Open

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

Activity

  1. added
    app
    on May 8, 2026
  2. github-actions commented on May 8, 2026

    @github-actions
    Contributor
  3. added
    bug
    windows-os
    app-server
    mcp
    on May 8, 2026
  4. mitre88 commented on May 10, 2026

    @mitre88

    I re-cut the earlier taskkill branch into a narrower follow-up that only covers the app-server/exec-server side left after #21759.

    Branch: https://github.com/mitre88/codex/tree/fix/exec-server-taskkill-stdio-isolation
    Compare: main...mitre88:codex:fix/exec-server-taskkill-stdio-isolation

    What changed after #21759:

    The branch applies the same accepted pattern from #21759 to that remaining callsite only:

    .stdin(std::process::Stdio::null())
    .stdout(std::process::Stdio::null())
    .stderr(std::process::Stdio::null())

    Scope is intentionally tiny: one file, three lines, no behavior change to process-tree termination itself. This seems directly relevant to this issue because exec-server stdio is part of the app-server/JSONL path where non-protocol taskkill output can corrupt the stream.

    Validation run locally:

    • cargo fmt --package codex-exec-server --check
    • cargo check -p codex-exec-server
    • cargo test -p codex-exec-server → 168 passed
    • git diff --check

    Happy to open this as the invited PR if maintainers want the follow-up.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    appapp-serverbugmcpwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions