Skip to content

fix: page on critical batch and vendor failures - #24538

Merged
Git-on-my-level merged 11 commits into
mainfrom
lane/alertfix
Nov 6, 2026
Merged

Git-on-my-level merged 11 commits into
mainfrom
lane/alertfix

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Critical batch and vendor failures had no verified paging path: batch timeliness was parked in pending/, agent-tier notifications are always muted, and guard failures stopped at logs and ConfigMaps. This promotes the 2h batch rule and gates five page-tier rules for held-backlog growth, enrichment depth, paid-vendor benches, credit refusals and unsafe guard verdicts. All gate UIDs use the existing workflow import/read-back path; there are no .github/ changes.

Guard logs now emit a bounded page_signal boolean, including batch observer trips that do not fail the Parakeet Job. A declared Cloud Logging counter feeds the guard rule; no Grafana rule scans raw logs. The runbook includes thresholds, actions, exact deployment prerequisites and rollback.

The shared importer excludes the two production-native Cloud Monitoring rules from development, avoiding cross-project queries or assuming an unverified development datasource. Production imports and fleet read-back retain both.

Failure-Class: FC-grafana-alert-import-omits-gated-rules

Why isn't this a shared primitive instead? The fix uses the existing shared gate/import primitive and tests its complete set. The regression test exercises actual Grafana expression nodes and the actual guard logging function. It covers the Nov3 incident where an overdue batch unit and guard trips had no human notification route.

Validation: all 576 targeted backend cases passed in the resumed lane through backend/test.sh (9 files, one worker, omi-heavy, nice -n 19). All 36 serial preflight checks passed on the final commit in 1807.86s, followed by the complete bounded pre-push gate, including the three changed backend test files. The seven-rule saved replay and five vendor-runway tests also passed. Seven-day aggregate replay requests at 60s resolution used ro-prod in the interrupted lane; this resume made no new GCP reads. No production writes or account-record reads.

Rule History episodes Nov3 episodes Synthetic normal 24h
Batch >2h 1 1 0
Held backlog growth 1 1 0
Enrichment depth 1 1 0
Paid vendor bench 9 3 0
Modulate credit refusal (new) 0; synthetic single-close fires 0 0
Soniox credit refusal (existing 5m page) 5 (Nov2) 0 0
Guard unsafe verdict 53 (legacy-log counterfactual) 1 0

Evidence limits: batch history starts Nov3 and enrichment Nov1; they do not have seven complete historical days. Local Prometheus supplies seven days for STT/finalization; GMP-only reads miss these local listen series. Synthetic controls are labeled as such. The new guard counter has no backfilled history; its replay maps only aggregate legacy TRIP/BLIND/error log events. Persistent failures account for high firing time; the guard mapping's 53 episodes/week is explicitly exposed for review.

The 15m credit research query groups Soniox's Nov2 refusals into two periods; the existing rule's exact 5m query produces five episodes. Keeping that already-active rule avoids a second Soniox notification stream. Modulate has no observed 402s in the week; its single-close synthetic incident fires and its observed zero week is quiet.

Lead-owned deploy after merge: create/update guard-unsafe.log-metric.json, deploy the guards at the merged SHA, then dispatch the existing metrics-egress workflow for prod. Its main-push default is development. Verify definitions, a natural unsafe counter event and receiver delivery separately; merging alone proves none of these. Telegram is the current page receiver and is not a DND wake service.

The vendor-runway watcher lives in omi-workspace. A tested companion patch makes blind results fail nonzero while preserving exports; the lead must install it into the supervised coord snapshot. It is not silently copied into this product repository.

Finalization blocked-BYOK dwell and dead-letter alerts are owned by PR #24533 (finaldwell); the resumed lane removed its duplicate stock rule per the handoff. Include #24533 in release qualification.

View guided diff Turn on auto-fix

Promote batch timeliness, gate critical backlog and vendor signals, and
export bounded guard failure logs for a page-tier metric rule.

