Repository navigation
harden(monitoring): alert on failures that keep every other signal green - #11991
Merged
Merged
Conversation
The 2026-08-19 desktop chat outage ran for roughly 19 hours with no alert.
Nothing an existing rule could observe was down:
- The SSE endpoint committed HTTP 200 and its headers before the generator
ran, then streamed an in-band error frame.
- The gateway rejected those requests during validation, before a route was
selected. Pre-route rejections are counted by
llm_gateway_request_rejections_total, never by llm_gateway_requests_total,
so the chat lane reported 100% success for the whole outage. Verified
against production: the chat-agent lane has 9,702 successes and 0 errors
over the last 7 days.
- omi-journey-chat-fail already existed and is shaped correctly, but
omi_journey_accepted_total{journey="chat_response"} is emitted from the
Cloud Run backend service, which Prometheus does not scrape. It reads 0
over 7 days against 451,358 for pusher_session. The rule could never fire.
- Only one client population was affected; a larger healthy population on
the same endpoint kept every aggregate ratio green.
Five rules, each aimed at one of those mechanisms:
omi-llm-gateway-invalid-request-rejections pre-route rejections, >= 2 / 30m
omi-llm-gateway-lane-failure-ratio > 25% failures, >= 20 reqs / 1h
omi-llm-gateway-lane-zero-success attempts but no success / 6h
omi-journey-signal-dead a journey counter stopped reporting
tz_chat_agent_requests_zero chat lane traffic floor
Every expression was executed against production Prometheus before being
written down. omi-journey-signal-dead returns 0 for pusher_session and
capture_finalization and 1 for chat_response, so it detects exactly the dead
wire that hid this outage. omi-llm-gateway-lane-zero-success returns
A=20, B=0 for omi:auto:translation, a lane that has served 3,780 requests and
zero successes across the full 10-day retention window and is broken right now.
Thresholds come from measured distributions: the quietest hour on
omi:auto:chat-agent over 7 days served 18 requests, p05 was 24, so the traffic
floor is 5. The rejection threshold is deliberately low because the affected
population produced only 2-16 rejections per 30 minutes.
omi-journey-signal-dead deliberately excludes journey="chat_response" until a
Cloud Run ingestion path exists. Adding it now would page permanently and get
muted, which is worse than the gap it describes.
Co-Authored-By: Claude Opus 5 <[email protected]>
Each new rule told the operator to "confirm the condition in the linked panel", but the panels they linked to plotted a different signal. Adds three panels to Resilience / Fallbacks and repoints every rule at the panel that shows its own evidence: 12 LLM gateway pre-route rejections the counter lane success rate cannot see 13 LLM gateway lane success rate zero-filled, so a dead lane plots at 0 14 Journey signal liveness a flat zero means the alert input is dead Panel 13 carries the same `or ... * 0` zero-fill as the alert. Without it a lane that has never succeeded has no series and disappears from the chart entirely, which reads as "no problem" instead of "total failure". A contract test asserts each rule's linked panel actually queries that rule's metric, so the two cannot drift apart. Co-Authored-By: Claude Opus 5 <[email protected]>
An alert that reads a journey counter inherits that counter's failure mode. When the counter dies the rule does not fail loudly, it goes quiet, and quiet is indistinguishable from healthy. omi-journey-chat-fail sat armed and unfirable for its entire existence because its input is emitted from an unscraped Cloud Run process, and a 19-hour outage passed underneath it. Adds a contract test: any rule selecting journey="..." on an omi_journey_* or omi_client_journey_* metric must have that journey inside the liveness rule's selector. The single escape hatch requires a written reason, and a journey may never be both exempt and covered, so the exemption cannot silently rot. chat_response is the one exemption today. The reason names the change that must delete it: whoever gives Cloud Run services a metrics ingestion path. Verified by mutation. Injecting a journey alert on memory_retrieval with no liveness coverage fails the guard with the actionable message; removing it restores 21 passing. Co-Authored-By: Claude Opus 5 <[email protected]>
A rule that would have been noisy in the past week is not ready to page anyone, and a muted rule is worse than no rule. Each of the five rules was replayed against 7 days of production data at 15-minute resolution: invalid-request-rejections 58 / 673 (8.6%) the outage window only lane-failure-ratio 100 / 21314 (0.47%) translation only lane-zero-success 350 / 21472 (1.6%) translation + web-search journey-signal-dead 0 / 1346 no false positives chat-requests-zero 0 / 673 no false positives Every breach is a real defect, not noise. The backtest surfaced a third silent failure: omi:auto:web-search recorded 170 errors and 1 success over 7 days, all error_class=invalid_route_config, going back at least to 08-12. Its only successful request is the most recent data point, after the managed Perplexity lane deployed; traffic since is too thin to call it fixed. It also corrected a threshold claim. The chat traffic floor was measured on hour-aligned samples and reported as 18 requests. At 15-minute resolution the true floor is 9, with p01 15 and p05 23. Zero evaluations fell below 5, so the threshold stands, but the margin is half what the earlier number implied and the runbook now says so. Co-Authored-By: Claude Opus 5 <[email protected]>
kodjima33
approved these changes
Aug 22, 2026
kodjima33
left a comment
Collaborator
There was a problem hiding this comment.
New monitoring/alerting capability (5 new alert rules), not a bug fix to app code — approve-only. Also DIRTY and 1965 lines, well beyond scope for auto-merge.
added 2 commits
August 22, 2026 15:50
…verage # Conflicts: # backend/charts/monitoring/alert-rules.json
…'s bytes The merge of origin/main into feat/journey-alert-coverage ran the local Dart/Prettier formatters against files the merge brought in that this PR does not touch. Restoring them byte-for-byte to origin/main avoids scope creep and unrelated CODEOWNERS.
Git-on-my-level
added a commit
that referenced
this pull request
Aug 31, 2026
…12446) ## Why this change On 2026-08-30 a voice-capture outage left `capture_finalization` success at **0% for hours** while every existing critical stayed Normal: listen ready=5, listen WS≈325, pusher WS≈326, LB traffic flowing, 5xx rps=0. The existing criticals only watch zero LB traffic, zero ready pods, WS < 10, and 5xx rates. The rules that did read user outcomes (`omi-journey-*-fail`, #11991) are **warning-class**, and the [Omi Core Features dashboard](https://monitor.omi.me/d/omi-core-features/omi-core-features) that plots these SLIs is visualization-only — panel thresholds, zero alert rules. **Dashboard ≠ alert**: the signal existed, nothing paged on it. Incident fingerprint (last 1h at peak): `omi_journey_terminal_total{journey="capture_finalization"}` success=0, failure≈360, stale≈290; accepted≈750; oldest unfinished finalization job ≈ 5.9 days; dead letters ≈ 2.5k/24h. ## What was added Six `severity: critical` rules in the `Resilience` group (split source `backend/charts/monitoring/alerts/resilience.json`, mirrored into the combined `backend/charts/monitoring/alert-rules.json`), plus one rule change. Every rule links the Core Features panel that plots its own signal. | Metric / SLI | Existing rule (git = live mirror) | False-negative class this incident hit | New / changed UID | noDataState | Traffic gate | |---|---|---|---|---|---| | `capture_finalization` success share | `omi-journey-capture-fail` (warning, #11991; reads `listen_finalization_durable_jobs` deltas) | warning-class — ticket lane, no page; incident kept it out of the paging path | `omi-journey-capture-success-critical` | `NoData` | ≥ 20 accepted / 30m | | accepted-without-terminal (accepted vs settled) | `omi-capture-finalization-dead-emission` (warning; fires only on **zero** terminal movement) | incident had *flowing* failure/stale terminals, so the zero-terminal condition never applied at page class | `omi-journey-capture-settle-gap` | `NoData` | ≥ 100 accepted / 1h | | `listen_finalization_dead_letter_total` | **missing** (dashboard panel only) | ~2.5k dead letters/day with zero alerts reading it | `omi-capture-dead-letter-surge` | `Alerting` | none — each dead letter is a lost capture (> 50/1h) | | `listen_finalization_oldest_nonterminal_age_seconds` | **missing** (backlog panel from #12211 only) | oldest job aged to 5.9 days with zero alerts reading it | `omi-capture-oldest-nonterminal` | `Alerting` | none — queue age is traffic-independent (> 3600s) | | `pusher_session` success share | `omi-journey-pusher-fail` (warning) | warning-class only | `omi-journey-pusher-success-critical` | `NoData` | ≥ 20 accepted / 30m | | `chat_response` success share | `omi-journey-chat-fail` (warning; unfirable for its whole life before the Cloud Run bridge) | warning-class + counter historically absent from Prometheus | `omi-journey-chat-success-critical` | `NoData` | ≥ 20 accepted / 30m | | journey counter liveness | `omi-journey-signal-dead` covered only `pusher_session\|capture_finalization`; `chat_response` exempt | a dead chat counter would silently disarm every chat alert (the exact 2026-08-19 hole) | `omi-journey-signal-dead` **changed** — adds a `chat_response` arm | `Alerting` | chat arm gated on `llm_gateway_requests_total{lane_id="omi:auto:chat-agent"} > 20/1h` | ### PromQL Success-rate rules pair numerator and denominator from the same emitter (`omi_journey_terminal_total` for one `journey`), gated on that journey's accepted counter (example: capture): ```promql # A — gate sum(increase(omi_journey_accepted_total{journey="capture_finalization"}[30m])) # B — success share (a total terminal stall with real traffic reads 0 and pages) sum(increase(omi_journey_terminal_total{journey="capture_finalization",outcome="success"}[30m])) / clamp_min(sum(increase(omi_journey_terminal_total{journey="capture_finalization",outcome=~"success|failure"}[30m])), 1) # C — $A >= 20 && $B < 0.90, for 10m ``` Settle gap (accepted minus all terminal outcomes, 1h): `$A >= 100 && $B > 50`, for 15m. Oldest job: `max(listen_finalization_oldest_nonterminal_age_seconds) > 3600`, for 15m. Dead letters: `sum(increase(listen_finalization_dead_letter_total[1h])) > 50`, for 15m. Liveness chat arm (added to `omi-journey-signal-dead`): ```promql or (sum by (journey) (increase(omi_journey_accepted_total{journey="chat_response"}[1h])) < bool 1) * on() group_left() (sum(increase(llm_gateway_requests_total{lane_id="omi:auto:chat-agent"}[1h])) > bool 20) ``` ### noData semantics - Success-rate and gap rules: `NoData` (the documented `traffic_gated_journey` class) — missing series are visible as NoData, never healthy; counter death pages via `omi-journey-signal-dead` and `omi-journey-scrape-missing`. - Queue rules (`oldest-nonterminal`, `dead-letter`): `Alerting` — both series are unlabeled and zero-initialized on every backend-listen replica, so absence during real traffic means the emitter or its scrape is gone. Documented as `finalization_queue_health` in `expected-targets.prod.yaml`. ### Threshold calibration (documented in `backend/docs/runbooks/real-traffic-journeys.md`) - 0.90 paging floor vs the dashboard's 95/99 display thresholds; the incident sat at 0%. - ≥ 20 accepted/30m gate (same floor the existing warning rules use); the incident ran ~375 accepted/30m. - Gap > 50/h at ≥ 100 accepted/h: the incident left ~100/h accepted-but-never-settled; healthy in-flight work settles in minutes. - Oldest job > 1h: healthy drain is minutes; incident oldest was ~5.9 days. - Dead letters > 50/h: incident ran ~104/h (2.5k/day). - Chat liveness gate > 20/h sits above the chat-agent lane's measured p05 (min 9, p01 15, p05 23, median 55 req/h over 7 prod days), so quiet hours do not page. These are incident-calibrated initial values; replay them against production history when importing (the repo has no live Prometheus access from a PR-checkout environment). ## Live vs git reconciliation - Live Grafana (issue-verified 2026-08-30 ~23:30 UTC): **68 unified rules**; git before this PR: **80**. The 12-rule delta is recently merged rules not yet imported (Firestore #12193/#12201/#12241, cloud-run ingestion #11998/#12146, etc.) — the documented apply path is a maintainer import of `alert-rules.json`; no CI writes Grafana, and this PR follows that path (no API writes). - The pre-incident journey rules (from #11991, merged 2026-08-22) predate the outage window; their gap was severity class, not presence. - Metric label sets were discovered from the emitter contract, not guessed: `utils/metrics.py`, `utils/observability/journeys.py` (`journey` ∈ {`chat_response`, `pusher_session`, `capture_finalization`}; `outcome` ∈ {`success`, `failure`, `cancelled`, `stale`}), `services/conversation_finalization.py` (unlabeled dead-letter counter, unlabeled oldest-age gauge, `state`-labeled durable gauge), and the closed vocabulary in `backend/docs/runbooks/real-traffic-journeys.md`. Direct live Prometheus/Grafana queries were not available from this environment (auth required); the `chat_response` ingestion path is evidenced by #12146's measured live prod scrape (~28MB, 52,662 `omi_*` series). ## Tests Extended `test_monitoring_alert_rule_contract.py`: - `LIVENESS_EXEMPT_JOURNEYS` is now empty — the `chat_response` exemption's own deletion clause fired once the Cloud Run bridge was verified live; `test_every_alerted_journey_is_covered_by_the_liveness_rule` now enforces chat coverage instead. - New: `test_page_class_journey_rules_cover_the_capture_outage_fingerprint` (severity, component, noData, `for` window, receiver, exact math gates), `test_page_class_success_rules_pair_numerator_and_denominator_from_one_emitter`, `test_finalization_queue_rules_read_the_replicated_series_correctly` (max-aggregation for the replicated gauge). ## Verification ```bash cd backend && .venv/bin/python -m pytest \ tests/unit/test_journey_observability.py \ tests/unit/test_monitoring_alert_rule_contract.py \ tests/unit/test_monitoring_dashboard_absence_contract.py \ tests/unit/test_monitoring_telemetry_contract.py -q # 63 passed (the exact set scripts/select_backend_unit_tests.py selects for these changed files) make preflight # PR preflight passed: 11 checks in 28.55s ``` Closes SCA-379 <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/12446?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
pull Bot
pushed a commit
to AmirulAndalib/omi
that referenced
this pull request
Aug 31, 2026
The 2026-08-30 capture-finalization outage sat at 0% success for hours (failure ~360/h, stale ~290/h, accepted ~750/h, oldest job ~5.9d, dead letters ~2.5k/day) while every listen/pusher critical stayed Normal: they only watch LB traffic, ready pods, WS counts, and 5xx rates. The journey rules that did read user outcomes were warning-class (BasedHardware#11991), and the Core Features dashboard tiles were visualization-only. Add six severity:critical rules plus liveness coverage for chat: - omi-journey-capture-success-critical / -pusher- / -chat-: success share < 0.90 for 10m at >= 20 accepted/30m (numerator and denominator from the same omi_journey_terminal_total emitter) - omi-journey-capture-settle-gap: accepted - settled > 50/h at >= 100 accepted/h for 15m - omi-capture-oldest-nonterminal: max age > 3600s for 15m - omi-capture-dead-letter-surge: > 50 dead letters/h for 15m - omi-journey-signal-dead now covers chat_response behind a chat-agent lane gate (> 20/h, above the lane's measured p05); the LIVENESS_EXEMPT_JOURNEYS entry is deleted per its own instruction now that the Cloud Run metrics bridge is verified live (BasedHardware#11998, BasedHardware#12146) Contract tests pin severity, components, gates, noData semantics, and single-emitter pairing; expected-targets documents the new finalization_queue_health: Alerting no-data class; runbooks updated. Verification: pytest tests/unit/test_journey_observability.py tests/unit/test_monitoring_alert_rule_contract.py tests/unit/test_monitoring_dashboard_absence_contract.py tests/unit/test_monitoring_telemetry_contract.py -> 63 passed; make preflight -> 11 checks passed. Co-authored-by: multica-agent <[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.
What this does
Adds five Grafana alert rules for production failures that keep every existing signal green,
plus a runbook that explains each mechanism.
Why
The 2026-08-19 desktop chat outage ran for roughly 19 hours before a human noticed. Nothing that
any existing rule could observe was down. Four independent mechanisms hid it, and each one is a
general failure mode rather than a one-off:
1. A 2xx committed before the failure happened. The SSE endpoint writes
HTTP 200and itsheaders, then runs the generator. The generator yielded an in-band error frame followed by
data: [DONE]and returned normally. Every status-code monitor read the turn as a success.2. The failure was counted somewhere nobody watched. The gateway rejected these requests during
request validation, before a route was selected. Pre-route rejections increment
llm_gateway_request_rejections_total, neverllm_gateway_requests_total. Verified againstproduction Prometheus:
Zero errors. For the entire outage the chat lane reported 100% success. Any alert built on a
success ratio over
llm_gateway_requests_totalwas structurally incapable of firing.3. The alert that should have caught it had a dead wire.
omi-journey-chat-failalready existsand is shaped correctly. But its input is empty:
backend/routers/chat.py:529does emitJourneyAttempt('chat_response')— from the Cloud Runbackendservice, which Prometheus does not scrape. Prometheus scrapes GKE pods only. The counterhas been flat at zero for its whole existence. The rule did not fail loudly; it went quiet, which
looks exactly like health.
4. A healthy majority masked a dead minority. One client population failed 100% of turns while
a larger population on the same endpoint stayed healthy, keeping every aggregate ratio green.
The rules
omi-llm-gateway-invalid-request-rejections>= 2in 30m, for 30momi-llm-gateway-lane-failure-ratio$A >= 20 && $B > 0.25over 1homi-llm-gateway-lane-zero-success$A >= 20 && $B < 1over 6homi-journey-signal-deadtz_chat_agent_requests_zero< 5requests in 1h, for 30mWhere an operator looks
Three panels were added to Resilience / Fallbacks, and every rule now links to the panel that
plots its own evidence rather than a neighbouring one:
A contract test asserts each rule's linked panel actually queries that rule's metric, so the alert
and the dashboard cannot drift apart.
Proof, not assertion
Every expression was executed against production Prometheus before it was written into a rule.
omi-journey-signal-deaddetects the exact dead wire that hid this outage. Running itsexpression with
chat_responseadded to the selector:omi-llm-gateway-lane-zero-successfinds a live problem nobody is watching.omi:auto:translationhas served 3,780 requests and zero successes across the full 10-dayPrometheus retention window — every one a
provider_request_rejected/other_4xxfromgemini-2.5-flash-lite,phase="before_output", no gateway fallback. Its rule inputs evaluateto
A = 20.03, B = 0.0, so the rule fires.To be precise about impact, because the lane counter alone would overstate it: translation has an
application-level provider chain, and NLLB is absorbing the traffic. End to end,
omi_translation_requests_totalshows 91,269 requests in 24h, all served bynllb, with 834requests where both providers errored. So this is not a user-facing translation outage — it is a
primary provider that has been failing 100% of the time for at least ten days, with the product
silently running on its fallback and no redundancy left. That is worth knowing and nobody knew it.
It needs its own fix; I have not touched it here.
The
or ... * 0zero-fill in that rule is load-bearing: a lane that has never succeeded has nooutcome="success"series at all, so a plain ratio produces no series and therefore no alert.Total failure would be invisible without it.
Thresholds are measured, not guessed
omi:auto:chat-agentover the preceding 7 days, sampled at 15-minute resolution: floor 9requests/hour, p01 15, p05 23, median 55. Zero evaluations below 5. The traffic floor is set to 5.
(An earlier revision of this PR said the floor was 18. That came from hour-aligned sampling, which
misses partial windows. The threshold stands but the margin is half what that number implied.)
The rejection threshold is deliberately low because the affected population was small — it produced
only 2–16 rejections per 30 minutes. A rate threshold sized for the busy path would not have fired.
The 6h window on the zero-success rule exists because several lanes are idle most hours;
omi:auto:translationhas a median of 0 requests/hour and only crosses a 20-request gate in 24 of168 hours. The 1h and 6h rules run together: fast on busy lanes, eventually correct on quiet ones.
Deliberate omission
omi-journey-signal-deaddoes not includejourney="chat_response", and there is a testasserting it does not. That counter is emitted from Cloud Run and will read zero until an ingestion
path exists. Adding it now would page permanently and get muted, which is worse than the gap it
describes. It goes in with the Cloud Run ingestion change.
Verification
Five new contract tests pin the expressions, the zero-fill, the
Alertingno-data state, themeasured threshold, and the chat_response omission.
Backtest — replayed against 7 days of production
A rule that would have been noisy in the past week is not ready to page anyone, and a muted rule is
worse than no rule. Every rule was replayed at 15-minute resolution:
omi-llm-gateway-invalid-request-rejectionsomi-llm-gateway-lane-failure-ratioomi:auto:translationonlyomi-llm-gateway-lane-zero-successomi:auto:translationandomi:auto:web-searchomi-journey-signal-deadtz_chat_agent_requests_zeroEvery breach in that table is a real defect, not noise.
The backtest found a third silent failure.
omi:auto:web-searchrecorded 170 errors and 1success over 7 days, every failure
error_class="invalid_route_config", going back at least to08-12. Its single successful request is the most recent data point in the series, after the managed
Perplexity lane deployed — traffic since has been too thin to call it fixed. Nine days of a
completely dead lane, unnoticed.
Follow-ups this does not do
single highest-value fix remaining. Separate PR in progress.
omi:auto:translationis 100% broken and needs a real fix.desktop-backendhas noMETRICS_SECRET, so its/metricsreturns 401.Failure-Class: none