Repository navigation
fix(listen): type undialed selection origins; stop false Soniox overflow deaths from exhausting sessions - #22734
Conversation
connect_configured_chain starts with prior_reason='circuit_open' and an origin of the policy's first route. When that route was skipped without a dial (session-excluded, recovery budget, circuit, capacity), the selection hop carried the sentinel, and PendingLiveFailover normalized it through the live reason vocabulary to connection_lost. A recovery chain that skipped a session-excluded Soniox therefore logged an untyped Soniox death. Prod (ro-prod, listen 4bd8dae, 00:00-00:30Z 2026-10-20): 454 of 489 stt_selection Soniox connection_lost lines had no Soniox dial in the 3 s before; 368 shared their instant with the session's real stt_live_session hop. selection soniox->unavailable connection_lost, the largest exhaustion bucket, was such a chain, after a non-Soniox successor died. The chain now records the origin's skip cause (session_excluded, recovery_budget, circuit_open, capacity_full, policy, unconfigured) and the selection hop reports it as the bounded fallback reason; a dialed origin that dies keeps connection_lost and its transport cause. An exhausted chain logs live_stt_chain_exhausted origin= reason= skips=family:cause,... Observability only. Failure-Class: FC-typed-failure-collapsed-to-generic Co-Authored-By: Claude Opus 5.5 <[email protected]>
…clusions Soniox non-window replacement legs kept overflowing their replay ring while transcribing: on 2026-10-20 the overflow lines showed a median 224 text segments but 11 placed, last text 2.9 s earlier, provider_output_pending=1, and about 85 s of speech unaccounted. Only placed text advanced the accounted boundary, and the #22647 settle correctly refuses while the provider owes output. Soniox finalizes tokens in stream order within seconds, so final text, placed or not, now accounts every tracked speech or replayed send older than the 15 s settle grace. Ring retention, the replay anchor and the settle rule are unchanged; Modulate keeps the placed-text rule. Kill switch LISTEN_NONWINDOW_EMITTED_TEXT_ACCOUNTING_ENABLED. The false overflow then excluded the healthy Soniox family for the rest of the session. When the Parakeet or Modulate successor later died, with Modulate benched and the window full, the chain had no candidate and exhausted: about 40 per 10 min, logged as selection soniox->unavailable. A family that left only for replay_ring_overflow is still excluded from the replacement it triggers, then re-admitted once a successor is adopted; any later provider-evidence death keeps it excluded, and the recovery dial ledger and episode cap still bound re-dials. Kill switch LISTEN_SESSION_LOCAL_EXCLUSION_RELEASE_ENABLED; counter omi_stt_session_local_exclusion_releases_total{provider}. Tests cover the skip-cause typing, the release and its guards, and the accounting with both kill switches. Failure-Class: FC-live-stt-silence-exhausts-replay-capacity Co-Authored-By: Claude Opus 5.5 <[email protected]>
…series Review (Grok): the live_stt_chain_exhausted line printed hop_reason() before the claim, so a dialed Soniox death followed by a later backoff miss logged reason=circuit_open while the metric hop kept connection_lost. Log the settled hop's reason. Pre-create the selection skip-reason exhausted series so their first increment is visible to increase(). Failure-Class: FC-typed-failure-collapsed-to-generic Co-Authored-By: Claude Opus 5.5 <[email protected]>
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4242e32ad5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| receiver._stt_failed_reasons[dead_provider] = live_stt_terminal_reason(receiver.stt_socket, 'connection_lost') | ||
| note_session_local_exclusion(receiver, dead_provider, receiver._stt_failed_reasons[dead_provider]) |
There was a problem hiding this comment.
Release overflow exclusions in the legacy recovery path
When STT_FAILOVER_RECOVERY_ENABLED is false, this records the replay-overflow exclusion, but the legacy adoption path in routers/listen/legacy_recovery.py never calls _release_stt_session_failures or release_session_local_exclusions. Consequently the overflowed provider remains excluded for the rest of these sessions, and a later successor failure can still falsely exhaust the chain—the exact failure this change is intended to prevent. Release the exclusion after a legacy replacement is successfully adopted as well.
Useful? React with 👍 / 👎.
| if family == serving_family: | ||
| continue |
There was a problem hiding this comment.
Release overflowed targets after same-family handoffs
When routing contains multiple targets in one family, an overflowed target can be replaced by another target from that same family. This guard then retains the old target in _stt_failed_targets and leaves its release marker pending; after the replacement proves recovery, the controller may permit the old identity again, but connect_configured_chain still vetoes it via the receiver's failed-target set. If the new target later dies, the session can therefore exhaust despite the original target being eligible for re-admission; release the stored target when it differs from the adopted serving identity rather than skipping the whole family.
Useful? React with 👍 / 👎.
Conflicts: - policy/batch.py: keep both (_valid_route and main's E3 batch_generation_violations). - fallback.py: keep the FallbackReason enum and main's CONNECTION_LOSS_CAUSES import. Main's new fallback reasons session_excluded and recovery_budget join FallbackReason. - feature-flags.yaml: main's file plus the 3 integration-only rows, with terminal fields for main's new schema. Registry doc re-rendered. - reason_label_debt.json: 3 label sites main added (BasedHardware#22734/BasedHardware#22647), recorded as debt for lane 14. Co-Authored-By: Claude Opus 5.5 <[email protected]>
## What changed and why SCA-3688 retires the three inactive controls with terminal kill decisions. - DEC-BTR-001 removes live Parakeet window diarization configuration. The offline shape qualification harness explicitly opts into the existing speaker embedding path. - DEC-STT-006 removes the Soniox elapsed-axis experiment. The compact send map remains authoritative for placement, including when the wire ledger is disabled. Managed Soniox capture-axis diagnostics, the Modulate control measurement, and prerecorded Soniox are preserved. - DEC-STT-005 removes the dedicated Soniox reconnect ring and flag-only death typing. The strike-accounting fixes in #22734 and #23771 are on main. Shared window replay, cross-provider recovery, and the separate idle reopen path are preserved. Read-only production sampling confirmed inactive control values across listener, pusher and Cloud Run surfaces. Compact placement remains the incumbent path for both wire-ledger settings. Regenerated the runtime manifest and flag catalog from their sources. #25913 covers separate Soniox controls. ## Product invariants affected - INV-MEM-4 is selected for the listen receiver path. This change preserves conversation ownership and operates on inactive STT provider paths. ## How it was verified - Feature-flag registry check at 2026-11-22, 109 registry fixtures, and generated runtime manifest check passed. - Repository preflight passed 55 checks. The bounded pre-push gate passed backend type checking, its 40 selected unit files, and the OpenAPI compatibility check. GitHub CI covers the full selector. - The candidate passed 152 selected backend unit files, including the flag budget and reason-label ratchets, managed and legacy replay, live demand switching, real Soniox WebSocket closure, wire-ledger on/off placement, and offline speaker qualification under both legacy toggle values. ## Release ordering Land #26007 (SCA-3683) first. The source registry merges cleanly. Regenerate the catalog from the combined source after rebasing this PR. Release owns merge and rollout. ## UI evidence UI-Evidence: none -- backend STT and flag cleanup ## Failure class (fixes) Failure-Class: none Line-Count-Exception: backend/utils/stt/parakeet_window.py | 1545 -> 1547 | Explicit offline qualification argument keeps the live default disabled and preserves existing qualification coverage.
Summary
Root cause of the untyped
stt_selection connection_lostbucket. These deaths were not declared on the receiver rebuild path (that path emitsstt_live_session), and the Soniox socket did not declare them either.connect_configured_chainsetsoriginto the policy's first route, Soniox, and starts with the sentinelprior_reason = 'circuit_open'. When that route was skipped without a dial, the selection hop still carried the sentinel. The usual skip reason is that Soniox was already excluded for this session; recovery budget, circuit, and capacity also skip it.PendingLiveFailovernormalizes reasons through the live vocabulary, which has nocircuit_open, so the hop becameconnection_lost.Prod evidence: read-only (
ro-prod), listen4bd8dae, Cloud Logging aggregates on field names and counts only.stt_selectionSonioxconnection_lostlines had no Soniox dial in the preceding 3 s.stt_live_sessionhop, so they duplicate it.soniox→unavailableexhaustion followed the death of a non-Soniox successor (Parakeet or Modulatecapacity_full,first_text_deadline, overflow,connection_lost), in a chain that never dialled Soniox.Why Soniox was excluded. Of the live-session Soniox exits in that window, about 165 of 210 were
replay_ring_overflow, mostly recovered on Parakeet. That overflow is a false death of a healthy leg. #22647's diagnostics show it: median 224 text segments but only 11 placed, last text 2.9 s earlier,provider_output_pending=1, about 85 s of speech unaccounted. Unplaced Soniox text never advanced the accounted boundary, and the settle correctly refuses while output is owed.note_failed_routethen excluded the Soniox family or target for the rest of the session. When the successor later died, with Modulate benched and the window full, no candidate was left, and the session exhausted asselection soniox→unavailable connection_lost, about 40 per 10 min.Changes
Typing, observability only. The chain records why the origin was skipped:
session_excluded,recovery_budget,circuit_open,capacity_full,policy,unconfigured, orlast_resort. The selection hop reports it as the boundedomi_fallback_totalreason, adding two new label values,session_excludedandrecovery_budget. A dialled origin that dies keepsconnection_lostand its transportcause=. An exhausted chain also logslive_stt_chain_exhausted origin= reason= skips=family:cause,..., which shows why no successor was available.Accounting. On a Soniox non-window leg, final text, placed or not, accounts every tracked speech or replayed send older than the existing 15 s settle grace. Soniox finalizes tokens in stream order within seconds. Unchanged: ring retention, the replay anchor, and the fix(listen): settle quiet non-window replay capture instead of replay_ring_overflow failover #22647 settle rule (no provider-owed output). Modulate keeps the placed-text rule. Kill switch:
LISTEN_NONWINDOW_EMITTED_TEXT_ACCOUNTING_ENABLED, on by default.Exclusion release. A family that left only for
replay_ring_overflowis still excluded from the replacement selection it triggers, then re-admitted once a successor is adopted. Bounds:Kill switch:
LISTEN_SESSION_LOCAL_EXCLUSION_RELEASE_ENABLED, on by default. New counter:omi_stt_session_local_exclusion_releases_total{provider}.Both switches are registered in
config/feature-flags.yamland the rendered registry. Docs:listen_pusher_pipeline.mdxandoperational/windowed-live-stt.md.Expected impact. These are estimates.
soniox→*connection_lostdrops to near the real-dial residue (about 35 per 30 min). The rest reappears under its true skip reason.replay_ring_overflowfrom actively transcribing legs (about 50–60 per 10 min) should mostly disappear, which also removes Parakeet and Modulate inflow.→unavailableexhaustions should fall wherever a Soniox overflow had caused the exclusion, which is most of them.Fleet exhaustion should move toward the 3.61% baseline. Verify with
live_stt_chain_exhausted ... skips=and the new counter.Lane / contract
Two-lane live-STT run (selection-deaths lane), single contract: selection-death typing plus its cause. Owner sign-offs for edits to other lanes' files: none.
Product invariants affected
none
Verification
backend/tests/unit/test_live_selection_skip_causes.py, 15 tests. Of the original 13 run againstorigin/mainsources, 8 fail (typing, release, accounting) and 5 pass (the guards that preserve behavior):connection_lostwith its cause;backend/test.sh. Layer: hermetic unit tests.scripts/typecheck.sh: 0 errors. Feature-flag registry check: OK.385e3aafba32(2,059 files, 0 failed); final head: see below.grok-4.7-high, read-only): SHIP at385e3aafba32. Its two cheap residuals are fixed in4242e32ad5bc: the exhaustion log now uses the settled hop reason, and the skip-reason series are pre-created. Re-review of the final head: see below.Known residuals (reviewed, not changed):
optional_handover(demand switch) still raisesRejectedStream(prior_reason), so an excluded origin there sayscircuit_open. That is a live-session label, and not the exhaustion path.capacity_fullorigin exhaustion now counts under thecapacity_fullexhausted alert, which has no component filter. At the Q1 mix this is far below its 15% threshold.omi_fallback_total{component="stt_selection"}by reason,live_stt_chain_exhaustedskips,omi_stt_session_local_exclusion_releases_total, and Sonioxreplay_ring_overflow.Rollback
LISTEN_NONWINDOW_EMITTED_TEXT_ACCOUNTING_ENABLED=falserestores placed-text-only accounting.LISTEN_SESSION_LOCAL_EXCLUSION_RELEASE_ENABLED=falserestores session-long exclusion.Related class, also declared on the first commit: FC-typed-failure-collapsed-to-generic.
Failure-Class: FC-live-stt-silence-exhausts-replay-capacity
🤖 Generated with Claude Code