Skip to content

monitoring: page demand-gate-unavailable on ratio over live sessions - #22459

Merged
Git-on-my-level merged 1 commit into
BasedHardware:mainfrom
Git-on-my-level:fix/gate-unavailable-ratio
Oct 19, 2026
Merged

Git-on-my-level merged 1 commit into
BasedHardware:mainfrom
Git-on-my-level:fix/gate-unavailable-ratio

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Switch "Live STT - demand gate unavailable" (omi-stt-gate-unavailable) from an absolute event count to a ratio over live sessions with a volume floor, so it pages on escalation instead of flapping on the chronic level.

Why

The rule from #22134 fired on ≥50 gate_unavailable events per 5m. That count is chronic: 0–101 per 5m all night on 2026-10-18/19, so the alert flapped (Alerting 08:44Z). Measured read-only on 2026-10-19:

  • All gate events come from from_mode=demand_presence (presence store update_presence() reporting unavailable in LiveDemandRouting.publish()); the consumer path contributes 0.
  • Live sessions ending per 15m (omi_live_session_transcript_outcome_total): ~462, of which 446 ineligible, 18 eligible_control, 0 admitted.
  • gate_unavailable / live sessions at 15m windows over 24h (97 points): p10 9.6%, p50 23.9%, p90 50.5%, max 76.6%.

Change

  • Query: gate_unavailable events (15m) / clamp_min(live sessions (15m), 1), AND live sessions ≥ 100 per 15m.
  • Threshold: > 0.60, for: 15m, range 15m. Severity, routing and noData unchanged.
  • Threshold annotation records the baseline and that the rule should narrow to eligible cohorts once the fallback event carries demand_cohort (owner: two-lane root-cause work).
  • Contract test asserts the ratio, volume floor, threshold and for.

Decided with the two-lane/Nemotron lead (option a); the cohort-scoped version (c) follows their label change.

Product invariants affected

none

UI-Evidence: none -- alert rule change only.

How verified

  • Backtest of the exact expression at 1m steps over the last 24h: max 0.843; zero runs above 0.6 lasting ≥15m, so it stays quiet on the chronic level.
  • pytest monitoring contract/provisioning/GMP/backtest/notification/telemetry suites: 187 passed (Google credentials stripped).
  • provision_monitoring_alerts.py --lint: 141 definitions validated. alert_backtest.py --lint: 0 failures.

Rollback

Revert this commit and re-run Grafana prod provisioning.

🤖 Generated with Claude Code

View guided diff

The absolute >=50/5m count flapped on a chronic presence-gate level
(p50 ~24% of live sessions). Fire at >60% for 15m with >=100 sessions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 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-19T09:05:18.849317Z a661b44 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: a661b44288

ℹ️ 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".

"uid": "prometheus"
},
"expr": "sum by (to_mode) (increase(omi_fallback_total{job=\"backend-listen-metrics\",component=~\"stt_selection|stt_live_session\",to_mode=\"vendor\",reason=\"gate_unavailable\",outcome=\"degraded\"}[5m]))",
"expr": "(sum(increase(omi_fallback_total{job=\"backend-listen-metrics\",component=~\"stt_selection|stt_live_session\",to_mode=\"vendor\",reason=\"gate_unavailable\",outcome=\"degraded\"}[15m])) / clamp_min(sum(increase(omi_live_session_transcript_outcome_total{job=\"backend-listen-metrics\"}[15m])), 1)) and on () (sum(increase(omi_live_session_transcript_outcome_total{job=\"backend-listen-metrics\"}[15m])) >= 100)",

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 Match numerator and denominator session populations

When the presence store is unavailable and custom-STT sockets are active, this ratio counts different populations: _initialize_stt() attaches and publishes live demand before the custom-STT early return (backend/routers/listen/receiver.py:1277-1284), and that publish emits the selected gate_unavailable fallback, while _record_session_transcript_outcome() deliberately skips custom-STT sockets (backend/routers/listen/runtime.py:431-432). In a window with at least 100 ordinary outcome samples, sustained custom traffic can therefore push the ratio over 0.60 without adding any denominator samples, so a fixed outage can start paging solely because the traffic mix changed; filter/tag the numerator or normalize by a counter covering the same sockets.

Useful? React with 👍 / 👎.

"uid": "prometheus"
},
"expr": "sum by (to_mode) (increase(omi_fallback_total{job=\"backend-listen-metrics\",component=~\"stt_selection|stt_live_session\",to_mode=\"vendor\",reason=\"gate_unavailable\",outcome=\"degraded\"}[5m]))",
"expr": "(sum(increase(omi_fallback_total{job=\"backend-listen-metrics\",component=~\"stt_selection|stt_live_session\",to_mode=\"vendor\",reason=\"gate_unavailable\",outcome=\"degraded\"}[15m])) / clamp_min(sum(increase(omi_live_session_transcript_outcome_total{job=\"backend-listen-metrics\"}[15m])), 1)) and on () (sum(increase(omi_live_session_transcript_outcome_total{job=\"backend-listen-metrics\"}[15m])) >= 100)",

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 Show the normalized signal in the linked panel

When this alert fires and an operator follows its dashboard link, panel 2 still plots only sum by (component, outcome) (rate(omi_fallback_total[5m])) (backend/charts/monitoring/dashboards/omi-services/resilience-fallbacks.json:131), with neither the new 15-minute session denominator/volume floor nor the reason and to_mode filters. Because monitoring notifications rely on the linked panel rather than screenshots, the panel cannot show whether the 0.60 condition actually fired or distinguish this gate signal from other degraded fallbacks; add the exact ratio to that panel or link a matching panel.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit d716040 into BasedHardware:main Oct 19, 2026
52 checks passed
Git-on-my-level added a commit that referenced this pull request Oct 19, 2026
… fallback, last-known on single miss (#22465)

- 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]>
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