Skip to content

codex-companion cancel taskkill fallback breaks under Git Bash — MSYS translates /PID arg to C:/Program Files/Git/PID #331

@lukaskucinski

Description

@lukaskucinski

Environment

  • codex plugin v1.0.4
  • Windows 10 Pro 10.0.19045
  • Git Bash (MSYS2) — the default Bash environment for Claude Code on Windows
  • node codex-companion.mjs cancel <job-id> invoked when a job has stalled

Symptom

When codex-companion's soft-cancel IPC fails and the script falls back to taskkill /PID <pid> /T /F, Git Bash's MSYS layer translates the literal /PID argument into a Windows path, mangling the command:

taskkill /PID 34428 /T /F: exit=1: ERROR: Invalid argument/option - 'C:/Program Files/Git/PID'.
Type "TASKKILL /?" for usage.

MSYS sees /PID as a root-level Unix path and prefixes it with the Git for Windows install root. The actual taskkill receives C:/Program Files/Git/PID 34428 /T /F and rejects the bogus argument.

Result: the cancel fallback fails, the wedged codex process keeps running, and the user has to clean up manually via Stop-Process -Id <pid> -Force from PowerShell.

Reproduction

  1. Launch any codex adversarial-review job from Git Bash on Windows
  2. Trigger a stall condition (e.g., the IPC deadlock described in codex-companion IPC pipe deadlocks mid-review when codex spawns stdout-heavy PowerShell commands on Windows #330; or kill the codex process out-of-band so the broker thinks it's running but it isn't)
  3. Run node codex-companion.mjs cancel <job-id> from Git Bash
  4. Observe the MSYS-mangled taskkill stderr

Suggested fixes (any of these works)

  1. Set MSYS_NO_PATHCONV=1 in the env for the taskkill invocation
  2. Pass //PID (double-slash escape recognized by MSYS as "no translation")
  3. Preferred: on Windows, use powershell.exe -NoProfile -Command "Stop-Process -Id <pid> -Force" instead of taskkill — no MSYS translation, cleaner exit semantics, no dependency on which shell wraps the node invocation

Option 3 is what we recommend to our users in our orchestrator's recovery guidance, so confirmed working.

Reference

Same orchestrator run as the IPC deadlock issue (#330). Job ID review-mpbtwgbj-gswbux, PID 34428.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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