Skip to content

fix: keep VAD from cancelling a manually committed user turn - #7011

Open
vignesh-koruverse wants to merge 1 commit into
livekit:mainfrom
vignesh-koruverse:manual-commit-vad-cancel
Open

fix: keep VAD from cancelling a manually committed user turn#7011
vignesh-koruverse wants to merge 1 commit into
livekit:mainfrom
vignesh-koruverse:manual-commit-vad-cancel

Conversation

@vignesh-koruverse

Copy link
Copy Markdown

Fixes #7010.

Summary

  • In manual turn detection, VAD START_OF_SPEECH no longer cancels the pending end-of-turn task. An eou task in manual mode always belongs to a turn the application already committed.
  • A cancelled eou task now resets the turn-scoped flags via a done callback, unless a newer task superseded it. Stranded, _user_turn_committed makes _on_stt_event discard every later transcript until the next commit.
  • Add regression tests for both behaviors and for supersession safety.

Why

commit_user_turn() resolves after scheduling the end-of-turn bounce, which sleeps the endpointing delay before delivery. Audio tail around a push-to-talk release can raise START_OF_SPEECH inside that window. The cancel is silent: no reply, no log, and the skipped cleanup leaves the session discarding all later transcripts. Same cancellation-poisoning class as #6913 and #6897.

Testing

  • pytest tests/test_audio_recognition_turn_detection.py --audio_eot -q: the two behavior tests fail without the fix and pass with it
  • ruff check and ruff format --check on both changed files
  • mypy -p livekit.agents.voice.audio_recognition: clean

@vignesh-koruverse
vignesh-koruverse requested a review from a team as a code owner August 27, 2026 10:17
@CLAassistant

CLAassistant commented Aug 27, 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: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

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.

Manual mode: VAD START_OF_SPEECH cancels a committed user turn and strands _user_turn_committed

2 participants