Skip to content

chore: detect silent launchd gaps in check_sensor_health.py - #572

Open
essentialbit wants to merge 2 commits into
mainfrom
chore/sensor-health-silent-gap-detection
Open

chore: detect silent launchd gaps in check_sensor_health.py#572
essentialbit wants to merge 2 commits into
mainfrom
chore/sensor-health-silent-gap-detection

Conversation

@essentialbit

Copy link
Copy Markdown
Owner

Summary

check_sensor_health.py's gap_hours (time since last rc=0 cycle) correctly captures elapsed wall-clock time, but nothing explicitly flags when that gap is wider than the failure streak alone would explain — i.e. launchd itself stopped firing, distinct from "fired and errored" (rc!=0).

Caught live this cycle: the sensor logged 22 consecutive weekly_limit failures from 2026-08-04 00:20 to 19:29 (~19h), then zero watchdog.log activity for 268.4h (2026-08-04 19:29 → 2026-08-15 23:54) before this cycle fired again. launchctl print showed runs = 1 on the job, confirming it had just (re)started — the machine itself had been up continuously since an 2026-08-08 reboot, so the job was silent for ~7 days despite the host being available. At a glance the existing output (22x weekly_limit, 290.7h since last success) reads as "one long weekly-limit outage," masking the much larger silent gap.

Changes

  • find_silent_gaps(): scans every watchdog.log line's leading timestamp (start/skip/finish all count, not just cycle-finish markers), flags consecutive-line gaps >= a threshold (default 2h, vs. launchd's 3600s StartInterval).
  • New SILENT_GAP section in the report output, separate from the existing streak/verdict logic, so a launchd outage is never absorbed into (or hidden behind) an unrelated failure-streak explanation.
  • --gap-threshold-hours / --max-gaps CLI flags.

No behavior change to the existing verdict/streak logic — purely additive.

Test plan

  • Ran against the real ~/.claude/fred-sensor/watchdog.log — correctly isolates the 268.4h gap as a distinct finding from the 22x weekly_limit streak.
  • PYTHONPATH=. python3 -c "from main import app" — no import regression.
  • ast.parse() on the modified file.
  • No unit tests exist for this script (matches the rest of scripts/*.py in this repo); diagnostic/read-only, single-file, self-directed-tooling class per project policy — no consensus/outcome-recording gate applies.

🤖 Generated with Claude Code

Saifodius and others added 2 commits August 15, 2026 23:59
The watchdog only logs when it actually fires, so a launchd job that
stops firing entirely (unloaded, machine asleep past its wake window,
etc.) leaves no trace distinguishable from "nothing needed reporting" -
the existing streak/gap_hours output requires manual arithmetic to
notice. Caught live: 2026-08-04 19:29 -> 2026-08-15 23:54, a 268.4h gap
with zero watchdog.log activity, sitting right after a 22-cycle
weekly-limit failure streak that made the whole outage look explained
by the limit alone.

Scans every watchdog.log line's timestamp (not just cycle-finish
markers) so start/skip lines count too, and flags any gap >= 2h
(launchd's StartInterval is 3600s) as a distinct SILENT_GAP finding.
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