Skip to content

fix(listen): type undialed selection origins; stop false Soniox overflow deaths from exhausting sessions - #22734

Merged
Git-on-my-level merged 3 commits into
mainfrom
fix/listen-selection-skip-causes
Oct 20, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
fix/listen-selection-skip-causes

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

  • fix(listen): name why an undialed selection origin never served
  • fix(listen): account active Soniox text and re-admit overflow-only exclusions

Root cause of the untyped stt_selection connection_lost bucket. These deaths were not declared on the receiver rebuild path (that path emits stt_live_session), and the Soniox socket did not declare them either. connect_configured_chain sets origin to the policy's first route, Soniox, and starts with the sentinel prior_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. PendingLiveFailover normalizes reasons through the live vocabulary, which has no circuit_open, so the hop became connection_lost.

Prod evidence: read-only (ro-prod), listen 4bd8dae, Cloud Logging aggregates on field names and counts only.

  • 00:00–00:30Z 2026-10-20: 454 of 489 stt_selection Soniox connection_lost lines had no Soniox dial in the preceding 3 s.
  • 368 of them shared their instant with the session's real stt_live_session hop, so they duplicate it.
  • Every soniox→unavailable exhaustion followed the death of a non-Soniox successor (Parakeet or Modulate capacity_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_route then 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 as selection soniox→unavailable connection_lost, about 40 per 10 min.

Changes

  1. Typing, observability only. The chain records why the origin was skipped: session_excluded, recovery_budget, circuit_open, capacity_full, policy, unconfigured, or last_resort. The selection hop reports it as the bounded omi_fallback_total reason, adding two new label values, session_excluded and recovery_budget. A dialled origin that dies keeps connection_lost and its transport cause=. An exhausted chain also logs live_stt_chain_exhausted origin= reason= skips=family:cause,..., which shows why no successor was available.

  2. 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.

  3. Exclusion release. A family that left only for replay_ring_overflow is still excluded from the replacement selection it triggers, then re-admitted once a successor is adopted. Bounds:

    • any later provider-evidence death of that family keeps it excluded;
    • the recovery dial ledger and the episode cap still bound re-dials.

    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.yaml and the rendered registry. Docs: listen_pusher_pipeline.mdx and operational/windowed-live-stt.md.

Expected impact. These are estimates.

  • Selection soniox→* connection_lost drops to near the real-dial residue (about 35 per 30 min). The rest reappears under its true skip reason.
  • Soniox replay_ring_overflow from actively transcribing legs (about 50–60 per 10 min) should mostly disappear, which also removes Parakeet and Modulate inflow.
  • The about 40 per 10 min →unavailable exhaustions 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

  • New backend/tests/unit/test_live_selection_skip_causes.py, 15 tests. Of the original 13 run against origin/main sources, 8 fail (typing, release, accounting) and 5 pass (the guards that preserve behavior):
    • a real origin death stays connection_lost with its cause;
    • a provider-evidence death keeps the exclusion;
    • both kill switches restore the old behavior;
    • Modulate is unaffected.
  • The 25 existing related unit files (chain, recovery, ledger rebase, window live, fallback observability, health and router) all pass through backend/test.sh. Layer: hermetic unit tests.
  • scripts/typecheck.sh: 0 errors. Feature-flag registry check: OK.
  • m1 full suite: SCA-903 PASS at 385e3aafba32 (2,059 files, 0 failed); final head: see below.
  • Grok review (grok-4.7-high, read-only): SHIP at 385e3aafba32. Its two cheap residuals are fixed in 4242e32ad5bc: 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 raises RejectedStream(prior_reason), so an excluded origin there says circuit_open. That is a live-session label, and not the exhaustion path.
  • The recovery-off legacy reconnect neither releases overflow exclusions nor paces its replay burst. Its behaviour is unchanged.
  • An undialed capacity_full origin exhaustion now counts under the capacity_full exhausted alert, which has no component filter. At the Q1 mix this is far below its 15% threshold.
  • Not run: live or dev listen sessions. The production effect is to be read after deploy, from omi_fallback_total{component="stt_selection"} by reason, live_stt_chain_exhausted skips, omi_stt_session_local_exclusion_releases_total, and Soniox replay_ring_overflow.

Rollback

  • LISTEN_NONWINDOW_EMITTED_TEXT_ACCOUNTING_ENABLED=false restores placed-text-only accounting.
  • LISTEN_SESSION_LOCAL_EXCLUSION_RELEASE_ENABLED=false restores session-long exclusion.
  • The typing has no switch: it changes label values only. Revert the PR to remove it.

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

View guided diff Turn on auto-fix

Git-on-my-level and others added 3 commits October 20, 2026 07:48
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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T01:28:02.004595Z 4242e32 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines 108 to +109
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])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +65 to +66
if family == serving_family:
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit 8edd56d into main Oct 20, 2026
62 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/listen-selection-skip-causes branch October 20, 2026 02:12
ZhaZhaBei pushed a commit to ZhaZhaBei/omi that referenced this pull request Oct 22, 2026
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]>
Git-on-my-level added a commit that referenced this pull request Nov 22, 2026
## 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant