SPEC-018 review: deferred hardening follow-ups (hot-path unwraps, panic-guard scope, nits) #8
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up items from the SPEC-018 Phase 1 code review (
reports/2026-06-03-spec018-review.md). The two real bugs (Issue 1 non-functional managed fallback, Issue 2 agent_id churn) and Issue 6 (registry HANDLE→HKEY transmute) are being fixed on branchfix/spec018-review-bugs. These remaining items are lower-severity and deferred:agent/src/session/mod.rs:386, 486, 559:self.transport.as_mut().unwrap()in the connected hot loop (recv / chat poll / frame send). Currently safe by control flow but violates the no-unwrap-in-hot-path rule on the SYSTEM service surface. Replace withexpect("…")orif let Some(t) = … else breakguards; audit similar patterns in the connected loop.agent/src/main.rs:442-466/service/mod.rs:103-167: thecatch_unwindpanic guard only wraps the inner agent runtime (rt.block_on), not the thin status/reporting code inrun_service()itself. Consider wrapping more ofrun_service(or guarding insideservice_main) so the "panic across SCM FFI" guarantee is complete.agent/src/service/mod.rs:353, 470-476: blockingstd::thread::sleepincreate_service_with_retryand the 10×500msstop_if_runningpoll. Install-time only (not in the SCM handler), acceptable; document as install-time-only or convert if ever moved under tokio.agent/src/transport/websocket.rs:208: remove the now-stale#[allow(dead_code)]onclose()(it is live in the SPEC-018 service-stop path).agent/src/enroll.rs:329,359,360,373,380and scatteredcredential_store.rstest code:.unwrap()in#[cfg(test)]. Convert to?/expect("test precondition")for hygiene. No runtime impact.Reference: full review in
reports/2026-06-03-spec018-review.md. Independent validation confirmed Issues 1, 2, and 6 as the actionable ones.