Repository navigation
fix(monitoring): prepare oldest-age alerts and production import routing - #24938
Conversation
Failure-Class: none
Failure-Class: none
Failure-Class: none
Failure-Class: none
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
All reported issues were addressed across 10 files
You’re at about 99% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c144913b1b
ℹ️ 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".
| "type": "prometheus", | ||
| "uid": "prometheus" | ||
| }, | ||
| "expr": "(count(omi_batch_projection_obligation_oldest_age_seconds > 0 and (max_over_time(omi_batch_projection_obligation_oldest_age_seconds[1h]) - min_over_time(omi_batch_projection_obligation_oldest_age_seconds[1h]) == 0)) or vector(0)) + (count(omi_batch_pipeline_vendor_held_oldest_age_seconds > 0 and (max_over_time(omi_batch_pipeline_vendor_held_oldest_age_seconds[1h]) - min_over_time(omi_batch_pipeline_vendor_held_oldest_age_seconds[1h]) == 0)) or vector(0)) + (count(omi_summary_debt_oldest_age_seconds > 0 and (max_over_time(omi_summary_debt_oldest_age_seconds[1h]) - min_over_time(omi_summary_debt_oldest_age_seconds[1h]) == 0)) or vector(0)) + (count(omi_demand_processing_queue_age_seconds > 0 and (max_over_time(omi_demand_processing_queue_age_seconds[1h]) - min_over_time(omi_demand_processing_queue_age_seconds[1h]) == 0)) or vector(0)) + ((time() - max(omi_summary_debt_sample_timestamp_seconds) > bool 3600) or vector(1))", |
There was a problem hiding this comment.
Exclude former summary samplers from the flat-age count
When the summary-repair lease moves between live replicas, this counts a former sampler's retained positive age as frozen even while the current sampler is updating successfully. In backend/services/summary_debt_repair.py, tick() returns without resetting gauges when claim() loses, and only the winning invocation updates delivery.OLDEST and delivery.SAMPLED_AT. Consequently, a healthy handoff can leave the old replica's age constant indefinitely, triggering this warning after an hour; the separate fleet-wide timestamp check does not suppress that count. Filter the summary-age arm using its matching replica's sample freshness or select the current winning sampler, consistent with the existing contract in backend/docs/runbooks/summary-guarantee.md.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 20213fb59ddf.
The summary-age arm now requires its matching replica's omi_summary_debt_sample_timestamp_seconds to be younger than 300s, consistent with the summary-guarantee runbook. A fleet-wide timestamp cannot qualify a retained former sampler. Engine cases cover healthy lease handoff and a fresh timestamp from another replica; neither revives a stale/unmatched age. Optional producer blindness is separate enablement-aware runbook debt.
Validation: all 14 oldest-age tests passed through bin/omi-heavy at 2026-11-08T23:17Z, including four real Prometheus engine regressions covering 53 synthetic scenarios. Regeneration/lint and all 51 publication preflight checks passed. No production import or lifecycle change.
Failure-Class: none
Keep known backlog pages paused with explicit recovery criteria, accommodate worker sampler cadence, and route BYOK dwell as a muted warning. Failure-Class: none
Failure-Class: none
Failure-Class: none
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 492171a138
ℹ️ 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".
| "type": "prometheus", | ||
| "uid": "prometheus" | ||
| }, | ||
| "expr": "(count(omi_batch_projection_obligation_oldest_age_seconds > 0 and (max_over_time(omi_batch_projection_obligation_oldest_age_seconds[1h]) - min_over_time(omi_batch_projection_obligation_oldest_age_seconds[1h]) == 0)) or vector(0)) + (count(omi_batch_pipeline_vendor_held_oldest_age_seconds > 0 and (max_over_time(omi_batch_pipeline_vendor_held_oldest_age_seconds[1h]) - min_over_time(omi_batch_pipeline_vendor_held_oldest_age_seconds[1h]) == 0)) or vector(0)) + (count(omi_summary_debt_oldest_age_seconds > 0 and (max_over_time(omi_summary_debt_oldest_age_seconds[1h]) - min_over_time(omi_summary_debt_oldest_age_seconds[1h]) == 0)) or vector(0)) + (count(omi_demand_processing_queue_age_seconds > 0 and (max_over_time(omi_demand_processing_queue_age_seconds[1h]) - min_over_time(omi_demand_processing_queue_age_seconds[1h]) == 0)) or vector(0)) + ((time() - max(omi_summary_debt_sample_timestamp_seconds) > bool 3600) or vector(1))", |
There was a problem hiding this comment.
Gate summary freshness checks on repair enablement
When summary repair is intentionally disabled, including the code/dev defaults and the supported kill-switch rollback, this freshness arm keeps the entire alert firing despite healthy samplers. config/summary_guarantee.py::repair_enabled() defaults to false, and services/summary_debt_repair.py:106–107 returns before updating SAMPLED_AT in that state. The timestamp therefore remains zero, becomes stale, or is absent, each of which makes this arm contribute 1 indefinitely. Gate this check on whether repair is expected to run, or provision it only for enabled deployments, so disabling an optional producer does not permanently mask the other sampler-health signals behind a false warning.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 20213fb59ddf.
Removed the independent summary freshness failure entirely. Missing, zero or stale timestamps no longer contribute 1; summary flat ages are excluded unless their own replica sample is younger than 300s. The runbook records unknown coverage and a separate future freshness rule requiring an expected-producer/enablement signal. Disabled/zero, absent, stale and healthy-handoff engine controls pass.
Validation: all 14 oldest-age tests passed through bin/omi-heavy at 2026-11-08T23:17Z, including four real Prometheus engine regressions covering 53 synthetic scenarios. Regeneration/lint and all 51 publication preflight checks passed. No production import or lifecycle change.
Keep paused dwell clauses as strict known gaps and declare the reviewed BYOK warning tier. Preserve the separate fleet coverage failure for the three gated pauses. Exclude helper modules from the bounded push test fallback without changing its cap. Failure-Class: none
Failure-Class: none
Require 55 minutes of per-series timestamp history in the one-hour window. Remove the optional summary producer freshness failure and exclude stale former summary samplers. Pin startup, pending, replica and enablement behavior with offline Prometheus fixtures. Failure-Class: none
…#24978) ## Problem The production monitoring import [run 42585257121](https://github.com/BasedHardware/omi/actions/runs/42585257121) failed its live verification on the three gated rules intentionally paused under [#24938](#24938), ruling 699300. The verifier required every live rule to be unpaused even when the committed source required a pause. ## Change Compare live `isPaused` against the committed source in the shared definition comparator. An explicit source `isPaused=true` authorizes a live pause; other source values require live `false`. Both the per-rule check and fleet gate use this comparison. Matching paused rules remain listed in `PRESENT_BUT_PAUSED` and count as matching. A committed pause with a live unpause **fails**, because unpausing bypasses the reviewed hold and its recovery criteria. Missing/malformed live pause state also fails. Missing rules and all existing query, routing and definition drift checks remain failures. No rule is unpaused, no source rule is changed, and no `.github` workflow is changed. ## Validation - Unit coverage exercises all four boolean pause combinations in both per-rule and fleet checks (`gated` and `all`), rejects missing/nonboolean live states, and preserves missing-rule and other-definition-drift failures for intentionally paused rules. - Production/development live-STT import fixtures require the exact three approved source pauses to pass without hiding their paused report. - `omi-heavy run -- .venv/bin/python -m pytest -q tests/unit/test_verify_pusher_live_alert_route.py tests/unit/test_provision_monitoring_alerts.py` from `backend/`: **155 passed**, 17.44s pytest wall time on commit `1e1a923a917e09a4e818c78dd0ad3e1a6edd3dfe`. - `scripts/failure-class validate --pr-body-file .agent-brief/verifier-paused-pr-body.md --base origin/main --head HEAD --format text`: passed. - `omi-heavy run --wait 3600 -- make preflight`: **36 checks passed**, 714.67s, on the same commit. - Required credential-scrubbed `git push` with `BACKEND_UNIT_FILE_BUDGET_SECONDS=900` and `OMI_PR_BODY_FILE`: **passed**. Its 36 manifest checks passed (1051.02s); backend Pyright reported **0 errors** (existing warnings remain); all **14 selected unit files / 2378 tests passed** in isolated file processes; pinned Python formatting passed. No check was skipped via an override. A green **production proof run needs the next prod monitoring import (batched David gate)**. No workflow dispatch, Grafana write/readback, production notification proof or deployment is performed in this PR. ## Product invariants affected none — this change corrects an operational definition verifier; it changes no application behavior, account data or alert source disposition. Failure-Class: none The existing alert/query and operator-prerequisite classes describe different contracts. This change addresses source-approved pause state comparison and pins it in the shared verifier's behavioral test suite. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/24978?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="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/24978?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24978&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. --> 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Published correction 20213fb, verified 2026-11-08T23:33:16Z; PR OPEN/unmerged, zero review requests. Review-desk FIX-FIRST findings are fixed: 55-minute per-series observation history, no optional-summary freshness failure, and same-replica summary freshness filtering. All 14 requested monitoring/store suites passed (535 tests, no skips), including 53 real Prometheus scenarios. Complete guarded push hooks passed. Exact-head CI is GREEN: 64 terminal checks, 0 pending/failed. No production action or lifecycle state change.
Symptom and evidence
The N5 scope report measured held assignment age 881815s, quarantine-held age 1835094s, and corrupt record-pending age ~1.794e9s (~57 years) during 2026-11-08T14:03–14:10Z. Held-content snapshot was 6859s stale at 14:08Z, with oldest published age 3678199s (42.6d). An approximately zero enqueue clock poisons the held-age sample.
The aggregate Grafana dry-run measured 66 unprovisioned/changed rules at 2026-11-08T14:05–14:59Z: 17 firing, including five real backlog pages and a false queue-blind page. Worker-plane sampler cadence was ~514s, exceeding the prior 120s freshness budget. BYOK age was 219900s, below 259200s but predicted to cross in ~11h if it keeps aging. These are the reports' historical measurements, not fresh production measurements in this lane.
Evidence: workspace
data/run-2026-11-08-retro-fixnow/out-n5-scope.md§§4–5 (source0dc944b9e02) andout-grafana-dryrun.md(rules at2958b7c1b369, baseline027a61e0e951). Import preparation authorized by lane-owner relay of lead2 ruling 699300, 2026-11-08T15:13Z, superseding the dry-run's proposed BYOK page disposition.Change
limit(1)per RPC. Metrics sampler fix, not a lifecycle point fix: no row writes, transitions, admission or lifecycle decisions. P3 freeze respected; drain/new-cohort sampling unchanged. Invalid prefixes require additional read-only document reads.omi-oldest-age-gauge-flat-1h: positive per-series projection-obligation/vendor-held/summary-debt/demand-processing ages with equal 1h maximum and minimum AND an observation at least 3300s old in that window, usingtime() - min_over_time(timestamp(age)[1h:1m]) >= 3300. Summary ages also require the matching replica timestamp younger than 300s. Positive total for 10m, noData OK. No absent/stale summary-timestamp failure arm; enablement-aware producer-blindness is separate runbook debt. Freshness companions named in verification.omi-held-content-snapshot-stale: newest fleet snapshot timestamp older than 3600s for 10m; missing snapshot Alerting. Both new rules are active warning/tier agent/audience agent withomi-tier-silent.omi-batch-queue-safety-blind: freshness arm 120s → 900s, retaining 5m pending, page routing and other query arms. Producer cadence and adapter freshness do not change.omi-finalization-byok-dwell-pageretains UID, >259200s/1h threshold and source freshness; now active warning/tier agent/audience agent,omi-tier-silent, sibling warning notification timings.The reviewed lifecycle test inventory records BYOK's agent tier and eleven explicit strict known-gap clauses while the borrowed backlog pages are paused under ruling699300. The active-alert assertion is unchanged: each gap remains genuinely red, real unpause produces strict XPASS and forces debt-record removal, and an unreviewed pause still fails. The pre-push fallback now selects pytest filenames, excluding support modules/conftest that collect zero tests; the existing cap regression covers both test-name forms and helper-only changes. Its cap and full-CI requirement are unchanged. The separate fleet-verifier tests now expect exactly the three intentional gated-pause errors; the runtime verifier remains fail-closed. No state/exit/deadline or lifecycle decision is changed.
Day-1 page list
These are all active tier=page rules in the full import. Every row's receiver is explicitly listed; a row is eligible to notify only if its condition and pending window fire. This is routing inventory, not a claim that every row fires at import. The 12 rows marked
new/changed setare the retained page guards in the dry-run's 66-rule set; other rows were already in the baseline. Four new/changed page guards remain unevaluable from GMP (N1 debt below). Agent-tier rules, including BYOK and both N5 sampler rules, are muted.tz_parakeet_rps_zerotz_backend_listen_lb_zerotz_backend_listen_pods_zerotz_pusher_connections_zerotz_backend_cloudrun_zerotz_chat_agent_requests_zeroomi-journey-capture-success-criticalomi-journey-pusher-success-criticalomi-journey-chat-success-criticalomi-stt-chain-exhausted-pageomi-stt-provider-budgetomi-soniox-budget-exhaustedomi-slo-live-criticalomi-slo-chat-criticalomi-slo-pusher-criticalomi-datasource-prometheusomi-datasource-cloud-monitoringomi-datasource-gmpomi-capture-summary-never-publishedomi-stt-no-full-stage-targetomi-sync-provider-budget-exhaustedomi-device-wal-backlog-over-capomi-device-wedge-count-capomi-batch-queue-safety-blindomi-batch-vendor-overflow-spendomi-finalization-pair-driftomi-pipeline-upload-503-stormomi-pipeline-firestore-contentionomi-pusher-storage-queue-criticalomi-pusher-memory-working-set-highomi-batch-held-backlog-growingomi-enrichment-queue-depth-pageomi-stt-vendor-benched-pageomi-incluster-guard-unsafe-pageomi-modulate-credit-pageHistorically firing page rules are paused; the queue-blind cadence fix should remove its healthy-cycle false positive. Current firing state must be rechecked at deployment. Existing baseline rules were not re-evaluated by the 66-rule dry-run.
Paused at import
Pausing withholds these five known-debt pages while #24731/#24893 drain owners track recovery. No automatic unpause; each requires a separate approved source/provisioning change. Missing/stale observations do not count as recovery.
omi-pipeline-held-row-ageomi-batch-unit-unpublished-2homi-enrichment-fresh-dwellomi-record-pending-dwellomi-pipeline-projection-drain-stallDebt: 22 rules not evaluable from GMP until N1 scrape fixes land
The dry-run could not query the in-cluster-only series through the ro-prod bot; these verdicts are fires-unknown, not healthy. Retro N1 owns listen/pusher scrapes and token, PodMonitoring and record-seal crashloop recovery. Four listed page-tier guards are expected to remain blind until their series exist; verify directly against Grafana's actual in-cluster datasource before import rather than treating GMP absence as acceptance.
omi-scrape-backend-listen-metricsomi-scrape-pusher-metricsomi-scrape-llm-gateway-metricsomi-scrape-dg_engine_metricsomi-scrape-stackdriver-metricsomi-scrape-cloud-run-application-metricsomi-scrape-gpu-metricsomi-scrape-parakeetomi-scrape-record-seal-worker-metricsomi-scrape-batch-pipeline-worker-metricsomi-scrape-diarizer-batch-metricsomi-stt-enabled-state-unknownomi-stt-evidence-lossomi-stt-pressure-sampler-stuckomi-stt-snapshot-unreadyomi-stt-stage-disagreementomi-stt-vendor-benched-pageomi-modulate-credit-pageomi-pusher-storage-queue-warningomi-pusher-storage-queue-criticalomi-pusher-storage-pcm-refusalsomi-pusher-memory-working-set-highExpected firing and design questions
From the historical baseline, snapshot-stale will enter Alerting after 10m if its measured 6859s stall persists, silently at agent tier. Known backlog pages remain paused; BYOK remains silent even when its dwell threshold crosses. Existing retry-age, lifecycle scan-blindness and sentinel warnings remain active agent-muted debt.
Review-desk FIX-FIRST correction: all four series families require at least 55 minutes of per-series timestamp history within the 1h window (1m subquery, five-minute scrape/grid tolerance). This proves an observed span, not continuous scrape coverage, and cannot combine replicas. The existing 10m pending period remains. The standalone summary freshness arm, including
or vector(1), is removed entirely: intentional absence, zero or staleness of this optional producer cannot independently fire the rule. Summary flat-age counts require the same replica's sample younger than 300s, excluding retained former lease holders undersummary-guarantee.md:109–115. Separate runbook debt: add an enablement/expected-producer signal and a dedicated freshness rule before claiming summary-debt blindness coverage. Current production enablement is not measured here. Offline Prometheus fixtures cover startup, 55-minute eligibility, pending/fire/recovery, cadence, replica separation, disabled/absent/stale timestamps and lease handoff. Review-thread replies are authorized; no review requests or production actions.Deploy, readback and rollback (not performed here)
grafana_dashboard_provisioning.ymlwithenvironment=prod. A main push provisions dev only; live-STT egress import does not carry the N5 rules. No workflow edits or dispatches in this PR.verify_pusher_live_alert_route.py:585–591,664–684); report that debt to the import owner rather than unpausing known backlog to satisfy it. Full provisioning preserves the approved pauses. Read back production definitions with the provisioner without--apply. Require no drift: both N5 UIDs and queries/no-data states, all five pause flags and unpause annotations, queue-blind >=900s, BYOK warning/agent mute, preserved thresholds, receiver routing. Recheck signals on the actual datasource, including the 22 N1-debt rules. Then verify fresh snapshot publication and gauge behavior. Offline tests prove no live notification delivery.Validation and publication
TZ=UTC,OMI_PR_BODY_FILEand 900s backend file budget throughbin/omi-heavy.bin/omi-heavy(320 tests).PROMTOOL_BINalso executed the two older optional semantic regressions. These are two isolated runner commands on the same correction SHA, not a single combined pytest session.fadad03099acbf133fa6461f8f928d606cf6a236at 2026-11-08T19:20:24Z, covers the overdue flag and UTC date. Merged origin/main without rebasing before publication; no own registry metadata or.github/edits.scripts/pr-preflight --suggest, draft-body metadata validation and complete publication checks passed. Four related review threads received correction/validation replies. Earlier source-audio CPU-budget timing instability and prior-head retries are recorded in the implementation report; no assertion, duration limit or allowlist was weakened.Failure-Class: none
This observability/sampler and import-disposition change does not match an existing lifecycle/admission failure class. It changes no lifecycle decision or user row and adds no
.github/definition under the lane boundary. Regression coverage pins invalid-clock walking, query observation history, optional-producer freshness, replica matching, inventory, preserved thresholds, pause recovery criteria and silent agent routing.