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
- Hosts: fleet-wide (rdmsm4x, rdmbair15m5, rdmbair13m5, jdmbair13m5, rdmpw3265m, rdmpw3275m)
- Files touched:
~/scripts/probe_host_state.sh(canonical and all 6 fleet hosts)~/dev/fleet/tooling/host-scripts/*/probe_host_state.sh(all 6 host configs)~/scripts/resume_claude_*.zsh(session, dev73, deve2, logttyd6)~/dev/fleet/tooling/host-scripts/rdmsm4x/resume_claude_*.zsh~/dev/fleet/maintenance/scripts/resume_claude_dev73.zsh~/dev/issues/resolved/ISSUE-20260901-17-*.md
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
- Host State Probes:
- Updated
~/scripts/probe_host_state.shto use-awith all agent and server queries:pgrep -a -x claudepgrep -a -x agypgrep -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.shand deployed directly to~/scripts/probe_host_state.shacross all 6 reachable fleet hosts.
- Updated
- Resume Scripts:
- Updated post-launch verification loops in
resume_claude_*.zshfrompgrep -f "claude --resume ..."topgrep -a -f "claude --resume ...", preventing failure when invoked interactively from within a live session.
- Updated post-launch verification loops in
- Verification Evidence:
- Direct measurement on
rdmbair15m5before/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 -nclean across all modified scripts (rc=0). - Commits:
fleet21e0980,maintenance12e779f,issuesc733769. - Broadcasted resolution on message bus
(
20260923-190444-C0C8253B).
- Direct measurement on
Outstanding Actions
- None. Control verified and deployed fleet-wide.