voice: tolerate the wake-tail pause; harden the front end
Endpointing fix. The wake detector usually fires inside the wake phrase, so the first speech captured after it is the phrase's tail (plus the cue beep echoing back through the mic), not the command. A fixed 500 ms trailing-silence endpoint then ended the capture during the natural pause before the command: the utterance held 240-400 ms of speech and STT returned empty. In a recorded session 18 of 30 wakes dropped the command that way (only 10 transcribed). The endpoint now uses a longer silence tolerance (vad.initial_silence_ms, default 1500) until vad.min_command_ms (default 700) of speech is in hand, then reverts to vad.silence_ms, so a pause before the command is tolerated while a real command still ends promptly. Front-end hardening (the ways it was silently dying or losing work): - Utterances run on a worker thread, not the audio thread, and a task error is traced and spoken rather than propagated, so one bad command cannot stop the mic or take the front end down. - Capture-stream watchdog: read with a timeout and close/reopen the input after a sustained stall, so a wedged PortAudio/ALSA callback recovers instead of hanging the gateway (traced voice_stream_stalled/reopened). - faulthandler enabled (CLI + unit) so a fatal signal dumps every thread's stack to the journal. - The scheduler's answer-side entry points (answer, answer_question, resolve_repair, answer_approval) are guarded like submit_request: an EngineUnavailable is fatal-and-reported and any other resume/repair error returns a reply instead of propagating into a front end.
This commit is contained in:
1 parent
e86ed805ee
commit
f6ef66b532
9 files changed
+391
-33
No files matched your search
@@ -1149,8 +1149,22 @@ CLI, unit tests (24) + integration tests (2).
|
||||
so physical access is the authorization; a single configured `chat_id`
|
||||
identifies the session and `home_channel` defaults to it so background
|
||||
notifications (timers, repair offers) are spoken too. `run(on_inbound,
|
||||
outbound)` starts an outbound-pump thread (`OutboundMessage` → `speak`) and
|
||||
blocks in the mic loop. **Half-duplex**: capture frames are discarded while a
|
||||
outbound)` starts an outbound-pump thread (`OutboundMessage` → `speak`) and an
|
||||
**inbound-worker thread**, and blocks in the mic loop. Utterances are handed to
|
||||
the worker, not run on the audio thread: the scheduler is synchronous and can
|
||||
block on the decision engine, so a slow task must not stop the mic being read,
|
||||
and the worker traces + speaks a task error instead of letting it kill the
|
||||
front end. **Capture-stream watchdog**: `_read_frame` reads with
|
||||
`audio.read_timeout_s`; when the stream stalls continuously for
|
||||
`audio.stall_timeout_s` (a wedged PortAudio/ALSA callback that never delivers
|
||||
another frame) it traces `voice_stream_stalled` and closes/reopens the input
|
||||
(`voice_stream_reopened`), so the loop recovers instead of blocking forever.
|
||||
**Endpointing tolerates the wake tail**: the wake detector can fire inside the
|
||||
wake phrase and the cue beep follows, so the first speech captured is the
|
||||
phrase's tail, not the command — until `vad.min_command_ms` of speech is in
|
||||
hand the trailing-silence endpoint uses `vad.initial_silence_ms`, so a natural
|
||||
pause before the command does not end the capture (then `vad.silence_ms`).
|
||||
**Half-duplex**: capture frames are discarded while a
|
||||
reply is speaking, so the agent never transcribes itself (no barge-in yet);
|
||||
after a reply a `follow_up_window_s` accepts the next utterance without the
|
||||
wake word, so answering a question is conversational. `max_speak_chars`
|
||||
@@ -1180,7 +1194,10 @@ CLI, unit tests (24) + integration tests (2).
|
||||
ownership across an updated request so its completion still routes home. A
|
||||
`needs_input` pause sets `pending_owner` from the pending run's source; the
|
||||
same chat's next message goes straight to `Scheduler.answer` (no
|
||||
queue/navigation). A *different* chat — **including a chat on another
|
||||
queue/navigation). The answer-side entry points (`answer`, `answer_question`,
|
||||
`resolve_repair`, `answer_approval`) are guarded like `submit_request`: an
|
||||
`EngineUnavailable` is fatal-and-reported and any other error returns a reply,
|
||||
so a resume/repair failure never propagates into a front end. A *different* chat — **including a chat on another
|
||||
platform** — during that pause is told to wait: the single-slot scheduler must
|
||||
not silently abandon the first chat's run, and one service fronts all
|
||||
adapters so the guard spans them. A background poll calls
|
||||
|
||||
Reference in new issue
Block a user