Skip to content

feat(backend): rampable windowed Parakeet TDT live leg + config-driven STT connect chain with a Soniox leg (dark in prod) - #15234

Merged
Git-on-my-level merged 4 commits into
mainfrom
feat/live-stt-tdt-primary
Sep 20, 2026
Merged

Git-on-my-level merged 4 commits into
mainfrom
feat/live-stt-tdt-primary

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

What changed and why

Makes the live /v4/listen STT chain trustworthy and adds a rampable, self-hosted primary candidate — all dark in prod (STT_CONNECT_ORDER_FROM_CONFIG=false, PARAKEET_WINDOW_ALLOCATION_PERCENT=0); dev values turn it on.

Measured on prod 2026-09-20 (read-only): Modulate is primary by session start but ~94% of its sessions die mid-stream and fail over to Soniox, which carries ~88% of live speech-hours; Deepgram has rejected every handshake with 402 since 09-14; on 09-19 Soniox returned organization_monthly_budget_exhausted for 27 h and live capture failed fleet-wide because the connect-time order is hardcoded [modulate, deepgram, parakeet], Soniox is not a connect-time leg, fallback legs' breakers are never consulted, and 79% of users request en but resolve multi, which makes Parakeet ineligible. The Parakeet /v3/stream leg is dead in prod (served image predates the ready frame), while /v1/transcribe (TDT 0.6b v3, 25 languages, punctuated) is healthy on GPUs that are ~90% idle.

  • Configured chain (behind STT_CONNECT_ORDER_FROM_CONFIG): fallback order derives from STT_SERVICE_MODELS, adds a Soniox connect leg, passes every leg from every primary branch, never re-walks a failed provider, consults and feeds each leg's breaker, gives account-state failures (Deepgram 401/402/403, Soniox budget/typed rejections) a long cooldown with one probe, allows bounded half-open probes, and dials the primary as a last resort instead of stranding a start.
  • parakeet-window live token: bounded 6 s windows over /v1/transcribe behind a fail-closed VAD gate (TDT invents text on noise), eligible on the user's requested base language when resolved multi, so English/European users reach TDT and ja/ko/zh/vi fall through to the next token (Soniox). Stable per-uid allocation percent, per-process session cap with overflow to the next leg, one in-flight POST per session, no retries, unconditional slot release.
  • Observability: live-STT metrics + Grafana rules (split source and combined export); stt_live_session/connection_lost join the bounded fallback vocabulary so mid-session failovers stop landing in other.
  • Rebased onto fix(backend): record STT failover recovered only after a transcript #15218; recovered-accounting follows its after-a-transcript rule.
  • Two intentional exceptions to "dark": (1) connection_lost / modulate_serve_error / last_resort join the bounded fallback reason vocabulary, so mid-session hops stop landing in other; (2) the failover hop's to_mode and record_live_stt_failover_accepted now name the provider actually adopted after _create_stt_socket, not the one selected. Telemetry only.
  • Flag semantics after review: the order flag changes chain order, per-leg breakers and last-resort behaviour only; audio gating for non-TDT providers is unchanged. PARAKEET_WINDOW_ALLOCATION_PERCENT alone controls TDT. With the flag on, stt_selection/exhausted is emitted once per terminal chain (not per leg), so the feat(backend): alert on live-STT chain exhaustion and conversation fragmentation #15189 exhaustion pages measure real session failure.
  • Review: independent adversarial review by Cursor Grok found 10 issues (6 P1), all fixed in the second commit with tests; one proposed critical alert (omi-stt-init-terminal) was removed because prod's initialization-failure ratio is already far above its threshold today.

Implemented by Codex gpt-6-astra from a coordinator plan, reviewed by Cursor Grok and the coordinator. Evidence: omi-knowledge-base/projects/parakeet-primary/evidence/2026-09-20-usable-secondary-qualification.md.

Product invariants affected

  • INV-MEM-4 — matched by path only. This change touches live STT provider selection and transport; it does not read or write memory promotion, receipts or Long-term authority.

