Skip to content

fix(stt): bound malformed routing permission failures before router ramp - #20741

Merged
Git-on-my-level merged 4 commits into
mainfrom
lane/stt-router-on-ramp
Oct 6, 2026
Merged

Git-on-my-level merged 4 commits into
mainfrom
lane/stt-router-on-ramp

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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

  • All ten new tests in test_live_router_cache_isolation.py fail 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.
  • Existing malformed-allocation regression: 15 failing-on-main cases covering OFF/SHADOW/ON.
  • Focused router/session/health suites through backend/test.sh; make preflight and normal commit/push hooks. Test cloud credentials stripped, isolated CLOUDSDK_CONFIG, synthetic providers/Redis only.
  • Shared cache and fixture primitives close fix(stt): harden cost-router exclusions and shared health #20422 threads 28/29/30/32/34 without adding another admission guard.

Ramp handoff

.local/READINESS.md and .local/GATES.md hold 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.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

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.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Independent review: Codex Luna (gpt-6-luna, read-only) APPROVE on aecaed415c389cea0921180ddc6b02afad439976.

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.

@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 6, 2026 18:15
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Re-run CI against the main that already fixed the five stale fixtures.
Git-on-my-level added a commit that referenced this pull request Oct 6, 2026
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.
@Git-on-my-level
Git-on-my-level merged commit 7cd884e into main Oct 6, 2026
55 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/stt-router-on-ramp branch October 6, 2026 19:12
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