Repository navigation
fix(gradium): keep the TTS socket alive while the text source stalls (3/4) #7817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
33a720a
fix(gradium): raise on TTS error frames and unexpected socket close
hhugo-gradium c4aab95
fix(gradium): surface websocket transport errors on TTS streams
hhugo-gradium a6cebe6
test(gradium): cover TTS error frames, close codes and transport errors
hhugo-gradium a7f6d2e
fix(gradium): keep retrying on a 1008 close, it covers the concurrenc…
hhugo-gradium e47b44a
fix(gradium): do not retry a one-shot synthesis once audio went out
hhugo-gradium 1bd94e1
fix(gradium): put the server's close reason in the TTS error message
hhugo-gradium 6f4a342
fix(gradium): let the base class retry a one-shot synthesis after par…
hhugo-gradium 08b2069
fix(gradium): keep the TTS socket alive while the text source stalls
hhugo-gradium File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Partial speech repeats after retry
When Gradium fails after sending audio,
ChunkedStreamretries the entire text and plays its beginning again. The voice pipeline forwards frames without checking their request IDs.Learn more
A chunked TTS request sends its whole text in one WebSocket session. Once
AudioEmitterhas forwarded audio, the base retry loop closes the old emitter but cannot retract its frames; a retry opens a new session and synthesizes the whole text again. The voice pipeline forwards frames as they arrive, without using the fresh request ID to invalidate audio from the earlier attempt. The stream adapter also forwards both attempts' frames unchanged.Example: Gradium sends 0.5 seconds of "hello world" and then closes with code 1011. The retry succeeds, so the listener hears the first 0.5 seconds twice before the rest of the sentence.
Recommended fix: Prevent retries after audio has been emitted from this one-shot stream, unless downstream playback can explicitly discard frames from an earlier request ID. Add an assertion on the actual sequence of emitted audio, not only the number of WebSocket connections.
Was this helpful? React with 👍 or 👎 to provide feedback.