Skip to content

proto: CLOUD_LIVE_STT_MODE (stream/when_watched/off) + local_preview capability — batch-only cloud foundation - #23498

Closed
Git-on-my-level wants to merge 1 commit into
mainfrom
proto/batch-only-cloud
Closed

Git-on-my-level wants to merge 1 commit into
mainfrom
proto/batch-only-cloud

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Dark foundation for the batch-only cloud transcription proposal (David, 2026-10-24 —
proposal only, not ratified; plan:
omi-workspace omi-knowledge-base/projects/two-lane-transcription/batch-only-cloud-plan.md).
No behavior changes by default; every new code path is behind a fail-safe server policy
switch that defaults to today's behavior.

  1. CLOUD_LIVE_STT_MODE (backend/config/cloud_live_stt.py, new):
    • stream (default) — today's behavior exactly: live provider streams open as
      configured (language/cost routing, demand routing, recovery), including the
      self-hosted Parakeet window leg.
    • when_watched — reuses the existing live-demand machinery (feat(listen): route hidden English capture by live demand #21481) rather than
      adding a parallel switch: resolve_live_demand() admits every session, so a vendor
      stream runs only while the transcript is visible or a server-side real-time consumer
      is active (config/live_demand.py).
    • off — no cloud streaming STT session opens at all (neither vendor nor the Parakeet
      window leg). Audio is still received and persisted through the ordinary listen/pusher
      path — the same receive/persist shape as the fix(stt): enforce finite allowances before sync and batch cloud spend #23388 cap-paused state
      (routers/listen/receiver.py:1289), which this generalizes. BYOK custom STT is never
      suppressed. Invalid values fail safe to stream.
  2. local_preview client capability on /v4/listen ('enabled'|'disabled' query
    param → ListenRequest.local_preview): a client declares it renders its own on-device
    transcript preview. Server-side use is telemetry-only for now.
  3. Metrics (utils/metrics.py): omi_cloud_live_stt_mode_sessions_total{mode, local_preview,client_platform} and omi_cloud_live_stt_saved_seconds_total{mode} —
    the would-be-saved provider stream seconds per mode (off = all decoded audio seconds;
    when_watched = hidden background+foreground seconds; stream = 0). Baseline for what
    off could remove, measured 10-24 on ro-prod: ≈1,838 vendor wire audio-hours/day.

Not included (deliberately): any client-side on-device preview wiring, the sync-off
ephemeral buffer, vendor-batch routing for non-EU languages, and any rollout. Those are
gated plan phases, not this PR.

Testing

  • New unit tests backend/tests/unit/test_cloud_live_stt_mode.py: mode resolution
    fail-safe matrix (default/explicit/case/whitespace/invalid), suppression matrix
    (incl. the BYOK exemption), when_watched → feat(listen): route hidden English capture by live demand #21481 admission mapping, off-mode
    receive/persist without provider selection or demand attach, lane-switch refusal while
    suppressed, session counter with local_preview, and saved-seconds accounting per mode.
  • Existing demand/cap suites included in the targeted run
    (test_live_demand_policy.py, test_live_demand_consumers.py,
    test_stt_cap_dispatch.py) to prove the default path is untouched.
  • Run via backend/test.sh with BACKEND_UNIT_TEST_FILE_LIST and
    BACKEND_PYTEST_WORKERS=4.

Failure-Class: none
(Dark feature behind a fail-safe switch; the default mode reproduces current behavior and
the change adds two counters plus one registry row.)

Do not merge or deploy: this is a prototype branch for the batch-only plan discussion.

🤖 Generated with Claude Code

Line-Count-Exception: backend/routers/listen/receiver.py | 2782 -> 2829 | prototype foundation: CLOUD_LIVE_STT_MODE session pin/suppression at the _initialize_stt seam, lane-switch refusal guard, and saved-seconds recorder; to be relocated into the listen-edge/plan-D gateway split before any non-draft use
Line-Count-Exception: backend/utils/metrics.py | 1523 -> 1535 | two new counters (omi_cloud_live_stt_mode_sessions_total, omi_cloud_live_stt_saved_seconds_total) for the batch-only foundation; single central metrics module

View guided diff Turn on auto-fix

…ocal_preview handshake, saved-seconds metrics

Dark foundation for the batch-only cloud transcription proposal. Default
stream reproduces today's behavior exactly; when_watched forces the existing
#21481 live-demand machinery to admit every session (no parallel switch);
off opens no cloud streaming STT session at all while audio is still
received and persisted (the #23388 cap_paused receive/persist shape), with
BYOK custom STT never suppressed. local_preview is a client capability
declaration on /v4/listen. Metrics: omi_cloud_live_stt_mode_sessions_total
and omi_cloud_live_stt_saved_seconds_total.
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Built on in #23610 (this PR's commit is carried there unchanged, plus one follow-up). Finding while doing so: CLOUD_LIVE_STT_MODE=off as drafted here loses transcripts. Live segments are what keep a listen conversation alive and register it for batch (routers/listen/conversations.py:385-398 deletes the no-segment row as empty; register_recording only runs from finalization, utils/conversations/finalizer.py:367). #23610 changes off to defer the provider stream until audio reaches the socket instead of dropping it. Design note: omi-workspace data/run-2026-10-13-two-lane-nemotron/odpreview-design-2026-10-25.md.

Git-on-my-level added a commit that referenced this pull request Oct 25, 2026
…never drop, the cloud stream (#23610)

* proto: CLOUD_LIVE_STT_MODE policy switch (stream/when_watched/off), local_preview handshake, saved-seconds metrics

Dark foundation for the batch-only cloud transcription proposal. Default
stream reproduces today's behavior exactly; when_watched forces the existing
#21481 live-demand machinery to admit every session (no parallel switch);
off opens no cloud streaming STT session at all while audio is still
received and persisted (the #23388 cap_paused receive/persist shape), with
BYOK custom STT never suppressed. local_preview is a client capability
declaration on /v4/listen. Metrics: omi_cloud_live_stt_mode_sessions_total
and omi_cloud_live_stt_saved_seconds_total.

* feat(listen): mobile local-preview lane for batch-lane users; defer, never drop, the cloud stream

A mobile session that declares local_preview=enabled and whose uid is on the
batch record lane (allowlist or batch percent), with private cloud sync and no
custom STT, is admitted to the local-preview lane: ready and every
mobile_batch_admission renewal carry local_preview=true with
mobile_standard_batch=true, so the client journals all pendant audio through
the lossless mobile Standard batch route and renders its own on-device preview.
Integrations no longer hold these sessions on the live stream (David,
2026-10-25: realtime apps/webhooks degrade).

Listen defers the provider stream instead of dropping it: live segments are
what keep a listen conversation alive and register it for batch, so a session
with audio and no stream loses its transcript. The first socket audio opens
today's stream. CLOUD_LIVE_STT_MODE=off (#23498) now uses the same deferral.

Kill switch LOCAL_PREVIEW_BATCH_ENABLED, on unless set off; no separate ramp.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(listen): start demand routing once a deferred or cap-paused stream actually opens

Luna r1 P2 on #23610: a deferred open that cap admission pauses creates no
socket, and the later cap-recovery re-init never started the demand-routing
task the session skipped. ensure_live_demand_routing() starts it exactly once
whenever a stream exists (session start, deferred open, cap recovery); the
deferred-open counter now counts only opens that produced a socket.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(listen): label local-preview admission outcomes through the closed reason enum

CI test_reason_label_enums: outcome labels must come from a reasons.py enum via
reason_label(). Adds LocalPreviewOutcome (LIVE_STT family); REASONS derives from it.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(listen): count a deferred stream once however it opens; document late routing tasks

Luna r2 on #23610: a deferred open that cap admission paused, then cap
recovery opened, was never counted; note_deferred_stream_opened() counts once
from either path. Routing tasks started after supervise() snapshots its set are
tracked and cancelled at teardown but cannot end the session; that fail-soft
behaviour is intended and now documented at the call.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member Author

@kodjima33 keep-or-close ping (lead2 ruling 664fd6, dropped-work audit 2026-11-09 item 7): this draft has been idle 15-17 days. Please reply with keep (and a next step) or it will be closed as not-now in 24h (after 2026-11-10 17:10Z). Closing keeps the branch; nothing is lost.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Closing as part of a stale-PR cleanup David asked for on 2026-11-26 (Shipping lead agent): it is a draft with no activity for days. Nothing is lost: the branch stays, and anyone can reopen this PR if the work is still wanted. If it still matters, reopen it and refresh it against main.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Git-on-my-level 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

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