fix: keep session audio flowing after STT/VAD close and handoff - #7005
Open
samvallad33 wants to merge 3 commits into
Open
fix: keep session audio flowing after STT/VAD close and handoff#7005samvallad33 wants to merge 3 commits into
samvallad33 wants to merge 3 commits into
Conversation
RoomIO keyed the mic stream on publication SID, so a replacement track under the same publication left the session attached to a dead AudioStream. A closed STT/VAD channel also raised out of _push_audio and killed the session audio pump, and a reused STT pipeline with a finished pump stayed attached after activity handoff.
samvallad33
force-pushed
the
fix/agents-6919-audio-routing-freeze
branch
from
August 27, 2026 06:38
523bf4c to
67d051f
Compare
Track identity on publication SID is already handled there. Keep the STT/VAD pump and handoff recovery for the session freeze.
samvallad33
force-pushed
the
fix/agents-6919-audio-routing-freeze
branch
from
August 27, 2026 06:38
67d051f to
2334781
Compare
Frames arrive every 10ms, so a persistent push failure logged a traceback per frame. Log once per run of the same error type instead.
samvallad33
marked this pull request as ready for review
August 28, 2026 01:24
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.
Mid-call, user audio can stop reaching STT/VAD while RoomIO is still subscribed.
user_statesticks onlistening._push_audiofans out withsend_nowait;ChanClosedon one STT or VAD channel killed_forward_audio_taskand stopped pulling RoomIO. A reused_STTPipelinewhose pump had already exited stayed attached after activity handoff, so later turns never reached STT.Isolate
ChanClosedper fan-out target so one dead consumer cannot kill the session pump. Keep_forward_audio_taskrunning ifpush_audioraises. Rebind the STT node at activity detach; replace a reused pipeline when its pump is already done; recreate the STT stream if it ends whileaudio_chis still open.RoomIO publication-SID identity is #6744 (approved). This PR does not change
_input.py.Related to #6919. Not marking
Fixes: the live outbound-SIP freeze was not reproduced end-to-end.uv run pytest tests/test_audio_recognition_push_audio.py tests/test_audio_recognition_handoff.py tests/test_agent_session.py::test_stt_pipeline_recreates_after_clean_stream_end tests/test_agent_session.py::test_stt_pipeline_recreates_stream_after_unrecoverable_error tests/test_agent_session.py::test_stt_pipeline_does_not_recreate_on_non_connection_error tests/test_agent_session.py::test_stt_pipeline_does_not_recreate_stream_while_closing tests/test_agent_session.py::test_stt_pipeline_recreation_uses_rebound_node --unitVideo forwarding is left alone:
_forward_video_taskhas the same shape, but this PR is scoped to the audio path the issue describes.