Failure-Class: FC-grafana-alert-import-omits-gated-rules
Promote batch timeliness, gate critical backlog and vendor signals, and
export bounded guard failure logs for a page-tier metric rule.

Failure-Class: FC-grafana-alert-import-omits-gated-rules
Promote batch timeliness, gate critical backlog and vendor signals, and
export bounded guard failure logs for a page-tier metric rule.

Failure-Class: FC-grafana-alert-import-omits-gated-rules
Failure-Class: FC-grafana-alert-import-omits-gated-rules

Keep enrichment and guard Cloud Monitoring queries on the production import
path, preserve detached development definitions, and update batch apply docs.
Remove the duplicate dead-letter stock page and reference #24533.

@cubic-dev-ai cubic-dev-ai 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.

5 issues found across 13 files

Confidence score: 3/5

  • verify_pusher_live_alert_route.py can silently exclude the new production pages when the accepted Grafana URL has a trailing slash. Normalize the URL before production-mode comparisons.
  • critical-failures.json can stop paging if either paid target disappears entirely, despite the alert promising coverage for a lost vendor. Add an explicit presence check for Modulate and Soniox.
  • The new 2h page alarm lacks the previous pause and kill-switch options, so rollback now depends on a merged PR and an approved gated prod import. Restore a faster operational way to pause the alarm.
  • critical-failures.md may lead operators to believe the import includes every active split file, but it imports only live-stt.json and selected files or UIDs. Clarify the documented import scope.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="backend/scripts/verify_pusher_live_alert_route.py">

<violation number="1" location="backend/scripts/verify_pusher_live_alert_route.py:458">
P2: This exclusion silently drops the new production-native pages when the accepted Grafana URL has a trailing slash. Normalize the URL before every production-mode comparison, or classify production after stripping the trailing slash, so import and fleet read-back retain the production rules.</violation>
</file>

<file name="backend/charts/monitoring/batch-projection/README.md">

<violation number="1" location="backend/charts/monitoring/batch-projection/README.md:71">
P2: The rollback guidance for the new page-tier 2h alarm is now only a forward revert plus a gated prod import, which needs a merged PR and approval. The removed pause and kill-switch options are not replaced, and pausing would fail the gated import's active-rule check. Document an immediate mute path for a misfiring page, and state concretely how real breaches stay tracked during a revert.</violation>
</file>

<file name="backend/charts/incluster-guards/files/guard.py">

<violation number="1" location="backend/charts/incluster-guards/files/guard.py:591">
P3: `page_signal` takes the dry-run decision from the `DRY_RUN` env var only when the call site omits a `dry_run` field, so the `dry_run` argument passed to `run()` is ignored for those logs. Pass `dry_run=dry_run` explicitly to the `parakeet_read_error` and `floor_schedule_error` logs too, so the no-paging rule depends only on the argument.</violation>
</file>

<file name="backend/charts/monitoring/critical-failures.md">

<violation number="1" location="backend/charts/monitoring/critical-failures.md:10">
P2: The import path does not include every active split file: it starts with `live-stt.json` and adds only selected canaries, Redis rules, and gated UIDs. Clarify that it imports gated rules from selected split files, not every rule in every active split file.</violation>
</file>

<file name="backend/charts/monitoring/alerts/critical-failures.json">

<violation number="1" location="backend/charts/monitoring/alerts/critical-failures.json:290">
P2: This page goes silent when either paid target disappears entirely, despite its annotation promising coverage for a lost vendor. Add an explicit target-presence check so a missing Modulate or Soniox series produces the page signal.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

# instead of KeepLast, on a detached copy so canonical rules never change.
rules = copy.deepcopy(rules)
for uid in PRODUCTION_ONLY_IMPORT_UIDS:
rules.pop(uid, None)

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: This exclusion silently drops the new production-native pages when the accepted Grafana URL has a trailing slash. Normalize the URL before every production-mode comparison, or classify production after stripping the trailing slash, so import and fleet read-back retain the production rules.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/scripts/verify_pusher_live_alert_route.py, line 458:

