Repository navigation
fix(cli): drain TcpAudioOutput resampler on flush, skip empty flushes, and report pause=False - #8767
Open
yaosongding wants to merge 1 commit into
Open
yaosongding wants to merge 1 commit into
yaosongding wants to merge 1 commit into
Conversation
…, and report pause=False
yaosongding
marked this pull request as ready for review
November 25, 2026 00:45
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 3 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
flush()and reset filter state onclear_buffer():TcpAudioOutputresamples 24 kHz agent audio to 48 kHz viartc.AudioResampler, which buffers ~30–40 ms internally.flush()previously sentAudioPlaybackFlushwithout callingself._resampler.flush(), clipping utterance tails and dropping short (< ~35 ms) segments to zero wire frames;clear_buffer()also left stale samples inside the resampler filter andflush()unconditionally cleared_interrupted_eveven ifclear_buffer()had already fired. Drainself._resampler.flush()beforeAudioPlaybackFlushwhen not interrupted, recreate the resampler inclear_buffer(), and reset_playout_done/_interrupted_evat segment boundaries instead of insideflush().AudioPlaybackFlushon empty segments:_audio_forwarding_taskalways callsaudio_output.flush()infinallyeven when zero frames were captured. Sending an unconditionalAudioPlaybackFlushon an empty segment causes the Go CLI broker to immediately reply withAudioPlaybackFinished, which can resolve the next utterance'swait_for_playout()prematurely. Return early inflush()whennot self._pushed_duration.AudioOutputCapabilities(pause=False):TcpAudioOutputadvertisedpause=Truewithout implementingpause()/resume()(and theConsoleIOwire protocol has no pause/resume messages), causingresume_false_interruptionto call a no-oppause()and transition agent state to"listening"while the CLI broker kept playing buffered audio. Align withQueueAudioOutputandDataStreamAudioOutputby reportingpause=False.Test plan
uv run pytest tests/test_cli.py tests/test_session_host.py tests/test_remote_session.py --unit(coverscan_pause, resampler tail draining, empty-flush wire suppression,clear_buffer()before/afterflush(), and loopback TCPTcpAudioOutput -> TcpSessionTransport -> SessionHostintegration)uv run ruff checkanduv run ruff format --checkon touched filesmypystrict type check onlivekit.agents.cli.tcp_consoleandtests/test_cli.py