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:
javis-bot
2026-11-12 10:13:10 +09:00
parent 5507ec9b71
commit 1bebc1c531
4 changed files with 48 additions and 6 deletions

View File

@@ -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(_) => {}
}
}
}