Repository navigation
fix: drain accepted STT tails adopted after client close - #20560
Merged
Merged
Conversation
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Git-on-my-level
marked this pull request as ready for review
October 4, 2026 03:16
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Failure-Class: FC-live-stt-audio-lost-on-provider-death
Product invariants affected
none
Test plan
origin/main(d04010dffcce) because the post-close adopted successor delivers the prefix but discards its nonempty accepted tail.LASTcallback persists before conversation finalization, and skipped audio is zero.backend/test.sh: 243 tests passed across shutdown, provider pairs, flag-OFF/session pinning, recovery matrix, pacing, and transcript replay. No fast test exceeded the 0.30-second CPU guard.PYTHON=backend/.venv/bin/python OMI_PR_BODY_FILE=.local/pr-stt-adopted-tail-body.md make preflight: all 31 selected checks passed.scripts/pr-preflight --lane local --pr-body-file .local/pr-stt-adopted-tail-body.md: all 31 passed. Touched production-file Pyright: zero errors. Evidence.local/adopted-tail-{preflight,pr-body-check,pyright}.log.f00d466b3aec086a168a24a490656647f4a44a05: shared preflight/metadata, CPU-guarded units, formatting, API/released-client compatibility and source closure.f00d466b3aec086a168a24a490656647f4a44a05: all four backend unit shards, backend unit suite/guardrails, Hermetic Backend E2E/merge gate, Listen Pusher Stack Gauntlet, metadata, formatting, hygiene, API/source-closure contracts, and CodeQL passed. No failed or pending checks; scope-excluded/post-merge skipped checks are not claimed as executed. Evidence.local/ci-adopted-tail.jsonand.local/adopted-tail-ci-watch.log.Local shutdown-heavy soak
Runtime: main
d04010dffcceplus this reviewed four-file diff; production diff SHA256483f116d503b92c5eaffc5c99caf2f9c11e4e863901c64f35293e3faa637519d. Harness: #20477 plus the preserved round-3 shutdown observer snapshot; only the owned-PID file destination changed.Close duration is server disconnect receipt through ASGI-handler completion; p95 uses nearest rank (with eight sessions, p95 equals max), not client handshake duration. Every adopted tail started with
host_active=false,draining=true, 4.16 s queued, and ended with zero queued and no death. This replaces the prior arm's 4.04 s loss per session without spending a new deadline or dial.Frozen count-only evidence:
.local/adopted-tail-soak-summary.json; raw.local/stt-adopted-tail-shutdown-20261004/{before.prom,after.prom,report.json,batch-1.json,progress.json,isolation.json,cleanup.json}; harness/source snapshot hashes.local/adopted-tail-harness-source.json. RED/GREEN tests:.local/adopted-tail-{red,green,selected-green}.log. All three spawned services were reaped; all five service ports were verified free; no other lane's process was signalled. Temporary harness changes were restored; only the intended four files remain changed.Isolation: #20477 local harness plus the reviewed round-3 count-only shutdown observers; fresh demo Firestore/Redis/listen and fake loopback provider peers, credential-scrubbed allowlisted environment, empty HOME/CLOUDSDK_CONFIG, failed ADC lookup, loopback-only socket guard, no dotenv/cloud identity/real provider keys. Every spawned PID is recorded at spawn in this worktree's
.local/owned-pids.txt; only newly owned registered process objects may be signalled. Temporary harness files are restored/removed after execution and are not committed.Fake-local evidence is not vendor billing/quota/quality, GPU, production persistence/finalization, or fleet qualification. Recovery remains default off. Draft only; no merge, deployment, cluster, or monitoring actions.
Generated with Devin