Skip to content

feat(roadmap): alert rules for the pipeline outcomes #6039

Open

Description

@devops-cli-service

Split from #3655.

Problem

The roadmap pipeline has no alert when one failure class repeats. The item #3655 holds the dashboard and its panels. This issue holds the alert rule that reads devops_cli_service_implement_consecutive_failures of #3069, its promtool tests and its runbook rows. The success-rate alert of the original #3655 body is replaced by RoadmapJobGradeDrop of #5919, and RoadmapServiceItemStuck (#5495) already covers an item that stays in one phase, so this issue adds no second stuck-item alert.

Why this part is deferred

The shepherd returned #3655 to New on 2026-11-16 for a split. The stage job planned the item 14 times in 48 hours with no plan pull request: 4 plan_defect, 1 plan_unreadable and 9 on the provider outage of 2026-11-16, using about 60 million tokens. Medium-effort items fail the stage job mostly with plan_defect (#6008: 31 of 69 medium attempts succeeded, 25 of the 38 failures were plan_defect). The dashboard and the alerts are each one low-effort pull request.

Acceptance criteria

  • A new rule group roadmap-pipeline in k8s/devops/monitoring/prometheus-rules-values.yaml holds the alert, and promtool check rules accepts it.
  • The alert selects job="roadmap-service" and names no pod and no instance, so a pod change keeps it.
  • The alert fires when devops_cli_service_implement_consecutive_failures is 3 or more for one repo and one failure class.
  • A promtool unit test in tests/fixtures/prometheus_rules/roadmap_pipeline_tests.yaml shows that the alert fires at a gauge of 3, stays quiet on a normal series (gauge 0), and still fires when the series moves to a new pod label.
  • test_the_baseline_rule_set in tests/prometheus/test_k8s_monitoring_alerting.py names the new alert and its severity.
  • A row for the alert is in the ## Alerting table of k8s/README.md (k8s/README.md:625), and its runbook row with the action is in the ### Alerts table of docs/CLUSTER.md (docs/CLUSTER.md:125); the description of the rule points to (docs/CLUSTER.md, Roadmap service).
  • No rule of the new group reads devops_cli_roadmap_item_age_seconds or devops_cli_roadmap_stalled_items: RoadmapServiceItemStuck covers an item that stays in one phase.

Proposed design

Problem statement

The roadmap pipeline can fail the same implement class three or more times for one repository with no alert. This issue adds the roadmap-pipeline Prometheus rule group, promtool unit tests, and runbook rows for devops_cli_service_implement_consecutive_failures. It adds no second stuck-item alert.

Acceptance criteria

Requirement: Roadmap pipeline rule group

The rule group roadmap-pipeline in k8s/devops/monitoring/prometheus-rules-values.yaml SHALL hold the alert RoadmapServiceImplementConsecutiveFailures.

Scenario: Promtool accepts the rendered rules

  • WHEN promtool check rules reads the rule file that the chart writes from serverFiles
  • THEN the command exits 0 and reports no rule error.

Requirement: Alert selects the service job only

The alert expression SHALL select job="roadmap-service" and SHALL NOT group or filter by pod or instance.

Scenario: A pod label changes

  • WHEN the series moves to a new pod label and its value stays at 3
  • THEN the alert still fires for the same repo and failure class.

Requirement: Three consecutive failures fire the alert

The alert RoadmapServiceImplementConsecutiveFailures SHALL fire when devops_cli_service_implement_consecutive_failures is 3 or more for one repo and one failure class.

Scenario: A gauge of three for one repo and class

  • WHEN the gauge is 3 with repo="owner/name" and class="plan_defect"
  • THEN the alert fires with severity warning.

Requirement: Promtool unit test covers fire and quiet cases

The promtool unit test in tests/fixtures/prometheus_rules/roadmap_pipeline_tests.yaml SHALL cover a gauge of 3, a gauge of 0, and a moved pod label.

Scenario: Promtool test rules pass

  • WHEN promtool test rules tests/fixtures/prometheus_rules/roadmap_pipeline_tests.yaml runs
  • THEN the test passes and shows the alert fires at 3, stays quiet at 0, and fires after the pod label changes.

Requirement: Baseline rule test names the alert

test_the_baseline_rule_set in tests/prometheus/test_k8s_monitoring_alerting.py SHALL name RoadmapServiceImplementConsecutiveFailures and its severity.

Scenario: Baseline rule test passes

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py::test_the_baseline_rule_set -q runs
  • THEN the test passes and includes the alert name with severity warning.

Requirement: Runbook rows name the alert

The ## Alerting table in k8s/README.md and the ### Alerts table in docs/CLUSTER.md SHALL each hold a row for RoadmapServiceImplementConsecutiveFailures, and the rule description SHALL point to (docs/CLUSTER.md, Roadmap service).

