Repository navigation
fix(stt): bound malformed routing permission failures before router ramp - #20741
Conversation
# Conflicts: # backend/docs/listen_pusher_pipeline.mdx
|
Monitor run summary (context 20261005T201418Z): this PR's three failing backend unit checks are upstream-main breakage, not this diff.
Both fail identically on main's own Backend Unit Test runs (e.g. run 37354653886); this PR's own router/readiness/cache-isolation tests pass in the same shard runs. Test-only repair opened as #20748 (all four backend unit shards + suite green there). Once #20748 merges, this PR's shards go green on the next CI run with no change needed here. |
|
Independent review: Codex Luna ( Blocking: none. Checked lock ordering on the cost-interest refresh, cache protection through masking and a Redis outage, and singleton-fixture isolation. No production routing-mode change. 230 focused router tests passed in the reviewer venv. Not merging while CI is red. The remaining red shards are the pre-existing desktop TTS / shared-action-item failures; they will be recorded against main before any merge, and no skip hatch will be used. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Re-run CI against the main that already fixed the five stale fixtures.
Router cohort telemetry previously covered only transcript/no-transcript totals. This draft adds two bounded companion counters for managed live-STT sessions: terminal attempts (including pre-audio initialization failures), completed transcript outcomes, per-session exhausted fallback and terminal-after-text booleans, and completed-session paid adapter audio seconds. Existing metric schemas, routing flags and serving behavior remain unchanged. The sticky UID arm is pinned before initialization. `routing_arm=on|shadow|off`: off includes unassigned UIDs in mode on; shadow stays distinct. Custom STT, BYOK and multi-channel paths remain excluded. Child tasks inherit context; attempts and adapters retain the session object; runtime restores parent context even on error. Paid audio counts accepted adapter PCM, including replay/pre-roll/idle reopen, excludes rejection and idle buffering, and emits once at the same completion seam. It is not vendor billed time or an invoice measurement. ## Validation - Production-seam regressions exercise all arms, invalid percent/fail-open, pre-audio failure, task inheritance, repeated finish/teardown, the recovery-gated TAT predicate, paid live/replay/admitted-successor sends, rejection, Parakeet exclusion, idle buffering/reopen, and context restoration on success/error, final cleanup settlement/audio and subordinate metric faults. - Focused existing chain, router, transcript, fallback, recovery, alert and Soniox suites via `backend/test.sh`; `make preflight`, metadata checks and normal commit/push hooks. Test cloud credentials stripped and CLOUDSDK_CONFIG isolated; no provider/Redis/cloud data calls. - Owning routing runbook documents exact series and scope; coordinator `.local/GATES.md` uses implemented queries. No session first-text/disruption series is claimed. Keep DRAFT. No prod configuration, readiness transition, merge or deploy. Coordinator owns review and live acceptance. Separate blocker fixes remain in #20741. ## Rollback Revert through a normal PR. Existing metrics and routing behavior continue independently; companion metrics require deployment and scrape continuity before use. ## Product invariants affected none Failure-Class: none Line-Count-Exception: backend/routers/listen/runtime.py | 1193 -> 1220 | Pin bounded cohort before initialization and emit completed-session telemetry at the existing teardown seam; restore task context in finally. Line-Count-Exception: backend/utils/stt/live_session.py | 1124 -> 1130 | Observe accepted paid PCM at the shared managed live/replay/admission send boundary without altering sends. Full CI at 4c96c98: unit shards 1/4 and 3/4 fail only on the same five baseline fixture failures reproduced on main cf8201c (four desktop TTS helper/funding fixtures and one shared-action-item patch of removed _wake_task_changes). All 23 new cohort cases passed on Linux in shard 2/4; listen/pusher gauntlet and other completed checks passed. Baseline evidence/follow-up are in the coordinator .local/REPORT.md and .local/FOLLOW_UP_BASELINE_CI.md. No new failure caused by the telemetry change was found.
Malformed window allocation escaped the configured-chain failure boundary; endpoint selection quarantine disappeared after account masking or an OFF refresh; and refresh read cost interests without its owning lock. This draft retains the typed five-second config retry, preserves cached endpoint evidence across masking/OFF and Redis outages, and snapshots interests under the lock. The unit singleton reset now retains its RLock and resets all four family breakers in place.
Keep draft. Coordinator owns review/merge/deployment; no production configuration changes.
Validation
test_live_router_cache_isolation.pyfail against origin/main cf8201c and pass with this change: default/custom endpoint account-expiry and OFF→ON outage cases, authoritative clearing, lock-held interest iteration, singleton lock/reference preservation, and all four family breakers.backend/test.sh;make preflightand normal commit/push hooks. Test cloud credentials stripped, isolated CLOUDSDK_CONFIG, synthetic providers/Redis only.Ramp handoff
.local/READINESS.mdand.local/GATES.mdhold the coordinator handoff. Corrected aggregate-only ro-prod Prometheus access succeeds. Modulate qualification is not a blocker for the default-only first ramp per coordinator decision. Custom-endpoint operator reset (#20422 threads 22/31) is a filed follow-up, outside this draft. Separate cohort instrumentation draft supplies missing terminal/transcript/exhausted/TAT/paid-audio splits. Live acceptance, paid headroom, alert delivery and uniform serving configuration remain coordinator prerequisites.Rollback
Revert through a normal PR. Later routing ramps roll back through the canonical reviewed config path to percent 0 / shadow. This draft changes no routing allocation.
Product invariants affected
none
Failure-Class: none
The triggering cache/concurrency/test-isolation findings are #20422 discussion_r4175455504, discussion_r4175035352, discussion_r4175035349 and discussion_r4175055824; no registry edit is made in this lane.
Line-Count-Exception: backend/utils/stt/live_chain.py | 1066 -> 1079 | Catch malformed hard-permission configuration at the existing configured-chain boundary and emit typed unavailability plus bounded diagnostics in all routing modes.
CI at aecaed4: full unit shards 1/4 and 4/4 plus aggregate are red for five baseline failures, reproduced identically on restored main cf8201c and restored lane. Four desktop TTS fixtures reject check_tts_rate_limit_for_user; one shared-action-item fixture patches removed _wake_task_changes. Evidence and a separately scoped follow-up are recorded in .local/FOLLOW_UP_BASELINE_CI.md. Other terminal checks passed; no STT-caused failure found.