Skip to main content

Module panic_watch

Module panic_watch 

Source
Expand description

srv’s own panics, counted and made visible.

On 2026-11-15 narko’s srv panicked about 30,000 times in two hours. The panics went to the log and nowhere else, /health kept answering, and nobody knew until an agent’s send failed (docs/incident/RCA_BUILD_SLOT_IDLE_NOTE_POISONS_MESSAGE_HANDLER_2026_11_15.md).

  • install_hook chains a panic hook that counts every panic by where it happened. The log stays as it is: the earlier hook runs first, and the hook itself only counts.
  • start_reporter looks at the count every few seconds. Above WARN_ABOVE panics in the last minute it publishes the srv-panics event (the status bar’s backend dot and notices follow it) and, once an hour, holds an [AgentMux] note for every agent. The event is persisted, so a window that opens mid-storm gets the current state.
  • snapshot is what /health and app.health report.

The decisions are pure (Counts), so they are tested without a clock or a panic.

Structs§

Counts
What the watch knows: a per-second ring for the last minute, a total, and a count per place.
PanicPlace
One place that panicked, and how often.
SrvPanicsEvent
The srv-panics event’s payload (mps_events::SrvPanics), shaped like the host’s health-signal payloads so the status bar’s store takes it unchanged: kind is panics, and a normal level clears the signal.
Step
What a look found: the event to publish, and the note to hold for the agents.

Enums§

Level

Constants§

CRITICAL_ABOVE
More than this is critical.
NOTE_KEY
The key of the held note: a later note replaces an earlier one that its agent has not read yet.
WARN_ABOVE
More panics than this in the last minute is a warning.

Functions§

install_hook
Counts every panic from now on. The earlier hook (the default one, which writes the message) runs first and unchanged.
note_text
What the agents are told.
short_location
crates\srv\src\backend\reactive\handler.rs and line 1416 as backend/reactive/handler.rs:1416: below the last src/, with forward slashes, so a build path never leaves the machine.
snapshot
What this srv’s panics add up to now, with the handler lock’s recoveries.
start_reporter
Looks at the count every few seconds, on a thread of its own: publishes the event and holds the note. A failed look costs that look, not the watch.