Soniox and simplismart STT detect a dead websocket and reconnect into it forever instead of failing over
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
Read the Soniox and simplismart STT receive loops in livekit-plugins-soniox/.../stt.py and livekit-plugins-simplismart/.../stt.py, then run the issue's half-open probe with soniox simplismart. Decide how detected silent reconnects should reach stt.FallbackAdapter; the issue lists three possible policies and leaves that choice open. Done when the selected behavior prevents silent infinite reconnects and is covered against the reproduced case.
索引モデルが issue の本文から書いたものです。
説明
Summary
The soniox and simplismart STT streams detect a half-open websocket correctly and then tell nobody. Both reconnect into the same dead state and repeat indefinitely, so stt.FallbackAdapter is never informed and the caller stays unheard for the rest of the call.
This is the third category that came out of extending @DEVJHAWAR11's probe in #7900 to all nineteen streaming STT plugins. #7900 covers the plugins that never notice at all. These two do notice — which is arguably worse, because the stream looks healthy the whole time.
Measured
A local server accepts the websocket upgrade and then sends nothing and answers no pings — a provider, or a NAT in between, that vanished without a FIN or an RST. Captured today against 3c6e65124:
217ms livekit.plugins.soniox Soniox Speech-to-Text API connection established!
46898ms livekit.plugins.soniox Soniox STT WebSocket error frame: ServerTimeoutError('No PONG received after 15.0 seconds')
46899ms livekit.plugins.soniox Soniox STT WebSocket closed; requesting reconnect
46906ms livekit.plugins.soniox Soniox Speech-to-Text API connection established!
Reconnected 8 ms after detecting the dead socket, into a server that is still silent, and round again every ~46.7 s for as long as the stream lives. Nothing is raised, so the watch expires with the stream still "running". simplismart does the same at ~50.6 s, logging simplismart connection lost.
The ~46.7 s is heartbeat=30.0 plus aiohttp's 15 s pong wait plus connect. Both plugins pass a heartbeat, which is why they detect it; three other plugins pass one and fail over correctly (smallestai 46.4 s, telnyx 46.9 s, deepgram 47.0 s), so detection is clearly not the missing piece.
Mechanism
soniox (livekit-plugins-soniox/.../stt.py)
The heartbeat's unanswered ping surfaces as WSMsgType.ERROR, which is logged and then breaks out of the receive loop without raising:
if msg.type == aiohttp.WSMsgType.ERROR: # L542
logger.warning("Soniox STT WebSocket error frame: %r", self._ws.exception())
break # L548
_recv_messages_task then returns normally and arms a reconnect on its way out (note this bypasses _request_reconnect, so it is not subject to that method's guards):
# Request reconnect if STT silently dies on WS drop.
if not self._reconnect_event.is_set(): # L686
logger.warning("Soniox STT WebSocket closed; requesting reconnect")
self._reconnect_event.set()
_run's while True at L345 sees wait_reconnect_task complete, clears the event, and calls _connect_ws() again. No exception ever leaves _run, so the base stt.SpeechStream never learns the stream failed.
simplismart (livekit-plugins-simplismart/.../stt.py) is the same shape in one place rather than two:
if msg.type == aiohttp.WSMsgType.ERROR: # L388
if self._session.closed:
return
logger.warning("simplismart connection lost: %r", ws.exception())
self._reconnect_event.set()
return
conn_options does not bound it
I expected max_retry=0 to cap this, and it does not. The retry budget belongs to the base class, and this reconnect is the plugin's own loop, so it is invisible to it. The probe runs with APIConnectOptions(max_retry=0, timeout=10) and soniox still reconnects indefinitely.
Why I am filing this rather than sending a patch
The correct behaviour is a judgement call I do not think belongs to a contributor:
- Bound the plugin's own reconnects — after N consecutive reconnects with no traffic received, raise so the base class and
FallbackAdaptercan act. - Treat a reconnect that produces no traffic as a failure — reconnecting is right once; reconnecting forever into silence is not.
- Leave it, and document that these two plugins do not fail over so nobody puts them behind a
FallbackAdapterexpecting they will.
Option 1 needs a number, and the ~46.7 s above is already nobody's considered choice — every plugin that passes a heartbeat passes 30.0. I would rather you pick than guess in a PR. Happy to implement whichever you want.
One scoping note in fairness to both plugins: this models a server that accepts connections and then goes silent — a load balancer in front of a dead backend, or a provider bug. Against a provider that has genuinely vanished the reconnect would fail and surface an error normally.
Reproducing
Probe, per-plugin construction table and raw results: https://github.com/Rehansanjay/livekit-stt-halfopen
# from a livekit/agents checkout with the workspace installed
uv run python probe/halfopen_probe.py soniox simplismart
- 主要言語
- Python
- スター
- 14.6k
- フォーク
- 3.9k
- 平均マージ
- 3日 19時間
- マージ済み PR(30日)
- 204
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
livekit/agents のほかの issue
-
Assistant markup is stripped from chat history when expressive mode is off対応中かも @ShivamSharma43 が 16 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
docs: openai.LLM vs openai.responses.LLM for HTTP OpenAI-compat hosts再び着手できるかも @AbarnaaSree が 56 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
livekit/agents#7022 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Python AgentServer health check (GET /) returns 200 before the worker has registered with LiveKit対応中かも @ninglinLiu が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
OpenAI Realtime engine: expose the WebSocket close code and reason to subclasses対応中かも @ninglinLiu が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
Project submission:オープン
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
slavakurilyak/awesome-ai-agents#845 ·
メンテナーはふだん 1 日以内に返信
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directory対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdifficulty:2 enhancement good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 92/100
MakazhanAlpamys/Soup#2178 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
scverse/rapids-singlecell#854 ·
メンテナーはふだん 1 日以内に返信
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGL対応中かも @ninglinLiu が今日担当しました。 オープンarea:frontend backend:slang bug direction:input
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 13 日以内に返信