Skip to content

fix(meta): set heartbeat for Muse STT websocket - #2523

Open
rosetta-livekit-bot[bot] wants to merge 1 commit into
mainfrom
neuroses-visually-habit
Open

rosetta-livekit-bot[bot] wants to merge 1 commit into
mainfrom
neuroses-visually-habit

Conversation

@rosetta-livekit-bot

@rosetta-livekit-bot rosetta-livekit-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Ports livekit/agents#7315 to the Meta Muse STT plugin.

Adds a 30-second websocket heartbeat with a pong deadline so half-open connections surface through the existing retry/error path instead of stalling indefinitely.

Verification

  • pnpm test plugins/meta (49 passed)
  • pnpm build (40 packages built)
  • pnpm --filter @livekit/agents-plugin-meta typecheck
  • pnpm exec prettier --check plugins/meta/src/stt.ts .changeset/meta-muse-websocket-heartbeat.md
  • pnpm lint attempted; repository-wide lint currently fails on pre-existing formatting errors across 45 files. The only Meta-package failure is the unchanged union declaration at plugins/meta/src/stt.test.ts:36; changed lines pass lint/format checks.
Source diff coverage
  • livekit-plugins/livekit-plugins-meta/livekit/plugins/meta/stt.py: adapted to plugins/meta/src/stt.ts. Python aiohttp accepts a heartbeat in seconds; the JS ws client has no native equivalent, so this ports 30.0 seconds as 30_000 ms and adds ping/pong timeout lifecycle infrastructure while preserving the existing retry/error path.
  • tests/test_meta_stt.py: adapted to plugins/meta/src/stt.test.ts. Added the source assertion’s equivalent to the existing Muse handshake/connection contract test, verifying the factory receives the 30-second heartbeat value.

Ported from livekit/agents#7315

Original PR description

_connect_ws opened the WebSocket without a heartbeat, so nothing probed
the connection. A silently dropped socket (half-open TCP, no FIN/RST — routine
behind NAT idle timeouts and load balancers) left _receive_events parked on
ws.receive() forever: recovery here is exception-driven, so with no exception
there was no reconnect. conn_options.timeout doesn't cover this — it guards
only the handshake and the post-end_input drain, not steady streaming.

Detection fell back to TCP retransmit exhaustion: ~15 min with default
tcp_retries2=15 while audio flows, and never while audio is idle
(mic disabled/unpublished), since there are no writes to fail.

Sets heartbeat=30.0, matching Deepgram (deepgram/stt.py:797, stt_v2.py:628)
and the repo-wide convention. No new handling needed: an aiohttp heartbeat
timeout surfaces as WSMsgType.ERROR, which _receive_events already turns into
APIConnectionError(retryable=not self._audio_consumed) — a reconnect before
audio is consumed, and a fast session-level failure after, instead of a
multi-minute stall.

Test: test_handshake_precedes_audio_and_matches_contract already inspects the
ws_connect kwargs, so the assertion goes there.

@rosetta-livekit-bot
rosetta-livekit-bot Bot requested a review from a team as a code owner September 17, 2026 19:01
@changeset-bot

changeset-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b55d0f5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 39 packages
Name Type
@livekit/agents-plugin-meta Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-anthropic Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-azure Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-did Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-fishaudio Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-hume Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-krisp Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-liveavatar Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-minimax Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-mistralai Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-perplexity Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-protoface Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-runway Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-soniox Patch
@livekit/agents-plugin-tavus Patch
@livekit/agents-plugins-test Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@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.

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.

0 participants