Skip to content

delivery.sh status reports 'stale pidfile' for a live bridge on Windows (MSYS kill -0 cannot see native node PIDs) #415

Description

@kimyuujin

Environment

  • agmsg v1.1.8 (npm install)
  • Windows 11, Git Bash (MSYS2), codex-cli 0.144.5
  • Codex monitor beta enabled (delivery mode: monitor)

Symptom

With the codex bridge alive and functioning (node process visible in Get-Process, wakeups delivered), delivery.sh status prints:

Codex bridge: worker/codex stale pidfile (metadata mismatch)

Cause

The bridge is a Windows-native node process; its pid (e.g. 4372) lives in the Windows pid namespace. The bash-side liveness probe uses MSYS kill -0, which only sees MSYS-spawned processes:

$ kill -0 4372        # MSYS bash, bridge alive
bash: kill: (4372) - No such process

PS> Get-Process -Id 4372   # same moment
 4372 node

Meanwhile the bridge's own ensureSingleInstance() (node process.kill(pid, 0)) sees the pid correctly — so the singleton guard works, but the status display contradicts it. On Windows this is very confusing to debug: we spent a while chasing a "dead" bridge that was alive the whole time (and its liveness mattered — see my comment on #149).

Suggested fix

On MSYS/Windows, fall back to a native probe when kill -0 fails, e.g. node -e "process.kill(N,0)" (node is guaranteed present for the codex driver) or tasklist /FI "PID eq N".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions