fix(state_monitor): level-triggered, numeric-robust, observable auto-scrub#78
Open
pbitzer wants to merge 1 commit into
Open
fix(state_monitor): level-triggered, numeric-robust, observable auto-scrub#78pbitzer wants to merge 1 commit into
pbitzer wants to merge 1 commit into
Conversation
…scrub The auto-scrub safety net was a one-shot falling-edge trigger on bytes_remaining: it fired at most once per high->low crossing, never retried while the drive stayed low, and sent scrub output to /dev/null. On mj05 the AGS drive filled to 0 with the automated scrub failing to keep it clear (last effective drain was a manual scrub); a single missed or ineffective scrub could doom the drive, and silent failure made the event unreconstructable after log rotation. Make check_sensor_drive level-triggered with a cooldown-gated retry, numeric-robust (skip NA/nan/non-numeric instead of raising a TypeError that run_checks swallows), and observable (append scrub stdout/stderr to scrub_log). Alert on descent-entry and on each respawn so a persistently full drive escalates instead of going silent after one message. Adds scrub_cooldown_s (1800s) and scrub_log config. Rewrites the edge-only boundary tests to the new level-triggered contract and adds tests for nan/None guards, cooldown, escalation, and observability. Root-cause analysis + adversarial review: docs/scrub-trigger-fix-analysis.md Effectiveness + peer review: docs/scrub-fix-assurance-report.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 12, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
mj05's AGS drive
/ags/datafilled to 0 bytes (Jul 2026). The data was real (~20,446 legit 22 MB triggers; brokkr had already copied ~20,400 to MJ — only 10 were missing). The automated scrub safety net did not keep the AGS side clear; the last effective drain was a manual scrub.The auto-scrub trigger (
StateMonitor.check_sensor_drive) had three code-visible weaknesses (independent of the — unprovable, logs rotated — question of whether it fired on the key day):None/string value raisesTypeErrorthatrun_checksswallows, silently disabling the check;/dev/null, exit status ignored — a scrub that runs and frees nothing is invisible.What
check_sensor_driveis now level-triggered (fires on any below-threshold sample), cooldown-gated (scrub_cooldown_s, default 1800s) so it retries without spamming, and numeric-robust (skips NA/nan/non-numeric;0still fires)._spawn_scrubreturns success; cooldown is stamped only on a successful launch; scrub output is appended toscrub_log(config) instead of/dev/null.scrub_cooldown_s+scrub_logto[steps.state_monitor].Tests
test_hamma_noisefailures are an installed-hammaversion issue, unrelated).Review trail (in this PR)
docs/scrub-trigger-fix-analysis.md— root cause + 3-way adversarial red-team + debugger adjudication (my first nan theory was refuted and the report re-scoped honestly).docs/scrub-fix-assurance-report.md— effectiveness + peer review. Honest bottom line: this fix alone is not a guarantee of no recurrence.Known residual (tracked follow-ups, NOT closed here)
bytes_remaining; needs a directdf /ags/dataprobe./media/pi/DATA??free space is unmonitored (DATA55 is also full) — needs a localdisk_usagecheck.Not deployed to any unit yet (deploy via normal
git pull+ brokkr restart after merge).🤖 Generated with Claude Code