Skip to content

fix(soniox): mark connection non-current on 408 timeout#6251

Open
C1-BA-B1-F3 wants to merge 2 commits into
livekit:mainfrom
C1-BA-B1-F3:fix/soniox-tts-408-timeout
Open

fix(soniox): mark connection non-current on 408 timeout#6251
C1-BA-B1-F3 wants to merge 2 commits into
livekit:mainfrom
C1-BA-B1-F3:fix/soniox-tts-408-timeout

Conversation

@C1-BA-B1-F3

Copy link
Copy Markdown

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 an APIStatusError with 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 via connection.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 catch APIStatusError specifically and mark connection non-current on 408.

Testing

  • Syntax verified with python3 -m py_compile
  • The fix follows the same pattern used by other plugins (ElevenLabs, OpenAI) where connection-level errors trigger fresh connection creation on retry

C1-BA-B1-F3 and others added 2 commits June 26, 2026 22:31
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
@C1-BA-B1-F3 C1-BA-B1-F3 requested a review from a team as a code owner June 26, 2026 14:43

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Soniox TTS throws 408 timeout and breaks the stream

1 participant