Skip to content

fix(voice): clear the stale user turn when resuming a false interruption - #7067

Open
saime428 wants to merge 1 commit into
livekit:mainfrom
saime428:fix/false-interruption-stale-user-turn
Open

fix(voice): clear the stale user turn when resuming a false interruption#7067
saime428 wants to merge 1 commit into
livekit:mainfrom
saime428:fix/false-interruption-stale-user-turn

Conversation

@saime428

Copy link
Copy Markdown

Fixes #7063

When a false interruption is confirmed and the paused agent speech resumes, _on_false_interruption never discards the recognition turn that triggered the pause. For a VAD-only turn (nothing committed by STT) that means _speech_start_time survives the resume. AudioRecognition only sets that anchor while it is None, so the next real utterance inherits the old one, and the committed ChatMessage ends up with a started_speaking_at from before the agent even resumed speaking. Sorting a transcript by timestamp then puts the user line in the wrong place. The issue saw a 12 second offset in production.

The change calls _clear_user_turn() at the top of the resume branch, before agent speech restarts. That is the same discard path the public clear_user_turn() API uses, so the dropped turn's transcript buffer, timing anchors and turn tracker all go together. Two cases that might look risky are fine: the resume callback cannot fire while the user is talking, because a new START_OF_SPEECH cancels the false-interruption timer, and a committed turn cancels the timer on its own path before the callback ever runs.

Added test_resume_discards_the_stale_recognition_turn to the existing false-interruption suite. It fails on main and passes here.

Tested with uv run pytest tests/test_false_interruption_resume.py --unit (10 passed) and the full uv run pytest --unit gate (1901 passed, no new failures compared to main). make check is clean apart from a pre-existing mypy complaint about the missing boto3 stub in the aws plugin.

@saime428
saime428 requested a review from a team as a code owner August 31, 2026 16:50
@CLAassistant

CLAassistant commented Aug 31, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False interruption keeps stale started_speaking_at for next user turn

2 participants