Scenario: Documentation check accepts the rows

  • WHEN uv run devops ci --check --only docs runs
  • THEN the check passes and both tables hold the row.

Requirement: No second stuck-item alert

No rule in the roadmap-pipeline group SHALL read devops_cli_roadmap_item_age_seconds or devops_cli_roadmap_stalled_items.

Scenario: The group reads no stuck-item metric

  • WHEN yq -r '.serverFiles["devops_cli_alerting_rules.yml"].groups[] | select(.name == "roadmap-pipeline") | .rules[].expr' k8s/devops/monitoring/prometheus-rules-values.yaml | rg 'devops_cli_roadmap_(item_age_seconds|stalled_items)' runs
  • THEN the command exits 1 with no match.

Existing Tool Considered

No alternatives check has run. Prometheus, with promtool, is the open, maintained tool that covers the need: it evaluates the alert expressions and runs the unit tests. The change adds rules to the existing k8s/devops/monitoring/prometheus-rules-values.yaml and builds no new code. promtool does not render the Helm values file; the existing chart render supplies the rule file that promtool check rules reads.

Key questions

  • Which rule group holds the new alert?: Use a new group roadmap-pipeline in k8s/devops/monitoring/prometheus-rules-values.yaml. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml]
    • Chosen: New roadmap-pipeline group. The issue asks for it, and the file already keeps separate groups for separate concerns.
    • Rejected: Extend the roadmap-service group. It mixes the implement failure alert with service health rules and makes the new tests harder to isolate.
  • What name does the alert carry?: Use RoadmapServiceImplementConsecutiveFailures. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml, src/devops_cli/config/constants.py]
    • Chosen: RoadmapServiceImplementConsecutiveFailures. It names the service metric and follows the existing RoadmapService... alert names.
    • Rejected: RoadmapPipelineImplementFailures. It hides the service metric and does not follow the existing names.
  • What labels does devops_cli_service_implement_consecutive_failures carry?: The metric carries repo and class labels, so the alert groups by those two labels. [sources: src/devops_cli/roadmap/implement/consecutive_failures.py, tests/roadmap/implement/test_roadmap_implement_consecutive_failures.py]
  • Which expression and threshold fire the alert?: Use max by (repo, class) (devops_cli_service_implement_consecutive_failures{job="roadmap-service"}) >= 3 with for: 0m. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml, src/devops_cli/roadmap/implement/consecutive_failures.py]
    • Chosen: Fire at 3 or more with no extra delay. The gauge already counts consecutive failures, so a delay hides the third failure.
    • Rejected: Fire above 3. The issue says 3 or more, and a fourth failure is too late.
    • Rejected: Add a long for delay. The consecutive count is the delay.
  • Which labels select the series?: Select job="roadmap-service" and keep repo and class. Do not select or group by pod or instance. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml]
    • Chosen: Select the service job only. Both scrape paths give the series job="roadmap-service", and a pod change must not silence the alert.
    • Rejected: Select a pod or instance label. A new pod or a new instance starts a new series and hides the repeated failures.
  • What severity does the alert carry?: Set severity warning. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml]
    • Chosen: warning. Repeated implement failures degrade the pipeline but are not an outage, and the roadmap failure alerts use warning.
    • Rejected: critical. The Service still runs, and a person must inspect the failure class first.
  • Does this issue add a second stuck-item alert?: No. Keep RoadmapServiceItemStuck as the only stuck-item alert. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml]
    • Chosen: Rely on RoadmapServiceItemStuck. It already covers an item that stays in one phase.
    • Rejected: Add a second stuck-item alert. It duplicates the existing alert and reads metrics outside this issue.
  • Which test proves the rule behavior?: Use a promtool unit test in tests/fixtures/prometheus_rules/roadmap_pipeline_tests.yaml with cases at 3, 0, and a moved pod label. (best practice) [sources: tests/fixtures/prometheus_rules/roadmap_service_items_tests.yaml, tests/prometheus/test_k8s_monitoring_alerting.py]
    • Chosen: Promtool unit test fixture. The repository already tests rule behavior with promtool fixtures.
    • Rejected: Python test that parses the YAML. It does not evaluate the alert expression.
  • Which documentation rows must change?: Add a row to the ## Alerting table in k8s/README.md and a runbook row to the ### Alerts table in docs/CLUSTER.md. Point the rule description to (docs/CLUSTER.md, Roadmap service). [sources: k8s/README.md:625, docs/CLUSTER.md:125]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    source/agent
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 16, 2026
  2. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    ContributorAuthor
  3. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    ContributorAuthor

    Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/roadmapsource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions