Skip to content

fix(stt): preserve provider speech end timing - #6748

Open
swayamg20 wants to merge 1 commit into
livekit:mainfrom
swayamg20:fix/6726-stt-speech-end-time
Open

fix(stt): preserve provider speech end timing#6748
swayamg20 wants to merge 1 commit into
livekit:mainfrom
swayamg20:fix/6726-stt-speech-end-time

Conversation

@swayamg20

Copy link
Copy Markdown
Contributor

Summary

  • add a provider-neutral wall-clock speech_end_time to SpeechEvent
  • prefer that timestamp when STT-driven endpointing derives the last speaking time
  • populate it for Deepgram Flux from final-word timing and re-anchor timestamps after reconnects

Why

Flux emits a final transcript followed by a bare END_OF_SPEECH event. Without an explicit VAD, that bare event previously replaced the speech-end timestamp with signal-arrival time, so min_delay used a different starting point depending on VAD configuration. Carrying the actual final-word time preserves the intended last-speaking-time semantics.

Testing

  • make check (format, Ruff, and mypy across 632 source files)
  • uv run pytest tests/test_agent_session.py --unit --no-concurrent -q (81 passed)
  • uv run pytest tests/test_plugin_deepgram_stt.py --plugin deepgram --no-concurrent -q (14 passed)
  • broader unit run: 1,845 passed and 5 skipped; 9 room-test setup errors require the unavailable local livekit-server binary

Closes #6726

@swayamg20
swayamg20 requested a review from a team as a code owner August 7, 2026 16:22

@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 potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in 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.

turn_detection="stt": min_delay is measured from a different point in time when a VAD is explicitly configured

1 participant