fix(app): a lost worker drops a waiting wake word
A wake word said alone waited without a time limit once the speaker's next utterance started. If the worker connection ended meanwhile, that final never came and the restarted worker's utterances (numbered from 1 again) were joined to it, so a later sentence without a wake word was answered. The core now reports WorkerLost; the conversation drops waiting wake words and forgets utterances in progress then and on leave. An utterance in progress is tracked until its own final arrives instead of by comparing utterance numbers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -73,6 +73,9 @@ pub enum CoreEvent {
|
||||
Addressed { id: String, addressed: bool },
|
||||
/// The brain's answer to `rank()`: candidate ids, most important first (empty: failed).
|
||||
Ranked { id: String, order: Vec<String> },
|
||||
/// The voice worker connection ended: finals of utterances in progress will not come, and the
|
||||
/// restarted worker numbers utterances afresh.
|
||||
WorkerLost,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@@ -715,7 +718,10 @@ async fn worker_task(core: std::sync::Weak<Inner>, mut rx: mpsc::UnboundedReceiv
|
||||
core.inner.worker.chat_action_result(&a.id, result);
|
||||
});
|
||||
}
|
||||
WorkerEvent::Disconnected | WorkerEvent::Error(_) => {}
|
||||
WorkerEvent::Disconnected => {
|
||||
let _ = inner.events.send(CoreEvent::WorkerLost);
|
||||
}
|
||||
WorkerEvent::Error(_) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user