Repository navigation
fix(speech): wait for the new STT to be ready before replaying - #303
Merged
Merged
Conversation
…the replay flag on a late final SttProvider gains wait_ready; the cluster STT reports readiness from its stream task. release_stt_hold and replay_last_utterance wait for it (SPEECH_STT_READY_WAIT_MS, default 15 s) before feeding audio. A replay final that arrives after the release returned keeps replay=true for up to 15 s. Denied stream opens are logged once, then every 5 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
With a speech backend that rejects new streams for about 30 s after it starts, a host that swaps the STT and calls
releaseSttHold({ replay: true })(orreplayLastUtterance()) saw the replay stall in finalize and end with no final. When the stream finally opened, the queued audio was transcribed and the final came out as a plainuser_speech_final, so hosts treated it as a new utterance.Cause
The replay fed the held audio into the new STT before its stream was open. The single finalize wait (2 s) expired, the release completed without a final, and the replay context was gone by the time the late final arrived.
Change
SttProvider::wait_ready(timeout)(default: always ready). The cluster STT shares a readiness signal between its stream task and the provider: true onReady, false on every (re)open and when the task exits.release_stt_holdandreplay_last_utterancewait up toSPEECH_STT_READY_WAIT_MS(default 15000) before feeding audio. On timeout they log and replay anyway.release_stt_holdgets no final, the replay context stays armed so a late final is still flaggedreplay: true. A context older than 15 s is dropped, so a lost replay cannot mislabel a later utterance.Tests
held_replay_waits_for_stt_ready,replay_ready_wait_times_out_and_continues,late_final_after_held_replay_is_flagged_replay,stale_replay_context_does_not_flag_later_utterance(speech crate).Verified locally and via CI; no extra manual steps.
🤖 Generated with Claude Code