Skip to content

harden: add bounded live STT routing cohort telemetry - #20745

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/stt-router-cohort-metrics
Oct 6, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/stt-router-cohort-metrics

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Router cohort telemetry previously covered only transcript/no-transcript totals. This draft adds two bounded companion counters for managed live-STT sessions: terminal attempts (including pre-audio initialization failures), completed transcript outcomes, per-session exhausted fallback and terminal-after-text booleans, and completed-session paid adapter audio seconds. Existing metric schemas, routing flags and serving behavior remain unchanged.

The sticky UID arm is pinned before initialization. routing_arm=on|shadow|off: off includes unassigned UIDs in mode on; shadow stays distinct. Custom STT, BYOK and multi-channel paths remain excluded. Child tasks inherit context; attempts and adapters retain the session object; runtime restores parent context even on error. Paid audio counts accepted adapter PCM, including replay/pre-roll/idle reopen, excludes rejection and idle buffering, and emits once at the same completion seam. It is not vendor billed time or an invoice measurement.

Validation

  • Production-seam regressions exercise all arms, invalid percent/fail-open, pre-audio failure, task inheritance, repeated finish/teardown, the recovery-gated TAT predicate, paid live/replay/admitted-successor sends, rejection, Parakeet exclusion, idle buffering/reopen, and context restoration on success/error, final cleanup settlement/audio and subordinate metric faults.
  • Focused existing chain, router, transcript, fallback, recovery, alert and Soniox suites via backend/test.sh; make preflight, metadata checks and normal commit/push hooks. Test cloud credentials stripped and CLOUDSDK_CONFIG isolated; no provider/Redis/cloud data calls.
  • Owning routing runbook documents exact series and scope; coordinator .local/GATES.md uses implemented queries. No session first-text/disruption series is claimed.

Keep DRAFT. No prod configuration, readiness transition, merge or deploy. Coordinator owns review and live acceptance. Separate blocker fixes remain in #20741.

Rollback

Revert through a normal PR. Existing metrics and routing behavior continue independently; companion metrics require deployment and scrape continuity before use.

Product invariants affected

none

Failure-Class: none

Line-Count-Exception: backend/routers/listen/runtime.py | 1193 -> 1220 | Pin bounded cohort before initialization and emit completed-session telemetry at the existing teardown seam; restore task context in finally.
Line-Count-Exception: backend/utils/stt/live_session.py | 1124 -> 1130 | Observe accepted paid PCM at the shared managed live/replay/admission send boundary without altering sends.

Full CI at 4c96c98: unit shards 1/4 and 3/4 fail only on the same five baseline fixture failures reproduced on main cf8201c (four desktop TTS helper/funding fixtures and one shared-action-item patch of removed _wake_task_changes). All 23 new cohort cases passed on Linux in shard 2/4; listen/pusher gauntlet and other completed checks passed. Baseline evidence/follow-up are in the coordinator .local/REPORT.md and .local/FOLLOW_UP_BASELINE_CI.md. No new failure caused by the telemetry change was found.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Independent review: Codex Luna (gpt-6-luna, read-only) APPROVE on 4c96c98d418b868be427e2d94a192de43fc4484f.

Blocking: none. Cohort labels are a closed set (arm, signal, outcome, provider). Assignment follows routing_on(uid), including the percent boundary. Invalid or missing mode does not assign on. No provider-selection change.

The reviewer's pytest could not start (no writable temp in the read-only sandbox). git diff --check passed. Not merging while CI is red; pre-existing main failures will be recorded, and no skip hatch will be used.

@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 6, 2026 18:15
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Re-run CI against the main that already fixed the five stale fixtures.
@Git-on-my-level
Git-on-my-level merged commit fb9bba4 into main Oct 6, 2026
55 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/stt-router-cohort-metrics branch October 6, 2026 19:12
Git-on-my-level added a commit that referenced this pull request Oct 6, 2026
## What changed and why

Router ON ramp step 1: `STT_ROUTING_MODE=on` with
`STT_ROUTING_ON_PERCENT=5` (sticky UID) on prod listen, in the Helm
values and runtime overlay, with the runtime manifest and feature-flag
registry regenerated.

Dev stays `shadow`/`0`. The composed manifest shows `shadow/0` for dev
and `'on'/5` for prod `gke/backend-listen` only. `STT_ROUTING_MODE` is
quoted `'on'` in the overlay so YAML cannot parse it as boolean true;
the code compares the env string to `'on'`.

## Gate

Each ramp step (5 → 25 → 50 → 100, about 1–2 hours per step) is gated on
the `omi_stt_routing_cohort_*` counters from #20745 (now live on stable
at `5cbb008`), comparing `routing_arm=on` versus `off`: terminal failure
fraction, transcript-less fraction, fallback_exhausted,
terminal_after_text, and paid-audio-seconds by provider. Queries are in
the router lane `.local/GATES.md`. Missing series, missing sample
floors, or NaN hold the ramp.

## Product invariants affected

- INV-MEM-4: the generated runtime manifest is in scope; canonical
memory intake, promotion authority, and processing-host bindings are
unchanged.

## How it was verified

- `backend/.venv/bin/python backend/deploy/compose_runtime_env.py
--check` — manifest up to date; composed prod listen env is
`STT_ROUTING_MODE='on'`, `STT_ROUTING_ON_PERCENT='5'`; dev unchanged at
`shadow`/`0`.
- `backend/.venv/bin/python scripts/render_feature_flag_registry.py` —
registry shows prod listen `on` / `5`, no other host changed.
- The serving code reads `os.getenv('STT_ROUTING_MODE', 'off') == 'on'`
(string compare), which the quoted overlay value satisfies.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/20847?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/20847?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F20847&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
shitobu pushed a commit to shitobu/omi that referenced this pull request Oct 6, 2026
Sticky-UID step 1 of 5->25->50->100 on prod listen. Gated per step on
the omi_stt_routing_cohort_* counters shipped in BasedHardware#20745.
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