Skip to content

VAD gate keepalive interval too long — risks DG 1011 disconnect #5234

Closed

Description

@beastoin

Problem

The VAD gate's KeepAlive interval is set to 20 seconds (VAD_GATE_KEEPALIVE_SEC = 20 in backend/utils/stt/vad_gate.py:41), but Deepgram's idle timeout is 10 seconds (not 30s as originally assumed).

If no audio or KeepAlive is sent within 10 seconds, DG closes the WebSocket with error code 1011 (NET-0001).

Impact

  • Users WITHOUT speech profile in quiet environments: gate starts in active mode, classifies initial silence, sends nothing to DG for 10+ seconds → DG disconnects
  • Users WITH speech profile: not affected (gate starts in shadow mode, sends all audio for first ~15-25s)
  • Currently mitigated by most users having speech profiles, but this is a latent bug

Root Cause

Code comment at line 717 says "Prevent DG 30s idle timeout" — the 30s assumption was wrong. DG docs specify 10s timeout and recommend KeepAlive every 3-5 seconds.

Acceptance Criteria

  • KeepAlive interval reduced to match DG's 10s timeout (recommended: 5s)
  • Reproduce the 1011 error with the current 20s interval before fixing
  • Verify the fix prevents 1011 under initial silence conditions
  • All existing tests pass
  • No behavior change for speech-profile users (shadow mode unaffected)

Files

  • backend/utils/stt/vad_gate.py — VAD_GATE_KEEPALIVE_SEC constant and needs_keepalive() method
  • backend/tests/unit/test_vad_gate.py — keepalive tests

Related: PR #4931 (VAD gate implementation)

Activity

  1. added a commit that references this issue on Feb 28, 2026
    e1fd019
  2. added a commit that references this issue on Apr 28, 2026
    418fa3b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions