Expand description
Dead/stuck detection — the three-detector model + the EOF x pong classifier.
This is the pure heart of supervision: given timestamps and flags, decide
whether a child is healthy, legitimately busy, stuck-alive, or dead. The
supervisor feeds it events (on_event/on_pong/on_eof) and asks
classify(now) on each reactor tick; the kill ladder (kill.rs) acts on a
teardown verdict. No processes or signals here — those are spawn.rs,
reap.rs, kill.rs.
The three detectors:
- A — hard deadline (always on, no child cooperation).
- B — no-progress watchdog: substantive events (loop.step, tool.call,
usage) stamp
last_event_at; silence pastprogress_timeoutis suspicious. - C — ping/pong: pongs (answered by the child’s control thread, which
is separate from its agentic loop) stamp
last_pong_at. Pongs continuing while events have stopped means “busy in a long legitimate tool call”; pongs also stopping means the process is wedged.
Structs§
- Liveness
- Per-child liveness tracker. Construct at spawn with the child’s absolute
deadline; feed it events as they arrive;
classify(now)each tick. - Liveness
Config - Sensible default timeouts.
progress_timeoutis generous because a single tool/model call can legitimately take a while;pong_timeoutis tight because the control thread answers a ping immediately regardless of what the loop is doing.
Enums§
- Health
- A child’s liveness verdict on a given tick.