How it was verified

  • Unit: the entire backend unit suite locally via backend/test.sh (1,185 files, 17.4k tests; the only local failures were three files needing fakeredis[lua], green once installed), plus scripts/pr-preflight (39 checks).
  • Darkness: tests assert the legacy path is byte-for-byte selected with providers configured and the flag off; prod values keep order flag false and allocation 0.
  • Not verified here: real providers, GPU throughput under live load, acoustic quality on Omi audio, alert delivery. Dev canary follows merge; prod ramp is a separate decision.

Tests

New: backend/tests/unit/test_live_stt_chain.py, backend/tests/unit/test_parakeet_window_live.py (incl. ListenReceiver.initialize_stt → VAD/send → failed batch POST → serialized rebuild → Soniox transcript path with controlled providers). Updated: session failover, Helm defaults, runtime-env validator, alert-rule contract.

Failure class (fixes)

Failure-Class: none

Rollout / rollback

No behaviour change in prod at merge. Dev: windowed TDT → Soniox at 100% allocation, cap 1 session per listen process. Ramp = raise PARAKEET_WINDOW_ALLOCATION_PERCENT / PARAKEET_WINDOW_MAX_SESSIONS after dev qualification; rollback = set allocation 0 or the order flag false (env + rollout).

🤖 Generated with Claude Code

… STT connect chain with a Soniox leg, per-leg breakers

Everything is dark unless STT_CONNECT_ORDER_FROM_CONFIG=true and
PARAKEET_WINDOW_ALLOCATION_PERCENT>0; prod values keep both off, dev turns them on.

- Connect-time fallback order derives from STT_SERVICE_MODELS, adds a Soniox leg,
  passes every leg from every primary branch, never re-walks a failed provider.
- New `parakeet-window` streaming token: bounded 6 s windows over /v1/transcribe
  (TDT 0.6b v3) behind a fail-closed VAD gate, eligible on the user's requested
  base language, with stable per-uid allocation, a process session cap, one
  in-flight POST per session and clean overflow to the next leg.
- Leg-level circuit breakers, long account-state cooldown (Deepgram 401/402/403,
  Soniox budget exhaustion), bounded half-open probes, last-resort primary dial.
- Live-STT metrics and Grafana rules; stt_live_session/connection_lost join the
  bounded fallback vocabulary.

Implemented by Codex gpt-6-astra from a coordinator plan; verified by re-running the
21-file unit selection (exit 0) outside its sandbox.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@mintlify

mintlify Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Sep 20, 2026, 7:02 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

Git-on-my-level and others added 3 commits September 21, 2026 03:20
…T chain

Independent review (Cursor Grok) plus coordinator findings, all behind the same dark flags:
- 18 s window buffer; sustained overload sheds with capacity_full and opens the pod's
  Parakeet circuit instead of killing sessions that still get 200s.
- Last-resort dialing never bypasses an account-state cooldown and never forces a
  shedding TDT leg.
- Fail-closed/forced-active VAD only for the windowed leg; other legs on the configured
  chain keep today's fail-open gate and honour VAD_GATE_MODE / client override.
- Excluded session shapes drop only the parakeet-window token.
- Non-terminal leg skips/failures emit degraded + leg-attempt metric; exhausted is
  emitted once per terminal chain so the #15189 pages stay truthful with the flag on.
- Remove the init-terminal critical rule (it would fire immediately in today's prod).
- Drain releases admission at once; malformed 200/413/semaphore-queue timeouts are
  session-local; only 5xx/acquired-POST timeouts feed the serve-error circuit.
- Pass window_uid only when the managed chain is on (legacy selector call shape while dark).
- Incident-history docstrings moved into utils/stt/ARCHITECTURE.md.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
A bare dict spread into get_stt_service_for_language fails pyright; a TypedDict helper
keeps the legacy call shape while the configured chain is dark.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review September 20, 2026 20:36
@Git-on-my-level
Git-on-my-level merged commit e39276e into main Sep 20, 2026
62 checks passed
@Git-on-my-level
Git-on-my-level deleted the feat/live-stt-tdt-primary branch September 20, 2026 20:36
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.

1 participant