fix(voice): clear false-interruption timer on interim/preflight - #7199
Open
devtechedge wants to merge 1 commit into
Open
fix(voice): clear false-interruption timer on interim/preflight#7199devtechedge wants to merge 1 commit into
devtechedge wants to merge 1 commit into
Conversation
PREFLIGHT_TRANSCRIPT and INTERIM_TRANSCRIPT are routed through on_interim_transcript. With VAD present, a mid-utterance pause armed the false-interruption timer on end_of_speech, but later STT interim or preflight events did not clear it, so the agent resumed and the user's partial transcript was lost (notably with Deepgram Flux). Cancel the timer when non-empty interim/preflight arrives while speech is paused, and re-arm only when speaking has already ended. Fixes livekit#7198.
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.
Summary
Fixes #7198.
With VAD present, a mid-utterance pause arms the false-interruption timer on
end_of_speech.PREFLIGHT_TRANSCRIPT/INTERIM_TRANSCRIPT(both routed throughon_interim_transcript) did not clear that timer when VAD was configured, so the agent could resume before the turn committed and the user's partial transcript was lost (reproduced with Deepgram Flux).This change cancels the false-interruption timer when a non-empty interim/preflight arrives while speech is paused, and re-arms only when
speaking is False(same re-arm rule the VAD-less path already used).Changes
livekit-agents/livekit/agents/voice/agent_activity.py: clear (and conditionally re-arm) the timer inon_interim_transcriptfor both VAD and VAD-less pathstests/test_false_interruption_resume.py: regression coverage for interim while speaking, interim re-arm after EOS, and preflight clearTest plan
uv run pytest tests/test_false_interruption_resume.py -x -q(12 passed)ruff check/ruff formaton touched filesNotes
AI-assisted implementation. Happy to adjust if maintainers prefer clear-only (no re-arm) for the VAD path.