Fleet changelogs · dev.ecs0.net
rdmbair15m5-changelog-20260923-1905-issue-20260901-17-pgrep-ancestor-flag-fleetwide

rdmbair15m5-changelog-20260923-1905-issue-20260901-17-pgrep-ancestor-flag-fleetwide

Fixed silent false-negative process counting across fleet host probes and resume scripts by adding -a flag to pgrep to include process ancestors.

Scope

Problem Addressed

Under Darwin/macOS, pgrep excludes the calling process and all its ancestor processes by default unless -a is explicitly supplied: -a Include process ancestors in the match list. By default, the current pgrep or pkill process and all of its ancestors are excluded (unless -v is used). Consequently, whenever an agent (e.g. Codex, Claude, agy) executed probe_host_state.sh, the probe evaluated pgrep -x agy, pgrep -x claude, or pgrep -f 'codex app-server' with the caller's parent process excluded, causing the probe to falsely report that runtime as absent or under-counted.

Remediation Details

  1. Host State Probes:
    • Updated ~/scripts/probe_host_state.sh to use -a with all agent and server queries:
      • pgrep -a -x claude
      • pgrep -a -x agy
      • pgrep -a -f 'codex app-server'
      • pgrep -a -fl 'codex app-server proxy'
      • pgrep -a -f 'ollama serve'
      • pgrep -a -fl 'llama-server'
    • Synced the updated probe across all 6 host templates in fleet/tooling/host-scripts/*/probe_host_state.sh and deployed directly to ~/scripts/probe_host_state.sh across all 6 reachable fleet hosts.
  2. Resume Scripts:
    • Updated post-launch verification loops in resume_claude_*.zsh from pgrep -f "claude --resume ..." to pgrep -a -f "claude --resume ...", preventing failure when invoked interactively from within a live session.
  3. Verification Evidence:
    • Direct measurement on rdmbair15m5 before/after:
      • pgrep -x agy: returned 2 PIDs (54648, 92559) — omitted calling session PID 60483.
      • pgrep -a -x agy: returned 3 PIDs (54648, 60483, 92559) — accurately captured calling session.
    • Executed live probe_host_state.sh: verified all agent PIDs (Claude, agy, Codex) measured accurately without drops.
    • Syntax validated: zsh -n clean across all modified scripts (rc=0).
    • Commits: fleet 21e0980, maintenance 12e779f, issues c733769.
    • Broadcasted resolution on message bus (20260923-190444-C0C8253B).

Outstanding Actions