Transcript Duplication

We’ve noticed another issue where the same user utterance is being repeated multiple times. I’m attaching the recording/link below for your reference.

Support info (this helps us to help you faster)

Sent from URL: https://cloud.livekit.io/projects/p_7hoiye4mqae/sessions/RM_L4HDz9SgM2mv/observability

  1. Verified root cause (traced into the installed livekit-agents SDK, not application code): in .venv/Lib/site-packages/livekit/agents/voice/audio_recognition.py, every end-of-turn candidate signal (VAD end-of-speech, STT final transcript, or the streaming turn-detector’s own prediction) calls _run_eou_detection() (lines 1401-1692), which cancels any in-flight _end_of_turn_task and starts a new _bounce_eou_task that eventually calls self._hooks.on_end_of_turn(…) (line 1626). asyncio.Task.cancel() is cooperative — it only takes effect at the task’s next await. If a second trigger fires while an earlier _bounce_eou_task has already progressed past its last cancellation checkpoint (into the synchronous tail that calls on_end_of_turn), cancellation is a no-op and both tasks reach on_end_of_turn. In agent_activity.py, _user_turn_completed_task (line ~2271) builds a fresh llm.ChatMessage from self._audio_transcript every time it’s invoked and commits it to the real AgentSession chat context — so two independent commits land for one utterance, each capturing the transcript text as it existed in that task’s execution window (one from an earlier/less-formatted STT pass, one from the fully finalized/formatted pass) — producing exactly the title-case-vs-lowercase duplicate pairs seen in the logs.

I see, is this with the latest version of LiveKit agents? And do you see this issue frequently?

I see this particular session has multiple duplicated transcripts. There’s something funny with your STT there and I also see that the fallbackadapter - are you able to reproduce this?