<comment>This exclusion silently drops the new production-native pages when the accepted Grafana URL has a trailing slash. Normalize the URL before every production-mode comparison, or classify production after stripping the trailing slash, so import and fleet read-back retain the production rules.</comment>

<file context>
@@ -450,6 +454,8 @@ def _development_rules(rules: dict[str, dict[str, Any]]) -> dict[str, dict[str,
     # instead of KeepLast, on a detached copy so canonical rules never change.
     rules = copy.deepcopy(rules)
+    for uid in PRODUCTION_ONLY_IMPORT_UIDS:
+        rules.pop(uid, None)
     for rule in rules.values():
         if rule.get("execErrState") == "KeepLast":
</file context>

Rollback: set `BATCH_TIMELINESS_ALARM_ENABLED=false` on the worker (gauges freeze and the stale rule fires), or pause
the three Grafana rules. The index step: merge triggers the Firestore index reconcile; approve its prod job and wait
for READY before shipping the worker (merge_pr.sh waits out these gates).
Rollback an incorrect definition with a forward revert and the same import;

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: The rollback guidance for the new page-tier 2h alarm is now only a forward revert plus a gated prod import, which needs a merged PR and approval. The removed pause and kill-switch options are not replaced, and pausing would fail the gated import's active-rule check. Document an immediate mute path for a misfiring page, and state concretely how real breaches stay tracked during a revert.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/charts/monitoring/batch-projection/README.md, line 71:

<comment>The rollback guidance for the new page-tier 2h alarm is now only a forward revert plus a gated prod import, which needs a merged PR and approval. The removed pause and kill-switch options are not replaced, and pausing would fail the gated import's active-rule check. Document an immediate mute path for a misfiring page, and state concretely how real breaches stay tracked during a revert.</comment>

<file context>
@@ -53,20 +53,22 @@ The metric is alert-only. No scheduler, ramp, hard-3 rollback trigger or gate re
-Rollback: set `BATCH_TIMELINESS_ALARM_ENABLED=false` on the worker (gauges freeze and the stale rule fires), or pause
-the three Grafana rules. The index step: merge triggers the Firestore index reconcile; approve its prod job and wait
-for READY before shipping the worker (merge_pr.sh waits out these gates).
+Rollback an incorrect definition with a forward revert and the same import;
+keep real timeliness breaches tracked while reverting. The index step: merge
+triggers the Firestore index reconcile; approve its prod job and wait for READY
</file context>

Comment on lines +10 to +11
import set with `--fail-on gated`. This includes rules from every active split
file, not only `live-stt.json`. The combined export must equal the split exports.

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: The import path does not include every active split file: it starts with live-stt.json and adds only selected canaries, Redis rules, and gated UIDs. Clarify that it imports gated rules from selected split files, not every rule in every active split file.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/charts/monitoring/critical-failures.md, line 10:

<comment>The import path does not include every active split file: it starts with `live-stt.json` and adds only selected canaries, Redis rules, and gated UIDs. Clarify that it imports gated rules from selected split files, not every rule in every active split file.</comment>

<file context>
@@ -0,0 +1,114 @@
+`live-alert-gate.json` is both the import list and the fail-closed read-back list.
+The existing metrics-egress workflow triggers on that file, calls
+`verify_pusher_live_alert_route.py --mode import`, then verifies the `live-stt`
+import set with `--fail-on gated`. This includes rules from every active split
+file, not only `live-stt.json`. The combined export must equal the split exports.
+No workflow change is needed to promote the former pending batch rules.
</file context>
Suggested change
import set with `--fail-on gated`. This includes rules from every active split
file, not only `live-stt.json`. The combined export must equal the split exports.
This includes gated rules from selected split files, not every rule in every active
split file.

"type": "prometheus",
"uid": "prometheus"
},
"expr": "min by (target) (omi_stt_cost_routing_stage{job=\"backend-listen-metrics\",target=~\"modulate-velma-2|soniox\"})",

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: This page goes silent when either paid target disappears entirely, despite its annotation promising coverage for a lost vendor. Add an explicit target-presence check so a missing Modulate or Soniox series produces the page signal.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/charts/monitoring/alerts/critical-failures.json, line 290:

<comment>This page goes silent when either paid target disappears entirely, despite its annotation promising coverage for a lost vendor. Add an explicit target-presence check so a missing Modulate or Soniox series produces the page signal.</comment>

<file context>
@@ -0,0 +1,666 @@
+            "type": "prometheus",
+            "uid": "prometheus"
+          },
+          "expr": "min by (target) (omi_stt_cost_routing_stage{job=\"backend-listen-metrics\",target=~\"modulate-velma-2|soniox\"})",
+          "instant": true,
+          "intervalMs": 1000,
</file context>

