Repository navigation
Start each boot from evidence, not at the coils' limit (macOS-like start) - #28
Conversation
Every boot started latched at the hard limit with an independent hot magnet. On the Neo that held the card 20 dB down until about 33 s and then released 12 dB over about eight minutes. macOS starts its model at the chassis ambient and plays at full level at once. boot_resume = evidence, the new default, starts the first run of a boot (no state under /run, a record path given) from the hottest any past can have left the speakers if every owner kept the coil at or under its hard limit: this daemon, the kernel's safe level, or another OS's own protection with the same limit. With the two-node model the magnet is then bounded by M* = (ta + r T) / (1 + r), r = Rm/Rc, the magnet of a coil held at its limit for ever (84.5 C on the Neo, where the latched start assumed 135 C), and approaches it from a saved magnet no faster than the exact envelope allows (boot.rs has the derivation). The coil starts at the limit, and both nodes cool for at least this boot's uptime at the card's safe level, any time from there on included. Every model (legacy, asahi, unified FF and V/I) starts this way. A record under /var/lib/speakerguardd, a clean stop's or a checkpoint written off the protection loop every 10 s while running, narrows the magnet by how long another owner can have had since, measured by an RTC that agreed with a synchronized system clock when written and agrees with the system clock now. Clocks that went back or disagree give no narrowing, and no clock ever adds cooling credit beyond the uptime. Chassis sensors (SMC hwmon) only raise a start. A record of this very boot, latched, idle and --persist '' keep their existing behaviour. The unit adds no StateDirectory: the daemon makes the directory itself. Unit tests cover every start path: no record, a quick clean reboot, a hot record and long gaps, a running checkpoint, clocks that went back or disagree, corrupt, foreign and same-boot records, chassis sensors, the latched opt-out, the magnet bound against random programmes on the discrete model, and full scale from the worst protected past. Tests that pin the latched or idle policies name it explicitly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RyanTheTide
left a comment
There was a problem hiding this comment.
Independent safety review: changes required before merge. The full findings are on #29. The same code has the same hole here.
C1 (same as #29). invalidate falls back to removing the /run state when the write fails, and the /var/lib checkpoint is best-effort. A crash and restart within the same boot can then find neither file and take the evidence start with the full uptime credit. With the counterexample review_crash_restart_without_run_state_is_not_a_first_start on this head, the restart starts 33 K under the crashed model (coil 74.7 against 107.3 C). In that 60 s programme the truth stayed at 119 C thanks to the RC onset reserve, but the start invariant fails and the test fails. The fix is the same as on #29: no unlock unless the /run state was written, plus a never-removed /run boot marker that blocks the evidence start.
C2 (this PR only). The protected-past rule must hold for every model the daemon runs. On V/I profiles, each model (asahi, unified FF, V/I) starts at its own M*, which needs that model's coil to stay at or under T under the past drive. Past owners govern a different model: speakersafetyd governs the asahi model and macOS spp3 governs its OL model. The constants differ a lot. For example, the j413/j613/j713 rows have Rc 104.9 against 32.1 and Rm 129.5 to 200 against 20. So "the owner kept its coil under T" does not bound the other models. Do one of two things:
- show a cross-model bound, or
- default
evidenceonly on profiles where the daemon and every other owner share one model (J700 lsm2 static, and atsp single-model machines once confirmed), and keeplatchedas the default elsewhere.
Every profile has e < 1. I checked all 34 conf/apple files, and the largest e is 0.146.
Two required items from the 2026-10-31 safety review. C1. The evidence start took a missing /run state as proof that no daemon had unlocked the card this boot. `invalidate` counted a removed /run state as invalidated when the write failed, and the record under /var/lib is best-effort, so a crash and restart in the same boot could find neither file and credit the whole uptime as time at the safe level. The review's counterexample restarted 33 K under the crashed model. - With a record for the next boot configured, the run unlocks only once its /run state is written. A removal no longer counts. - Before the first unlock of a boot, the run writes a marker next to the /run state (/run/speakerguardd/unlocked) with the boot id, durably, and never removes it. A start that finds this boot's marker, or one it cannot read, starts latched. If the marker cannot be written the lock is not taken. - A macaudio override of the safe level (please_blow_up_my_speakers not 0) also refuses the evidence start. speakersafetyd's flag already latches every start. C2. The protected-past bound holds for the model a past owner governed. speakersafetyd governs the asahi model and macOS on the V/I machines its own, with constants up to three times apart, so neither bounds the other models this daemon runs. `boot_resume = evidence` now takes effect only where every owner governs one model (no V/I sense, the legacy governor, no guard: the Neo). Anywhere else it starts latched and keeps no evidence checkpoints. Also a chassis sensor hotter than the model's ambient is now the ambient of every bound (legacy, asahi, unified FF and V/I), not only a floor, and boot.rs documents the two accepted residuals (an RTC set back by another OS, and macOS's cold model start). The review's counterexample is kept as a regression test (its first run now unlocks normally; after the crash its /run state is lost and the restart starts latched from the marker). New tests cover the literal premise (both writes fail: never unlocks), the marker's write and refusal cases, a marker that cannot be written, the override check, the chassis ambient, one_model over every profile, and a V/I machine starting latched under the evidence default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Safety review fixes are in ad14cbd. Please re-review. C1 is the same fix as #29 (2137581), and C2 is new here. C1 (required).
C2 (required). I took the restricted option. Recommended items.
Tests. Buildbox, release: 394 passed, 2 failed, 3 ignored (384 before, plus 10 new). The 2 failures are the same unchanged listening gates that fail on #27 ( 🤖 Generated with Claude Code |
RyanTheTide
left a comment
There was a problem hiding this comment.
Independent safety re-review, round 2: APPROVE (at ad14cbd). The same two non-blocking notes as on #29 apply: the marker sits inside the RuntimeDirectory, and binaries should be swapped only across a reboot.
- C1: the same fix as #29, verified the same way.
- C2 is fixed.
one_modelis true for j700 only across all 35 profiles. Every other profile downgradesevidencetolatchedand spawns no checkpointer (a_vi_machine_starts_latched_under_evidence). - The chassis-ambient change is correct in
assume_evidencefor both the model and the engine: the saved coil's lower bound stays the model's ambient, so a sensor can only raise the start.
Suite on the buildbox (release), with my randomized crash/restart hunt appended: 395 passed, 2 failed, 3 ignored. The 2 failures are the pre-existing RC listening gates (ordinary_quiet_programme_costs_at_most_one_db and j616_ordinary_quiet_programme_has_zero_extra_attenuation), which also fail on #27. All the evidence, C1 and C2 tests and the hunt pass.
Round 2 of the safety review approved the evidence start with a non-blocking note. The marker lived in /run/speakerguardd, so `systemctl clean --what=runtime` or removing that directory took it along with the state. It now sits beside the directory, at /run/speakerguardd.unlocked (`boot::marker_path`). Nothing in the unit manages that path, and the daemon still never removes it. The README, the unit comment and boot.rs also say to replace the binary only across a reboot (the review's second note). An older build without the marker that ran earlier in the same boot can look like no daemon at all. New test: after an unlock and a crash, the whole runtime directory is removed, and the next start of the boot still latches from the marker. The test helper also clears a stale marker beside a reused directory. Buildbox, release: 395 passed, 2 failed, 3 ignored. The 2 failures are the unchanged listening gates that also fail on #27. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Draft, for the independent safety review before anything merges. Based on #27 (0.1.13-rc.1). The same change for the deployed Neo line is #29, and that is what was tested on the Neo.
Problem
Every boot started latched at the coils' hard limit, with the magnet bounded independently at 135 C. On the Neo the card stayed at the kernel safe level (or at its minimum) until about 33 s, then took the lock 12 dB down and released over about eight minutes (reports/neo-audio-quiet-20261031). macOS starts its model at the chassis ambient and plays at full level straight away.
Change
boot_resume = evidenceis the new default. The first start of a boot (no state under /run, a record path given) starts every model node from the hottest a past can have left it, assuming only that every owner kept the coil at or under its hard limit T. The owners are this daemon, the kernel's safe level and another OS's own protection, which on these machines enforces the same hard limit from the same tuning.latched,idleand--persist ''keep their existing behaviour. The unit gains no StateDirectory (DEFAULT_PREEXEC_FAILURE); the daemon makes the directory itself.Every model starts this way: legacy, asahi, and unified FF and V/I.
Safety argument
Results
On this RC the onset reserve (the full-dose FF reserve against the working limit) holds 4.0 dB even with cold speakers at idle. That is the existing failing
ordinary_quiet_programme_costs_at_most_one_dbgate, and it is now the main thing between the Neo and macOS-like loudness on 0.1.13. This PR does not change it. Pointing the reserve at the hard limit instead gained only 0.7 dB and reopened retained continuous counterexamples, so that was dropped.Neo hardware results on the 0.1.12 line are in #29 and reports/neo-audio-quiet-20261031/MACOS-LIKE.md.
Tests
Buildbox, release: 384 passed, 2 failed, 3 ignored. The 2 failures are the two unchanged listening assertions that also fail on #27 (369 / 2 / 1 there). The 15 new tests are in src/boot.rs and src/guard/evidence_tests.rs. The tests that pin the latched or idle policies now name it explicitly.
🤖 Generated with Claude Code