Skip to content

fix(soniox): sentence-buffer tts input, rotate streams on idle and age#6434

Open
chenghao-mou wants to merge 2 commits into
mainfrom
chenghao/fix/AGT-3049-soniox-tts-stream-timeout
Open

fix(soniox): sentence-buffer tts input, rotate streams on idle and age#6434
chenghao-mou wants to merge 2 commits into
mainfrom
chenghao/fix/AGT-3049-soniox-tts-stream-timeout

Conversation

@chenghao-mou

@chenghao-mou chenghao-mou commented Jul 15, 2026

Copy link
Copy Markdown
Member

Fixes AGT-3049 (408s breaking the stream mid-reply) and #6225; also covers the FlushSentinel exposure from #6425 / AGT-3132. Concurrent with #6430 by @mqasim41, whose idle-rotation work, observed ~8-18s per-stream timeout data, and test approach are incorporated here with co-author credit.

Why: Soniox times out streams left waiting on slow LLM output (observed ~8-18s, plus a fixed 2-minute per-stream cap), cutting speech mid-reply.

What: LLM chunks are buffered into complete sentences (blingfire, overridable) and fed into one shared stream so prosody stays continuous. If no sentence arrives for stream_idle_timeout (default 5s, must be >0, reconfigurable via update_options), the stream is finalized with text_end before the server can time it out; the next sentence opens a fresh stream. Streams also rotate at a sentence boundary near the 2-minute cap, and a stream that fails before emitting any audio replays its sentence batch on a new stream_id (the framework never retries once audio reached the user). FlushSentinel now flushes the sentence buffer instead of being dropped.

Tests: pytest tests/test_plugin_soniox_tts.py --plugin soniox (fake connection + virtual time: steady flow, idle rotation, batch replay, validation).

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@chenghao-mou chenghao-mou requested a review from a team as a code owner July 15, 2026 11:03

@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 potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

…add plugin tests

Adopts hardening from the concurrent #6430: timeout validation, live
reconfiguration via update_options, committed plugin tests, and the
observed ~8-18s per-stream timeout data point (#6225).

Co-Authored-By: Muhammad Qasim <mqasim.bese21seecs@seecs.edu.pk>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants