Skip to content

fix(voice): reset realtime agent state without audio output - #7869

Merged
longcw merged 3 commits into
livekit:mainfrom
Luke-salinero:codex/fix-realtime-text-agent-state
Oct 21, 2026
Merged

longcw merged 3 commits into
livekit:mainfrom
Luke-salinero:codex/fix-realtime-text-agent-state

Conversation

@Luke-salinero

@Luke-salinero Luke-salinero commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #7866.

Realtime text replies could leave the agent in speaking, keep audio recognition in its speaking interval, and leave VAD interruption disabled when audio output was missing or disabled.

Run the existing state reset, recognition end hook, and interruption reset independently of audio output, preserving the interruption-enabled check and background-speech thinking state. Remove the duplicate interrupted-span assignment.

Regression tests cover returning to listening, delivering the next user transcript without an interruption verdict, and interrupting a subsequent pending reply through VAD, with missing or disabled audio output.

Validation

The two new VAD regression cases fail on the previous PR head and pass with this correction. All 205 selected realtime/interruption tests pass, along with repository lint and formatting, core type checking across 229 source files, and wheel/source-package builds.

Full-repository tests and all-plugin type checking remain unverified because optional dependencies are missing locally. No live-provider calls were made.

@Luke-salinero
Luke-salinero requested a review from a team as a code owner October 16, 2026 06:06
devin-ai-integration[bot]

This comment was marked as resolved.

self._session._update_agent_state(
"thinking" if self._background_speeches else "listening"
)
self._on_end_of_agent_speech(ended_at=time.time())

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.

One more line needs to move too. The start of every realtime reply calls _disable_vad_interruption_soon() with or without audio output, so interruption_by_audio_activity_enabled turns off. Re-enable it with no condition, the same as _on_pipeline_reply_done does. If it stays behind if audio_output is not None:, a session with audio input and text output loses VAD interruption after its first reply.

With that, the remaining ATTR_SPEECH_INTERRUPTED line in the guard repeats the one just above it, so the if audio_output is not None: block can be removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the PR with the fix. Thank you for the correction!

@longcw
longcw merged commit ccec139 into livekit:main Oct 21, 2026
16 checks passed
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.

Gemini Live: agent stays "speaking" without audio output

2 participants