Repository navigation
live demand gate: skip presence for ineligible sessions, cohort-label fallback, last-known on single miss - #22465
Merged
Conversation
… fallback, last-known on single miss - Non-admitted sessions refresh their sibling-visible presence entry every 10s (lease 30s) instead of every second. Entries are kept, not dropped: an ineligible socket's unknown/visible entry still forces the vendor for a sibling admitted socket of the same user. - record_fallback takes demand_cohort; omi_listen_demand_failure_detail_total gains reason=gate_unavailable. The shared omi_fallback_total schema is unchanged. Gate-unavailable alert pages on the admitted cohort ratio plus a label-independent all-sessions guard (builds on #22459). - Admitted sessions bridge exactly one missed heartbeat with the last good answer within the 30s lease; admission into Parakeet never uses it. update_presence logs a bounded error_class, never the message. Co-Authored-By: Claude Sonnet 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. |
Git-on-my-level
added a commit
that referenced
this pull request
Oct 19, 2026
…d at decide (#22471) Follow-up to #22465 review (SCA-829 lows): - A timed-out non-admitted heartbeat no longer consumes its 10s slot, so consecutive timeouts cannot age a hidden sibling entry out of the 30s lease. - run() folds _presence_unavailable into visible before decide(), so a second miss found by an observe() publish forces the vendor in the same iteration. Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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
The "Live STT - demand gate unavailable" alert has fired chronically (~9.8k events/24h, ~27% of sessions). Root cause (aggregates only, 2026-10-19): 100%
from_mode=demand_presence, i.e. the Redis presence EVAL timing out (100 ms socket / 150 ms wait_for) on a heartbeat that every session, including ineligible ones, sends every second (~35M/day). Consumer check contributed 0. 24h cohorts: admitted 0, eligible_control 1.7k, ineligible 33.8k, so no session was actually routed to vendor because of it (vendor cost impact today: none). Report:data/run-2026-10-13-two-lane-nemotron/live-gate-unavailable-0850Z.mdin the workspace repo.Changes
unknown/visibleentry in the shared per-user hash is what forces the vendor for a sibling admitted socket, so dropping it would change admitted routing. Entries stay inside the 30 s lease; close still writes.record_fallback(demand_cohort=...)feedsomi_listen_demand_failure_detail_total{reason="gate_unavailable"}(closed label set; sharedomi_fallback_totalschema unchanged, per docs). The alert now pages on the admitted-cohort ratio (>10%, >=50 admitted sessions, 15 m) and keeps a label-independent all-sessions guard (>60%, >=100 sessions). Builds on monitoring: page demand-gate-unavailable on ratio over live sessions #22459 (merged).can_admit_window) all stay strict: vendor is the default when the gate is unavailable.update_presencelogsdemand_presence_unavailable error_class=timeout|connection|response|redis_error|other(rate-limited, never the message).Not fixed: whether Redis latency or event-loop starvation causes the timeouts (Redis metrics not visible to the read-only tier; per-pod failures correlate with pod CPU, r=0.79).
How it was verified
Command (layer: unit, nice -n 19, backend venv):
pytest tests/unit/test_live_demand_presence.py test_live_demand_consumers.py test_live_demand_switch.py test_live_demand_telemetry.py test_live_stt_chain.py test_monitoring_alert_rule_contract.py test_monitoring_gmp_shadow.py-> 270 passed. Not verified live; deploy rides the next listen slot with the HPA-min PR. Verify after deploy by the running revision's release SHA, andomi_listen_demand_failure_detail_total{reason="gate_unavailable"}plus thedemand_presence_unavailablelog line.Product invariants affected
none
Failure class (fixes)
No
fix:commits were detected; no declaration is required.🤖 Generated with Claude Code