plan/168: device daemon self-healing + app-triggered repair #115
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.42) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 339 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.349
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #115"
general
weight: 0.35
github-actions[bot]
plan/168: device daemon self-healing + app-triggered repair
What
Closes the 2026-11-22 incident class: a wedged device daemon (alive process,
stuck event loop) left room
devicedark for 5.5 h with no repair path — allcontrol verbs run inside the target's pi process, which a wedged loop never
processes. Relay unchanged.
Three detection/repair layers plus the app UX:
1. Supervisor ping loop — pipe-pings every RPC child every 30 s; 2
consecutive misses (≈60 s) → kill + respawn (
--continuekeeps theconversation). Fastest layer; works even with the relay down.
2.
daemon_controlaction verb (restart/status) — a live daemonanswers itself (acks first, then exit 1 → supervisor crash-respawn). When
room
deviceis dark, the keeper now holds it control-only (connectswithout
roomMeta, never appears as a session, yields to the real daemonon hello) so the phone can ask the supervisor to bounce the child.
Kill-switch
allow_remote_session_control:falserefuses both paths.3. Watchdog — supervisor probed with a real
{"op":"status"}piperound-trip (3 fails → kill + restart; a connect-only probe false-OKs a
wedged loop). The daemon refreshes registry
lastSeenAton its 60 s tick;stale >5 min → bounce ONLY the device child (10 min cooldown, never the
whole supervisor, never the plan/159 backoff state).
4. App — Projects screen diagnoses failures (no relay vs "Device daemon
offline on <peer>"), auto-repairs ONCE per visit (10 s grace → restart →
≤10 s re-announce wait → single
list_projectsretry), then falls backto a Retry restart button.
Evidence (live replays, 2026-11-23)
respawn, room re-announced ≈41 s (budget ≤90 s); keeper released the
claim on the daemon's hello.
≈98 s → kill + restart ≈105 s; the old daemon followed via stdio-EOF,
clean respawn, relay untouched.
Tests
exonerated vs main by A/B).
New: 8 protocol + 3 repository round-trip + 7 viewmodel (fakeAsync) + 2
widget tests.
ConnectionManager.dispose()now cancels the online-recheckperiodic timer (leak exposed by the new tests).
Docs
PROTOCOL.md— "Device daemon control (plan/168)": dual serving paths,kill-switch, request/reply shapes.
pi-extension/docs/daemon.md§3b — self-healing layers; outage window forthe incident class: hours → minutes.
[Unreleased].