Module reaper
Expand description
The supervision reaper — moves abandoned Running tasks to a terminal state
from OUTSIDE the task body, which the flat-file design could never do.
Two entry points, both modelled on the ACP idle-reaper
(zeroclaw_channels::orchestrator::acp_server — interval(60s) + lock-aware
skip):
recovery_pass— a one-shot sweep at boot that reclaims prior-boot orphans.reaper_loop— the periodic sweep that also times out the daemon’s own hung tasks.
Safety: reclamation goes through TaskRegistry::reconcile_lost, which itself
enforces super::authority::is_authoritative — a live same-boot owner’s
heart-beating task is never reclaimed (the split-brain guard).
Constants§
- DEFAULT_
MAX_ RUNTIME_ SECS - Default grace before a same-boot task with a stale/absent heartbeat is timed out.
- REAP_
INTERVAL - How often the periodic sweep runs.
Functions§
- reaper_
loop - recovery_
pass - One-shot crash-recovery sweep: reclaim every
Runningrecord left behind by a PRIOR boot. Safe to run at every startup — same-boot records are not yet present (this runs before the reaper spawns) and the authority guard protects any that are. Returns the number of records reclaimed. - sweep
- A single sweep — separated for direct unit testing.