Repository navigation
fix(stt): prevent recovery pacing jitter from exhausting live sessions - #20491
Merged
Merged
Conversation
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Git-on-my-level
added a commit
that referenced
this pull request
Oct 5, 2026
## What changed and why Set `STT_FAILOVER_RECOVERY_ENABLED=true` for prod listen in the Helm values and runtime overlay, regenerate the runtime manifest and feature-flag registry, and align the listen pipeline/rollout docs. This enables the recovery stack from #20391/#20491/#20534/#20560/#20671 for new stable listen sessions after deployment. Dev listen remains `false` in its chart and runtime overlay. The shared base and code default stay `false`, so a missing environment variable means off. `SONIOX_IDLE_CLOSE_SECONDS`, router mode, provider order, and allocations are unchanged. ## Canary evidence — coordinator to complete **PLACEHOLDER:** attach the 25% prod listen canary versus control evidence after it holds through the next peak: exact image/config, observation window including peak, cohort and scrape coverage, session counts, recovery/continuity and terminal-after-text rates, latency and error comparison, and the coordinator's acceptance decision. Canary success is supplied context; this PR preparation does not independently qualify production health. Keep this PR draft until the coordinator fills this evidence and authorizes the stable flip. ## Deploy and rollback Deploy prod listen Helm through the normal `gcp_backend_listen_helm.yml` workflow (`environment=prod`, `mode=deploy`) after the coordinator merges the approved config flip. This draft does not merge or deploy anything. Rollback: revert this PR and deploy listen through the same normal workflow. For emergency rollback, use `gcp_backend_listen_helm.yml` with `environment=prod`, `mode=rollback` (select the pre-flip Helm revision if needed). ## Follow-up This flag also flips the canary-only terminal-after-text (TAT) metric, `omi_live_session_terminal_after_text_total`, fleet-wide. After stable rollout, relax the canary-scoped selectors from #20660 for the alert's volume floor, numerator, and denominator together. Alert rules are unchanged here; the coordinator owns this follow-up to #20660. ## 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 - `PATH="$PWD/backend/.venv/bin:$PATH" bash backend/scripts/pre-deploy-check.sh`: passed runtime/workflow/state validation for dev and prod, plus 284 deploy contract tests. - `BACKEND_UNIT_TEST_FILE_LIST="$PWD/.local/stable-flip-test-files.txt" bash backend/test.sh`: 73 cases passed across `test_stt_failover_recovery_flag.py` (45) and `test_listen_stt_rollout.py` (28), including Helm canary rendering and flag-off behavior. - Offline `helm template` for prod and dev: exactly one recovery declaration per rendered listen container, prod `true` / dev `false`. Compared chart env and composed runtime state against `origin/main`: only prod listen's recovery value changed; other runtime settings and code defaults were preserved. - `OMI_PR_BODY_FILE=.local/pr-stable-flip-round2-body.md make preflight`: all 38 selected checks passed, including the committed-diff rerun. - `scripts/pr-preflight --lane local --metadata-only --pr-body-file .local/pr-stable-flip-body.md`: all 3 metadata checks passed. - Re-ran the committed-diff preflight with the required INV-MEM-4 citation for `backend/deploy/runtime_env.yaml`. Production acceptance remains the coordinator's canary evidence above. ## Tests Added `test_stable_recovery_flag_is_scoped_to_prod_listen` in `backend/tests/unit/test_listen_stt_rollout.py`: prod listen must declare `true` in Helm values and both committed/freshly composed runtime manifests; dev listen must declare `false`. Exhaustive runtime declaration paths require pusher, sync, desktop-backend, jobs, shared config, and every other service to leave the flag unset. `test_stable_recovery_code_default_remains_off` checks unset and explicit false against the production reader. Existing default-off and canary tests are unchanged. This pins the rollout boundary identified in Luna's review of #20696; the shared composition primitive already validates general config consistency, while this test preserves the intended service scope. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/20696?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> <!-- End of auto-generated description by cubic. -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
capacity_full.Failure-Class: FC-live-stt-audio-lost-on-provider-death
Diagnosis and connection cost
The fake WebSocket peer (
backend/testing/live_stt_soak/transport.py) has no capacity refusal or connection limit. The failure originates locally inbackend/utils/stt/replay_delivery.py: the oldRecoveryWriterPace.note_writeandReplayPacer.sendadded each packet's duration to the observed clock instead of the armed slot. PersistentReplayTailSocketdelivery then hit its 26-second tail cap. This is not the 20-episode limit or a fake-peer quota artifact; the deterministic test produces a localcapacity_fulland client 1011 after successful replay/text.The original ON arm dialed Soniox and then Modulate: 32 paid dials for 16 sessions, versus 16 Soniox dials in the OFF control (which ran four-session batches). There is no extra steady-state probe or parallel spare: one paid serving leg per session. A cross-provider rebuild connects before closing the failed socket, so two transports can briefly overlap; legacy also connects before finishing the previous socket. The avoidable second paid dial/replay is a real cost/quota risk, removed by fixing the pacing-induced death rather than widening target limits.
Test plan
capacity_full; fixed code retains one paid dial, exact ordered PCM, zero skips, and bounded queues/tail.BACKEND_UNIT_TEST_FILE_LISTwithtest_live_recovery_pacing.py,test_live_recovery_matrix.py,test_live_replay_provider_pairs.py, andtest_stt_failover_recovery_flag.py, throughbackend/test.sh: 174 passed, no CPU-guard violation.OMI_PR_BODY_FILE=.local/pr-stt-recovery-soak-body.md make preflight: 30 checks passed.scripts/pr-preflight --metadata-only --pr-body-file .local/pr-stt-recovery-soak-body.md: four checks passed.backend/test.shrerun passed at 0.25 s, and the subsequent full push gate passed at 0.11 s. No thresholds or allowlists changed.8fe206e2506dd8e479b5455108a9a9d436ddb9f3: all scheduled checks passed, including all four backend unit shards, unit guardrails/suite, Hermetic Backend E2E/merge gate, CodeQL, formatting, hygiene, OpenAPI, source closure, and PR metadata. Scope-excluded checks remain skipped, not claimed as executed.Local soak rerun
PYTHONPATH=backend backend/.venv/bin/python -m testing.live_stt_soak.local --firestore-jar <existing-emulator.jar> --java <installed-java> --redis /opt/homebrew/bin/redis-server --sessions 8 --minutes 10 --order parakeet-window,soniox,modulate-velma-2 --recovery --output .local/stt-soak-soniox-20261004Used the exact local launcher from cef17a9, with only the temporary busy-machine batch cap changed from four to eight as requested. Admission load was 57.9, so eight sessions were selected; they ran concurrently, not as four-session batches. The temporary launcher was removed after cleanup; no harness code is included in this PR.
All eight clients closed normally with 1000. No missing metric families, resets, or sampling errors. Artifacts:
.local/stt-soak-soniox-20261004/{before.prom,after.prom,progress.json,report.json,isolation.json,cleanup.json}. The driver correctly retainsREVIEW_REQUIRED, not a production GO verdict.Every runtime child was credential-scrubbed, had empty temporary HOME/CLOUDSDK_CONFIG, and used only demo Firestore/local Redis/fake providers. ADC lookup failed with
DefaultCredentialsError. All three owned service PIDs were reaped and all five loopback ports checked free afterward. No cloud, cluster, production, monitoring, real provider, merge, or deploy actions.Fake-local results do not qualify vendor quotas/billing/quality, GPU/backfill headroom, production images, or fleet behavior. The recovery flag remains default off.
Generated with Devin