Voice: voiceHudCont.finish() on shutdown is one-way ratchet; blocks future re-install #35

Open
opened 2026-05-12 19:07:03 +00:00 by KofTwentyTwo · 0 comments
KofTwentyTwo commented 2026-05-12 19:07:03 +00:00 (Migrated from github.com)

Summary

voiceHudCont.finish() on VoiceController.shutdown() is a one-way ratchet. After voiceController.shutdown(), the HudStateCoordinator's voice-subscriber Task exits its for-loop and the HUD permanently ignores future voice intents — even if voice is reinstalled.

Evidence

  • File: packages/Voice/Sources/Voice/Control/VoiceController.swift:181 — finishes HUD continuation
  • Continuation flows into HudStateCoordinator (constructed at AppDelegate.swift:2475)
  • Install path failure branches (line 1163, 1174-1177, 1219) DON'T call shutdown — they return early after partial state

Impact

Today shutdown() is called only from applicationWillTerminate — doesn't bite in normal exits. But if a reinstall on resume from sleep path is ever added, finishing the continuation on shutdown means voice can't come back without restarting HudStateCoordinator.

Recommended fix

Don't finish the continuation in shutdown(). The actor's drop already releases its end of the stream. If the continuation is owned by the actor, it gets cleaned up automatically; explicit finish() is the over-correction.

public func shutdown() async {
    // ... cancel tasks
    // DROP: voiceHudCont.finish()  // letting actor drop is enough
}

Test

  • Behavioral: simulate shutdown() → installVoice() → assert HUD voice subscriber still receives intents

Source

  • Audit: .planning/audit-2026-05-12/voice-audit.md (2026-05-12) — finding P1-4
## Summary `voiceHudCont.finish()` on `VoiceController.shutdown()` is a one-way ratchet. After `voiceController.shutdown()`, the `HudStateCoordinator`'s voice-subscriber Task exits its for-loop and the HUD permanently ignores future voice intents — even if voice is reinstalled. ## Evidence - File: `packages/Voice/Sources/Voice/Control/VoiceController.swift:181` — finishes HUD continuation - Continuation flows into `HudStateCoordinator` (constructed at `AppDelegate.swift:2475`) - Install path failure branches (line 1163, 1174-1177, 1219) DON'T call `shutdown` — they `return` early after partial state ## Impact Today `shutdown()` is called only from `applicationWillTerminate` — doesn't bite in normal exits. But if a `reinstall on resume from sleep` path is ever added, finishing the continuation on shutdown means voice can't come back without restarting HudStateCoordinator. ## Recommended fix Don't finish the continuation in `shutdown()`. The actor's drop already releases its end of the stream. If the continuation is owned by the actor, it gets cleaned up automatically; explicit `finish()` is the over-correction. ```swift public func shutdown() async { // ... cancel tasks // DROP: voiceHudCont.finish() // letting actor drop is enough } ``` ## Test - Behavioral: simulate `shutdown()` → `installVoice()` → assert HUD voice subscriber still receives intents ## Source - Audit: `.planning/audit-2026-05-12/voice-audit.md` (2026-05-12) — finding P1-4
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KofTwentyTwo/Jarvis#35