Skip to content

fix(listen): terminate stale live sessions when STT peers end cleanly #10028

Description

@Git-on-my-level

Problem

The original client-side transcript-silence watchdog proposal was unsafe: ordinary quiet periods are indistinguishable from a stale stream because BLE audio packets continue during silence. It would reconnect healthy sessions at the configured 120-second conversation-silence boundary.

There is a narrower, observable failure boundary in the current /v4/listen pipeline. When an active Parakeet or Modulate upstream WebSocket ends cleanly without an exception, its wrapper does not latch the connection as dead. The mobile socket can remain ready until the device sends another audio frame and the next provider send fails. That extends the “Listening” zombie state even after the backend has observed its upstream transport disappear.

Scope

  • Latch an unexpected clean upstream close as terminal in the Parakeet and Modulate streaming wrappers, excluding explicit local drain/finalization.
  • Propagate that observed provider death immediately through the existing stt_failed + WebSocket 1011 terminal path, without waiting for another client audio frame.
  • Add hermetic coverage through the real /v4/listen route and controlled loopback provider peer: after one audio frame, a clean provider close must deliver the terminal status/close without a second audio frame. Add focused wrapper coverage for both provider implementations.

This does not claim that lack of transcript text proves a transport failure, nor does it replace the durable audio/receipt boundary still needed for #6977. It only closes a session when the backend has directly observed the upstream transport ending.

Sequencing

Wait for #10023 to merge first: it modifies the same streaming/runtime and listen wire-contract surfaces. The implementation PR should use Closes #10028.

Related parent: #6977.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend Task (python)bugSomething isn't workingmobilep1Priority: Critical (score 22-29)reliability

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions