feat(assemblyai): warn when audio stops flowing to the WebSocket#1
Closed
gsharp-aai wants to merge 1 commit into
Closed
Conversation
Complementary to the recv-silence warning: if frames are still being pushed to the socket but no messages arrive, the stall is downstream of this plugin. If frames have also stopped, the stall is upstream. Logging both makes the distinction visible from logs alone. Nested inside the existing 15s recv-silence check so the two warnings appear together when the recv loop goes quiet.
Author
|
Closing — livekit#5476 has merged upstream, so this is now moot. Re-opening as a fresh PR against livekit/agents:main. |
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
Extends the recv-silence warning with a symmetric send-side warning.
The recv-silence warning on its own can't distinguish "AssemblyAI is stalled" from "the plugin stopped receiving audio from upstream and is correctly silent." When a session appears wedged, both interpretations are on the table and the recv-side log alone can't separate them.
This adds the complementary check: inside the same 15s recv-silence block, if
_last_frame_sent_atis also >15s old, logAssemblyAI no audio frames sent for Ns session=<id>. The two absence-of-activity warnings appear back-to-back during a stall, giving an unambiguous diagnosis:Implementation
self._last_frame_sent_at: float | None = None, set on every successfulws.send_bytes(...)insend_task.recv_task, the existingif consecutive_timeouts % 3 == 0:block now also checks send-side idleness and logs the second warning when applicable._last_frame_sent_at is not Noneso it doesn't fire during the initial connect window before any audio has been sent.Impact
time.time()assignment per audio frame.Test plan
make format lint type-checkpassinput_chwhile keeping WS open): both warnings fire at 15s, 30s, 45s