2026-11-08: Two Seconds Against a Five-Second Flywheel

A twenty-six-gigabyte flywheel does not stop in two seconds. Every Sunday at 03:30 on manoir, haus.sanctum.cathedral-weekly-restart cycles Sanctum MLX (Qwen3.8-27B-4bit on :1337) so the Council sheds unbounded Metal compile-cache accretion and keeps full generation speed without disabling compilation. At 03:30:29 this morning, Force Flow paged CRITICAL: launchctl bootstrap returned non-zero. Cathedral may be down. Seconds later, :1337 was already warm again. Castellan had caught the fall. Yet cathedral-weekly-restart.log told a starker story: every Sunday since September 20 — nine runs straight — had died with the same Bootstrap failed: 5: Input/output error.
1. Three seconds too early, nine Sundays in a row
Section titled “1. Three seconds too early, nine Sundays in a row”Aligning sanctum-mlx.log, Force Flow history, and launchd unified logs exposed the race to the millisecond:
03:30:05.932— Baseline probe. The script ran a 256-token pre-restart benchmark ([pre] tok/s=12.09), finishing at03:30:27.076.03:30:27.166— Teardown begins.launchctl bootoutsentSIGTERMtoPID 81669. The Rust server began draining connections and unmapping 18.4 GB of wired / 26 GB of resident Metal GPU buffers.03:30:29.330— The stopwatch guess. After a hardcodedsleep 2, the script calledlaunchctl bootstrapjust2.16sinto teardown. Too soon.haus.sanctum.mlxstill lived insidelaunchd. Kernel supervision rejected the duplicate registration with5: Input/output error(EIO), Force Flow paged at03:30:29.544, and the script exited1.03:30:32.362— The flywheel finally stops. Five point two seconds afterbootout— three full seconds after the weekly script walked away —launchdloggedservice inactive: haus.sanctum.mlxandremoving service. Castellan re-bootstrapped:1337at03:30:34(PID 51903), leaving the Council seat unprimed because the compile-cache warm-up probes never ran.
We had already solved this exact teardown physics inside deploy-sanctum-mlx.sh --restart after Kickstart Is Not a Heal and The Brain That Needed 68 GB to Wake Up. Only the Sunday cron still trusted a two-second sleep.
2. The second race: Castellan heals faster than sleep 1
Section titled “2. The second race: Castellan heals faster than sleep 1”Live D-gate verification on manoir immediately uncovered a deeper race inside deploy-sanctum-mlx.sh --restart itself. At 12:51:56.648, held_restart sent bootout to PID 51903, checked launchctl print at 12:52:01.319, and entered immune sleep 1. Three hundred eighty-two milliseconds later (12:52:01.701), launchd finished removing haus.sanctum.mlx. Then Castellan’s 2-second root supervision tick arrived at 12:52:02.182 — 492ms after teardown, still inside held_restart’s one-second sleep — and bootstrapped haus.sanctum.mlx onto fresh PID 55881. When held_restart woke at 12:52:02.486, gone() saw the service still listed, assumed bootout had never finished, waited out the full 60s, and false-paged exit 9 on a healthy, freshly restarted brain.
Auditing both scripts against Windu’s filesystem rules closed every seam in one pass:
Seam uncovered on 2026-11-08 |
Failure mode on manoir |
Hardened contract shipped |
|---|---|---|
Raw bootout + sleep 2 + single bootstrap (cathedral-weekly-restart.sh and restart-on-tailscale-drift.sh) |
26 GB Metal teardown takes ~5.2s, causing 9 straight EIO failures and bypassing sanctum-mlx-deploy.lock |
Delegate both callers to deploy-sanctum-mlx.sh --restart (flock serialization, --check manifest gate, active :1337 stream drain, up to 60s teardown poll, 3x bootstrap retry, new-PID + post-restart --check) |
Castellan 2s heal inside held_restart’s 1s sleep |
Root supervisor re-bootstrapped haus.sanctum.mlx in 492ms (51903 -> 55881), fooling gone() into a 60s stuck-bootout exit 9 |
Capture LAST_PRINT_PID inside gone() with zero extra launchctl calls; treat a non-empty PID change across bootout wait as RESTART=up and run full binary + --check verification |
| Active deploy collision vs preflight refusal | Colliding with an in-flight deploy/rollback would abort noisy, while a non-zero /health timeout previously fell through to exit 0 |
Treat exit 2 lock-held refusal as a clean [skip] (exit 0, zero false alert), fail-loud on /health timeout (180s), and avoid duplicate pages when deploy-sanctum-mlx already paged |
Predictable /tmp/cathedral-probe.json + hand-built JSON curl |
World-writable /tmp target invited symlink/FIFO hazards; unescaped string interpolation risked 400 drops at Force Flow |
Time and parse probes purely in memory via python3 -I (time.monotonic()), refuse symlinked log paths, and dispatch alerts through sanctum-notify (socket -> loopback -> spool) |
3. R2D2 and Qui-Gon close the loop — and compound daily
Section titled “3. R2D2 and Qui-Gon close the loop — and compound daily”Fixing two bash scripts was necessary; leaving the blind spot that hid nine failed Sundays was unacceptable. Every ten minutes for sixty-three days, launchd-health-sentinel recorded {"label": "haus.sanctum.cathedral-weekly-restart", "kind": "stuck", "exit": 1} in launchd-health.log — over nine thousand rows — while R2D2’s detect_launchd_stuck_nonzero_exit dropped every PID == "-" timer job by design and Qui-Gon’s cathedral_1337 check probed a bare TCP socket (listening(1337)) and healed via raw launchctl kickstart -k, bypassing sanctum-mlx-deploy.lock altogether.
Three autonomous upgrades now make Sanctum self-heal this failure class and improve its own coverage every twenty-four hours:
- R2D2 deterministic hygiene self-heal (
heal-cathedral-weekly-restart).detect_cathedral_weekly_restart_failedwatcheshaus.sanctum.cathedral-weekly-restarton every 10-minute cycle. Whenlast_exit != 0, it verifies:1337has zero activeESTABLISHEDstreams,sanctum-mlx-deploy.lockis free, and nogdnordeploy-sanctum-mlxVault board claim is live (deferring cleanly without burning its 6-hour cooldown when busy).heal-cathedral-weekly-restart.shpreflights--dry-run, refuses unhealable manifest/config disownment (exit 3-> immediate escalation), kickstarts the job, and verifieslast_exit == 0. - Qui-Gon functional mTLS probe + held restart (
quigon-doctor.py).probe_cathedral_1337replaces bare TCP socket polling with authenticated mTLSGET /healthagainst:1337, guarded by a180sper-process cold-load window (ps -o etime=) plus a4sconfirm retry so mid-day restarts and heavy prefills never false-trip.heal_cathedral_1337delegates directly todeploy-sanctum-mlx.sh --restart, deferring cleanly wheneversanctum-mlx-deploy.lockis held. - Daily Kaizen compounding + subscription-first Hermes failover (
r2d2/kaizen.py+r2d2/hermes.py+haus-watch.sh). Wired into the dailyhaus-watchdigest (classify.py --kaizen),kaizen.pymineslaunchd-health.log,r2d2-audit.jsonl, andquigon/audit.jsonlevery day to publishagents/r2d2-kaizen.mdinto the Memory Vault: ranking chronic uncovered stuck timer jobs (>= 6consecutive scans still non-zero in livelaunchctl list), clustering recurring unmapped Hermes escalations into next-up deterministic recipe candidates, and auditing every self-heal win or failure. Its first pass immediately caught two silent regressions insidehermes.pyitself — OpenRouter had delistedhermes-3-llama-3.1-70b(710HTTP 404drops in 24h) while healthy"success": truechitti-samskaraheartbeats were starving real failure lines — sohermes.pynow defaults tonousresearch/hermes-4-405b, falls back automatically to localproxyd(:4040council-fast) on404/429/5xx, and drops"success": trueheartbeats at ingest.
Neither the Sunday hygiene cron nor the MLX deploy lane guesses teardown timing anymore — and no scheduled job can sit broken in launchd for nine weeks without R2D2 either healing it in ten minutes or putting its recipe spec on the Council’s morning table.