You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
xai STT: a silently dropped WebSocket is never detected #7363
On a half-open connection (no FIN, no RST) the xAI STT SpeechStream sits on a dead socket forever: the session stays open, no transcripts arrive, and nothing is ever logged. Same class of bug as #7206 (Deepgram v1), #7356 (Soniox) and #7358 (Telnyx), still present in livekit-plugins-xai.
_connect_ws opens the socket without heartbeat, so recv_task parks on ws.receive() and the retry in _main_task, which only runs when something raises, never gets a turn. There is no keepalive task in this plugin, so nothing else touches the socket when audio stops. And when a heartbeat is on, the resulting WSMsgType.ERROR hits the "unexpected xAI message type" branch and is stepped over; the loop only ends because a CLOSED follows, raised as a generic "closed unexpectedly" with the actual reason from ws.exception() dropped.
Expected Behavior
The dropped connection is detected within the heartbeat window and _main_task reconnects, with the reason attached to the error it logs.
Reproduction Steps
Point XAI_WEBSOCKET_URL at a local aiohttp WebSocket server with autoping=False that sends transcript.created on connect, answers audio frames with transcript.done messages for 10s, and then stops reading, stops writing, and stops answering pings while keeping the TCP socket open. Run a real xai.STT stream pushing 20ms silence frames for 120s.
On main: last transcript at 9.2s, no warning or error logged for the remaining 110s, one socket for the whole run.
Versions
livekit-agents 1.8.2, livekit-plugins-xai at main (e5024c7), aiohttp 3.14.3, Python 3.13, macOS.
Activity