Repository navigation
harden: add bounded live STT routing cohort telemetry - #20745
Conversation
|
Independent review: Codex Luna ( Blocking: none. Cohort labels are a closed set (arm, signal, outcome, provider). Assignment follows The reviewer's pytest could not start (no writable temp in the read-only sandbox). |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Re-run CI against the main that already fixed the five stale fixtures.
## 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. -->
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.
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
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..local/GATES.mduses 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.