supervisor status: carry restart_count so a crash loop is distinguishable
Closes the remaining half of #3's ask 2. Replaces the inline patch in https://github.com/cortexkit/subconscious/issues/3#issuecomment-5232892801 — forking is enabled now, so this arrives as a PR instead.
The supervisor has always counted respawns. The count was dropped at the ModuleStatus → SupervisorEntry boundary, so a module that crashed once and one crash-looping four times a second presented identically: same state, same last_exit_code. That's the distinction deciding whether to read logs or read config, and it was only recoverable from the journal.
id state enabled live health failures last_action last_exit restarts detail metrics
claustrum running true true ok 0 report code0 0 - {…}
Compatibility is checked, not asserted
restart_count is skipped on the wire when zero, so the committed golden fixture is byte-identical and control_wire_shapes_match_golden_json_and_round_trip passes unchanged. That test passing is the compatibility evidence rather than a design intention.
There's also a real end-to-end check available here, because the daemon running on this box predates the field: a new ck against it renders restarts 0 instead of erroring on the missing key. An actual old receiver, not a mock of one.
Gates
cargo test -p subc-control 3 passed, golden fixture unchanged
cargo test -p subc-core --lib 127 passed
cargo check -p subc-core clean
One decision worth reviewing rather than merging past
The CLI renders absent as 0, collapsing "old daemon, field not sent" with "module has never restarted". Both mean no restarts to report, and a ? would invite reading a quiet module as a diagnostic gap.
But that's the same absent-vs-empty question raised in #7's second design point, and I resolved it the opposite way there — a stderr tail must distinguish captured-empty from not-captured, because those send an operator in opposite directions. The two aren't inconsistent by accident: collapsing is right when the states are equivalent and wrong when they aren't. If you'd rather they match, this is the one to change.
What this doesn't close
#3's acceptance test is a crash loop diagnosable from ck alone. This says it's looping; it still won't say why. The claustrum case had exit_code: 1 and the cause in stderr — that half is #7.
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.
Summary by cubic
Expose the supervisor’s restart_count and display it in ck module status so crash loops are visible at a glance. Keeps wire compatibility by omitting zero; older daemons render “restarts 0” instead of failing.
- New Features
- Carry
restart_countinSupervisorEntry, propagate in control, and add a “restarts” column to the status table (missing treated as 0 for compatibility). - Add docs: “Restarting the module that serves your session” explaining the expected transport error and safe practices (verify state; don’t blind-retry).
- Carry