# A bounded Cloud Logging counter consumes this boolean. Keep the signal on
# batch observer trips too: their evidence intentionally does not own the
# Parakeet Job's exit code. Dry-run readings must never notify humans.
page_signal = unsafe and not fields.get('dry_run', False) and os.environ.get('DRY_RUN', 'false').lower() != 'true'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: page_signal takes the dry-run decision from the DRY_RUN env var only when the call site omits a dry_run field, so the dry_run argument passed to run() is ignored for those logs. Pass dry_run=dry_run explicitly to the parakeet_read_error and floor_schedule_error logs too, so the no-paging rule depends only on the argument.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/charts/incluster-guards/files/guard.py, line 591:

<comment>`page_signal` takes the dry-run decision from the `DRY_RUN` env var only when the call site omits a `dry_run` field, so the `dry_run` argument passed to `run()` is ignored for those logs. Pass `dry_run=dry_run` explicitly to the `parakeet_read_error` and `floor_schedule_error` logs too, so the no-paging rule depends only on the argument.</comment>

<file context>
@@ -584,9 +584,15 @@ def safe(value):
+    # A bounded Cloud Logging counter consumes this boolean. Keep the signal on
+    # batch observer trips too: their evidence intentionally does not own the
+    # Parakeet Job's exit code. Dry-run readings must never notify humans.
+    page_signal = unsafe and not fields.get('dry_run', False) and os.environ.get('DRY_RUN', 'false').lower() != 'true'
+    severity = logging.ERROR if unsafe else logging.INFO
     logging.getLogger('incluster-guards').log(
</file context>

@Git-on-my-level
Git-on-my-level marked this pull request as draft November 4, 2026 07:01
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review November 4, 2026 07:27

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 13 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

View guided diff | Turn on auto-fix | Re-trigger cubic

Git-on-my-level and others added 6 commits November 4, 2026 02:54
# Conflicts:
#	backend/charts/monitoring/alert-rules.json
#	backend/charts/monitoring/alerts/batch-timeliness.json
#	backend/charts/monitoring/batch-projection/README.md
#	backend/charts/monitoring/live-alert-gate.json
#	backend/tests/unit/test_batch_pipeline_timeliness.py
Main's head (a5ccd17) fails two of its own checks, which every branch
based on it inherits: the pl397 emulator-proof fixtures lack the
time.monotonic clock the consumer's lease hold now reads, and the Soniox
503-at-submission test still asserts the pre-#24392 contract (5xx at the
paid step now preserves paid uncertainty: submitted=True).
# Conflicts:
#	backend/charts/monitoring/alert-rules.json
#	backend/charts/monitoring/gmp-query-migration-inventory.json
#	backend/charts/monitoring/live-alert-gate.json
#	backend/charts/monitoring/metric-inventory.prod.json
# Conflicts:
#	backend/charts/monitoring/alert-rules.json
#	backend/charts/monitoring/gmp-query-migration-inventory.json
…t and allowlist the grown telemetry contract leg

