Repository navigation
Fix STT recovery canary cancellation and paid-send regressions - #20671
Merged
Merged
Conversation
Member
Author
|
Coordinator decision on Luna's round-2 P2 ( 🤖 Generated with Claude Code |
Git-on-my-level
marked this pull request as ready for review
October 4, 2026 19:53
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Git-on-my-level
pushed a commit
that referenced
this pull request
Oct 4, 2026
… test #20671 changed _pump_replacement to always adopt the ReplayTailSocket wrapper on replacement legs (including empty-prefix ones), per its receiver.py comment: exposing the raw paced writer stalls receive/disconnect observation behind a buffered client burst. This one test in test_soniox_typed_rejections.py was not updated to match and has asserted receiver.stt_socket is the raw replacement socket ever since, failing deterministically on every main CI run. Fix mirrors the already-updated sibling assertions in test_stt_session_failover.py: assert isinstance(..., ReplayTailSocket) and check .connection for the underlying raw socket instead of identity on stt_socket itself.
kodjima33
added a commit
that referenced
this pull request
Oct 5, 2026
… test (#20693) #20671 changed _pump_replacement to always adopt the ReplayTailSocket wrapper on replacement legs (including empty-prefix ones), per its receiver.py comment: exposing the raw paced writer stalls receive/disconnect observation behind a buffered client burst. This one test in test_soniox_typed_rejections.py was not updated to match and has asserted receiver.stt_socket is the raw replacement socket ever since, failing deterministically on every main CI run. Fix mirrors the already-updated sibling assertions in test_stt_session_failover.py: assert isinstance(..., ReplayTailSocket) and check .connection for the underlying raw socket instead of identity on stt_socket itself.
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.
What changed and why
With recovery enabled, a buffered client burst could overflow a healthy paid STT send queue. Initial paid streaming legs and recovered successors now retain a bounded independent tail; its supervised pump waits for capacity while the receiver continues reading audio and disconnects. Empty-prefix successors use the same tail. A later cross-provider failover without a Parakeet window ring transfers unwritten packets before aborting the old wrapper, retains capture timestamps, and debits confirmed writes. Initial stalled writers keep a bounded capacity_full outcome.
Preserve the socket's typed local failure cause and release underlying stream leases when wrappers close. Classify departed clients such as ASGI 1006 as cancelled unless genuine STT-terminal/1011 or crash evidence exists. Flag-off sessions retain the original send, recovery and wire behavior.
Document canary comparison limits: attempt success is irreversible, post-text termination is emitted only with recovery enabled, and window first-text latency includes answered-fragment quiet gaps. The window timer is unchanged.
Product invariants affected
None identified by
scripts/pr-preflight --lane local --suggest.How it was verified
backend/test.sh: 578 passed, 3 deselected across 12 files, including 45 flag ON/OFF tests and 14 shutdown tests. After narrowing initial admission to transports with a real capacity seam, all 100 tests across five changed test files passed, including the speaker-ID failover acceptance. The standard 0.30s CPU guard remained enabled. Backend environment preflight: 18 passed, zero failures. Typecheck: zero errors (existing warnings retained).make preflight: all 31 selected checks passed. GitHub code CI green on exact headcc80754dc95b2abe0e479527ae44f2b4537da6b0: 31 successful checks, 23 intentional skips, no failures, pending checks or cancellations. Backend shards and slow guardrails; hermetic E2E and listen/pusher gauntlet.Tests
backend/tests/unit/test_live_recovery_canary_regressions.pycovers cancellation labels, buffered paid sends, typed capacity outcomes, both directions of queued-tail handoff, confirmed-write debiting, disconnect observation during capacity wait, and the first-text histogram counterexample. Existing shutdown and flag ON/OFF suites protect teardown and legacy behavior.Failure class (fixes)
Failure-Class: none
Line-Count-Exception: backend/routers/listen/receiver.py | 2398 -> 2422 | Preserve ringless queued tails and move bounded initial paid delivery to the existing supervised tail pump; retain the separate legacy flag-off path.
Draft for review; no merge or deployment.