Skip to content

fix: pidfile any-alive contract — closes status/send disagreement - #316

Merged
joelteply merged 1 commit into
canaryfrom
fix-pidfile-liveness-disagreement
Apr 29, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix-pidfile-liveness-disagreement

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

vhsm + authenticator both repro'd: pidfile with 1 stale orphan + N live processes → status says 'running', msg says 'pidfile stale'. Extracted shared helper, both sites use it, dead orphans auto-pruned.

…sm bug)

vhsm-d1f4 + authenticator-448f independently reproduced 2026-04-29:
.airc/airc.pid had 3 PIDs, 1 dead. cmd_status used any-alive logic
('running PID X'); cmd_send used all-alive logic ('Send NOT delivered
— pidfile stale'). Two liveness checks in the same binary disagreed
silently for ~10 minutes per repro.

Extract prune_pidfile_and_count to airc top-level. Both call sites
use it. Single contract: 'alive' means at least one PID in the
pidfile is alive. Auto-prunes dead orphans in-place so the file
converges on truth (no manual intervention to fix a poisoned
pidfile).

Live-tested: pidfile with 1 alive + 1 dead returns count=1, file
post-prune contains only the alive pid.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@joelteply
joelteply merged commit 7895d6a into canary Apr 29, 2026
@joelteply
joelteply deleted the fix-pidfile-liveness-disagreement branch April 29, 2026 15:43
joelteply added a commit that referenced this pull request Apr 29, 2026
…ixes

canary → main: morning fixes (#316 pidfile, #317 ping, #318 input-validation, #319 host bootstrap)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant