demo: reset stale mimi streaming state before generation - #33
Open
abePclWaseda wants to merge 1 commit into
Open
demo: reset stale mimi streaming state before generation#33abePclWaseda wants to merge 1 commit into
abePclWaseda wants to merge 1 commit into
Conversation
If a turn is interrupted mid-generation (observed with fastrtc's 60-second frame processing timeout when the demo is served behind a tunnel/TURN relay), the mimi streaming context stays open. The next chat_producer call then raises "AssertionError: is already streaming!" in its worker thread, and every turn after that fails silently, so the chat appears to hang after the first response. Reset the stale streaming state at the start of chat_producer so a single interrupted turn cannot wedge the whole session. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Symptom
When running
liquid-audio-demobehind a tunnel/TURN relay, the chat would respond to the first utterance and then hang forever: no reaction to any later turn, no error in the UI.Root cause
chat_produceropensmimi.streaming(1)for each generation. If a turn is interrupted mid-generation — we hit this reproducibly via fastrtc's hardcoded 60-second frame-processing timeout (Timeout in frame processing cycle after 60 seconds - resetting) — the streaming context is left open. The nextchat_producercall then dies in its worker thread with:Since the exception happens in a background thread, the consumer in
chat_responseblocks on the queue forever and every subsequent turn fails silently, which makes the whole session look frozen.Fix
Reset stale streaming state at the start of
chat_producer(mimi exposesis_streaming/reset_streaming()for exactly this), so a single interrupted turn cannot wedge the session.Testing
add_audio→generate_interleaved→chat.append→ next turn) for 3 consecutive turns with this guard in place on an A100, including with LFM2.5-Audio-1.5B-JP.is already streaming!traceback above and froze the demo; after the patch the next turn recovers.ruff check/ruff format --checkpass.