The merge unioned alert-rules.json across both lanes; the committed
migration inventory is now regenerated by monitoring_gmp_shadow.py
--inventory instead of a hand-merged count, and the dead-letter
producer-family contract leg that walks the full rule set is allowlisted
at its measured CI CPU time (1.03s vs the 1.00s guard limit; all 44
contract assertions pass).
@Git-on-my-level
Git-on-my-level merged commit 4b1c40b into main Nov 6, 2026
58 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/alertfix branch November 6, 2026 17:17
Git-on-my-level added a commit that referenced this pull request Nov 6, 2026
<!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} -->
_Requested by **David**_

## What changed and why

Fixes main red from #24538 (`4b1c40b5ef`, "page on critical batch and
vendor failures"). That commit added two page rules,
`omi-enrichment-queue-depth-page` and `omi-incluster-guard-unsafe-page`,
using the Cloud Monitoring promQL query type. The monitoring contract
test `test_no_alert_rule_uses_the_cloud_monitoring_promql_query_type`
forbids that type, so the Backend unit suite failed on main.

Both rules now use `timeSeriesList`, the type the contract allows, in
`backend/charts/monitoring/alert-rules.json` and its copy
`backend/charts/monitoring/alerts/critical-failures.json`:
- `omi-enrichment-queue-depth-page`:
`cloudtasks.googleapis.com/queue/depth` for `queue_id=enrichment`,
`ALIGN_MAX` over 300s, `REDUCE_MAX`. Threshold 6000, for 15m, unchanged.
- `omi-incluster-guard-unsafe-page`:
`logging.googleapis.com/user/omi_incluster_guard_unsafe` for
`k8s_container`, `ALIGN_DELTA` over 900s, `REDUCE_SUM`. Threshold 0, for
1m, unchanged.

Severity, labels, folder and group are unchanged. The original
`promQLQuery` object stays on each converted model as an inert sibling
of the `timeSeriesList` query, because the production verifier and the
Cloud Monitoring shape contract read it. The rule's `queryType` is
`timeSeriesList`, so nothing executes the promQL target. The
`timeSeriesList` windows approximate the original promQL ranges
(`max_over_time` over 5m, `increase` over 15m). The alignment is
coarser, so the evaluated value can differ slightly at the edges.

## Product invariants affected

None. The change is limited to alert rule definitions.

## How it was verified

Run in the task worktree:
- `test_no_alert_rule_uses_the_cloud_monitoring_promql_query_type`
passes.
- `test_notifications_namespace_in_both_exporter_filters` passes.
- `test_recap_alerts_are_idempotent_and_have_correct_conditions` and
`test_recap_log_metrics_extract_bounded_labels` pass.
- The other monitoring alert test files pass:
`test_monitoring_alert_rule_contract`, `test_critical_failure_alerts`,
`test_monitoring_alert_backtest`,
`test_monitoring_notification_contract`, `test_pipeline_drain_alerts`
and `test_provision_monitoring_alerts`. 216 tests passed in that run.
- Not run: four `test_monitoring_telemetry_contract` cases for the held
dead-letter volume path. They failed to import `google` in the local
scratch environment, and they don't touch these rules. The full Backend
unit suite was not run locally; CI covers it.

## Tests

Contract tests above. The test was not weakened and no exemption was
added.

## UI evidence

Not applicable.

## Failure class (fixes)

Failure-Class: new

New class definition:
`.github/failure-classes/FC-alert-rule-promql-on-cloud-monitoring.json`.
This PR is its evidence.

## New guards (only when adding a check or ratchet)

None. The existing contract test is the guard that caught this.
Git-on-my-level added a commit to Dimank92/omi that referenced this pull request Nov 7, 2026
omi-enrichment-queue-depth-page and omi-incluster-guard-unsafe-page used the
Cloud Monitoring promQL query type, which the monitoring contract test forbids
and which turned main red after BasedHardware#24538.

Both now use timeSeriesList with the same metric, threshold, for duration,
severity and labels. The windows approximate the original promQL ranges:
queue depth uses ALIGN_MAX over 300s, and the guard counter uses ALIGN_DELTA
over 900s with a sum across series.
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