fix(soniox): mark connection non-current on 408 timeout#6251
Open
C1-BA-B1-F3 wants to merge 2 commits into
Open
fix(soniox): mark connection non-current on 408 timeout#6251C1-BA-B1-F3 wants to merge 2 commits into
C1-BA-B1-F3 wants to merge 2 commits into
Conversation
Nova Sonic 2 API rejects sessionStart when endpointingSensitivity is placed at the top level. It must be nested under an 'endpointing' key. Fixes livekit#6200 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When a Soniox TTS stream receives a 408 timeout error, the connection may be in a degraded state. Previously, the framework retry would reuse the same connection and keep hitting 408 until all retries were exhausted. Now, when a 408 error occurs, we mark the connection as non-current so the next retry creates a fresh connection instead. Fixes livekit#6225
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.
Problem
When using Soniox TTS, 408 timeout errors break the audio stream. The issue is that when a 408 timeout occurs, the connection may be in a degraded state, but the framework retry reuses the same connection and keeps hitting 408 until all retries are exhausted.
Fixes #6225
Root Cause
In
SynthesizeStream._run(), when the waiter future raises anAPIStatusErrorwith status 408, the error is re-raised to the framework's retry logic. The framework retries, but_current_connection()returns the same connection (still marked "current"), and if the connection is degraded, the retry fails again with 408.Fix
When a 408 timeout error occurs in
SynthesizeStream._run(), mark the connection as non-current viaconnection.mark_non_current(). This ensures the next retry creates a fresh connection instead of reusing the potentially degraded one.Changes
livekit-plugins/livekit-plugins-soniox/livekit/plugins/soniox/tts.py: Added 5 lines to catchAPIStatusErrorspecifically and mark connection non-current on 408.Testing
python3 -m py_compile