fix(voice-loop): bound wake-word LISTENING startup with timeout - #915
fix(voice-loop): bound wake-word LISTENING startup with timeout#915RealDiligent wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughWake-word listener startup now terminates dropped child processes and bounds the wait for the ChangesWake-word listener lifecycle
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/genie-core/src/voice_loop.rs`:
- Around line 260-273: Update run_with_wakeword’s wake-word startup handling so
timeout, stdout read errors, and malformed readiness responses kill the child,
then sleep for the configured retry delay and continue the outer restart loop
instead of calling anyhow::bail!. Preserve the successful readiness path and
apply identical retry behavior to all three failure branches.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a1f90c56-0a48-4316-a64d-e0d318f48439
📒 Files selected for processing (1)
crates/genie-core/src/voice_loop.rs
| match tokio::time::timeout(WAKEWORD_READY_TIMEOUT, reader.read_line(&mut line)).await { | ||
| Ok(Ok(_)) => {} | ||
| Ok(Err(e)) => { | ||
| let _ = child.kill().await; | ||
| anyhow::bail!("wake word listener stdout error: {e}"); | ||
| } | ||
| Err(_) => { | ||
| let _ = child.kill().await; | ||
| anyhow::bail!( | ||
| "wake word listener timed out waiting for LISTENING after {}s", | ||
| WAKEWORD_READY_TIMEOUT.as_secs() | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Retry startup failures instead of exiting voice mode.
After killing the child, anyhow::bail! returns from run_with_wakeword; therefore the outer restart loop at Line 225 never spawns a replacement. A hung import/model load will stop voice mode rather than recover. Route timeout/read failures through the retry path (sleep and continue), and apply the same handling to the malformed readiness branch at Lines 274-278.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/genie-core/src/voice_loop.rs` around lines 260 - 273, Update
run_with_wakeword’s wake-word startup handling so timeout, stdout read errors,
and malformed readiness responses kill the child, then sleep for the configured
retry delay and continue the outer restart loop instead of calling
anyhow::bail!. Preserve the successful readiness path and apply identical retry
behavior to all three failure branches.
Part of GeniePod#617: run_with_wakeword waited forever on the first read_line for LISTENING, so a hung python3 import wedged voice-loop start. Add kill_on_drop and a 30s timeout that kills the child and returns an error so the outer restart loop can recover. Co-authored-by: Cursor <cursoragent@cursor.com>
Part of #617
Summary
Wake-word mode waited forever on the first
read_lineforLISTENING. A hungpython3import/model load wedges voice-loop start with no recovery.Root cause
run_with_wakewordspawned the wake-word script withoutkill_on_dropand awaitedLISTENINGwith no deadline.Fix
kill_on_drop(true)on the wake-word child.LISTENINGread in a 30stokio::time::timeout; on timeout kill the child and return an error so the outer restart loop can recover.Impact
A stuck wake-word Python process no longer blocks voice-loop startup indefinitely.
Test plan
cargo test— CI validation required.Real Behavior Proof
CI-only / static review on Windows dev host (genie-core does not fully compile on Windows). Verification is compile-time correctness plus full workspace CI on Linux.
Summary by CodeRabbit