Skip to content

feat(monitoring): show soft-cap and fix-check results with alerts #4868

Done

Description

@dan-petty

Update 2026-11-26 (infra move): Loki and its ruler are configured in dan-petty/homelab, and #3485 (which was to add the ruler) closed as not planned here.

This issue keeps the panels in k8s/devops/dashboards/roadmap-service-telemetry.json and the Prometheus fallback alert in k8s/devops/monitoring/. The four log-derived alerts wait on the Loki ruler, which is the homelab follow-up of #5172. k8s/logging/loki-rules.yaml does not exist.


Problem or Motivation

Owner requirement 5 asks to measure extensions and how the extended runs ended, repair rounds and their success, and tokens per plan and per merged change. Stage tokens were 70.3M in 7 days, about 2.6M per plan PR, and no panel shows where extensions and repairs spend them.

Proposed Solution & Architectural Design

Add panels to the #4845 row (k8s/devops/dashboards/roadmap-service-telemetry.json): plan PRs per day; tokens per plan PR and per ready implement PR; decisions by point, resolver and result; outcomes of extended runs; fix checks by site, path and result, and the repair success share; the agreement of rule and model; the fallback share. Alerts with promtool tests and runbook entries: fallback share > 20% in 1 hour; a gate whose findings repeat in > 50% of >= 10 cases in 7 days (runbook: file an issue and add the code to check_suspect by PR); more than 50% of extended runs end at the ceiling over 20 extensions; model-only extensions pass in < 20% of >= 20 cases (runbook: set the point to mode rule); a job under 80% for 3 days after it held. Runner Job series use LogQL until #4684 and #4697 are fixed.

Target Subsystem

Monitoring (k8s/devops/dashboards/ and k8s/devops/monitoring/), for the roadmap jobs.

Existing Tool Considered

Grafana dashboards as code, Prometheus alert rules with promtool tests, and Loki LogQL for the runner Job series until #4684 and #4697 are fixed. Cost to build: about 0.8M tokens, half a day.

Acceptance Criteria

  • promtool tests for each alert pass.
  • The dashboard check passes.
  • Each panel shows data on a test fixture or after one day of the Service.

Dependencies

#4845; #4847.

Related: #3655 (the pipeline dashboard and alerts), #4684 and #4697 (runner Job metrics).

Source: #4843

Alternatives check of 2026-11-27: in-use.
The repository already uses this tool.
Tool: grafana/grafana (https://github.com/grafana/grafana), AGPL-3.0, last activity 2026-11-27, maintained.
Reason: Searches found no tool that already builds these project-specific panels, promtool-tested alert rules and Loki ruler rules. Grafana, already in use, supplies the dashboard, data sources and alerting the change writes into.

Covers:

  • Rows and panels with Prometheus or Loki data sources
  • Dashboard JSON kept in git and provisioned by kustomize
  • Alerting rules with thresholds, severity and for-duration

Lacks:

  • Project counters such as devops_cli_decision_point_total and token totals
  • Promtool case file and RULE_GROUP_TESTS registration
  • Loki ruler rules, which live in dan-petty/homelab
  • Runbook rows in k8s/README.md and docs/CLUSTER.md

Proposed design

Problem statement

Stage tokens were 70.3M in 7 days, about 2.6M per plan pull request, and no panel shows where extensions and repair rounds spend them. This change adds panels to the Roadmap Job Success row of k8s/devops/dashboards/roadmap-service-telemetry.json for plan PRs per day, tokens per plan PR and per ready implement PR, decisions by point, resolver and result, extension outcomes, the agreement of rule and model, and the fallback share. It adds the fallback-share alert as a Prometheus rule with its promtool case and its runbook rows. The fix-check panel and the repair success share stay out of this proposal in the issue that the body records under "Moved to new items", and the four log-derived alerts are filed as a new issue because the Loki ruler is in dan-petty/homelab.

Acceptance criteria

Requirement: Roadmap outcome panels

The Roadmap Job Success row of k8s/devops/dashboards/roadmap-service-telemetry.json SHALL hold panels for plan PRs per day, tokens per plan PR, tokens per ready implement PR, decisions by point, resolver and result, outcomes of extended runs, the agreement of rule and model, and the fallback share.

Scenario: Dashboard lint accepts the new panels

  • WHEN uv run devops grafana dashboards lint k8s/devops/dashboards runs
  • THEN The lint exits 0 and reports no error for roadmap-service-telemetry.json.

Requirement: Panel queries and data sources

Each new panel SHALL have a non-empty query and a data source, and SHALL read a Prometheus counter when the counter holds the value and Loki only for a per-attempt result line or a decision or outcome record.

Scenario: Dashboard lint accepts each query and data source

  • WHEN uv run devops grafana dashboards lint k8s/devops/dashboards runs
  • THEN The lint exits 0 and reports no empty query, missing data source or unknown data source.

Requirement: Prometheus fallback alert

The fallback-share alert SHALL be a Prometheus rule in group roadmap-service-outcomes of serverFiles.devops_cli_alerting_rules.yml in k8s/devops/monitoring/prometheus-rules-values.yaml that fires when the share of devops_cli_decision_point_total with resolver fallback is over 20% for 1 hour.

Scenario: The fallback rule fires at its threshold

  • WHEN promtool test rules tests/fixtures/prometheus_rules/roadmap_service_outcomes_tests.yaml runs
  • THEN promtool reports the fallback-share alert firing for a 21% share and quiet for a 19% share.

Requirement: Promtool case registration

The group roadmap-service-outcomes SHALL be listed with tests/fixtures/prometheus_rules/roadmap_service_outcomes_tests.yaml in RULE_GROUP_TESTS of tests/prometheus/test_k8s_monitoring_alerting.py, and the case file SHALL test every alert of the group.

Scenario: The alerting tests accept the new group

  • WHEN uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py runs
  • THEN The test command exits 0 and reports no failed test.

Requirement: Runbook entry

The fallback-share alert SHALL have a row in the Alerting table of k8s/README.md and in the Roadmap service alert table of docs/CLUSTER.md that name its threshold, its severity and its runbook action.

Scenario: The docs check accepts the alert rows

  • WHEN uv run devops ci --check --only docs runs
  • THEN The docs row exits 0 and reports no error for k8s/README.md or docs/CLUSTER.md.

Requirement: Pending a person after the merge

After one day of the Service, a person SHALL confirm that each new panel shows data in Grafana.

Scenario: The new panels show data after one day

  • WHEN One day after the pull request merges, a person opens the Roadmap Job Success row in Grafana.
  • THEN Each new panel shows a series or a value, and the person records the result in the issue.

Existing Tool Considered

Grafana (grafana/grafana, https://github.com/grafana/grafana) is in use, per the alternatives check of 2026-11-21 in the issue body; its block records what Grafana lacks. The proposal builds those project-specific pieces itself: the panel queries, the Prometheus rule with its promtool case, and the runbook rows, at about 0.8M tokens to build and half a day of elapsed time.

Key questions

  • Which file holds the new panels?: k8s/devops/dashboards/roadmap-service-telemetry.json, in the row Roadmap Job Success that starts at line 1256; the kustomize configMapGenerator provisions it. [sources: k8s/devops/dashboards/roadmap-service-telemetry.json:1256, k8s/devops/dashboards/kustomization.yaml:34, k8s/README.md:551]
  • Which data source do the new panels use?: Prometheus for the counters that hold the value: devops_cli_roadmap_stage_total with result staged for plan PRs per day, devops_cli_ai_tokens_total by row and devops_cli_service_implement_tokens_total for tokens, devops_cli_decision_point_total for decisions by point, resolver and band and for the fallback share, and devops_cli_roadmap_implement_extension_total for extensions. Loki for the per-attempt result lines and for the decision and outcome records whose join gives the agreement of rule and model and the outcomes of extended runs. (best practice) [sources: docs/CLUSTER.md:56, docs/TELEMETRY.md:115, docs/TELEMETRY.md:149, docs/ROADMAP_WORKFLOW.md:420, k8s/devops/dashboards/roadmap-service-telemetry.json:1317]
    • Chosen: Prometheus for the counters and Loki for the per-attempt and decision/outcome lines. The stage, token, decision and extension counters exist in Prometheus, and the dashboard already reads the job result lines and the decision records from Loki.
    • Rejected: Loki for every panel. It ignores the counters that the Service and the stage Jobs already send to Prometheus and repeats the stale fix(telemetry): send cumulative metrics to the Prometheus OTLP receiver #4684/fix(telemetry): keep one metric stream per workload #4697 clause.
    • Rejected: Prometheus for every panel. The decision and outcome join and the per-attempt result lines are log records that no metric holds, so the agreement and extension panels would have no data.
  • Which rule group holds the fallback alert?: A new group roadmap-service-outcomes in serverFiles.devops_cli_alerting_rules.yml of k8s/devops/monitoring/prometheus-rules-values.yaml, with its own case file tests/fixtures/prometheus_rules/roadmap_service_outcomes_tests.yaml registered in RULE_GROUP_TESTS of tests/prometheus/test_k8s_monitoring_alerting.py. (best practice) [sources: k8s/devops/monitoring/prometheus-rules-values.yaml:63, tests/prometheus/test_k8s_monitoring_alerting.py:443, docs/CLUSTER.md:191]
    • Chosen: A new group roadmap-service-outcomes. The existing groups are by concern and each has its own case file; the new alert is about job outcomes and spend, which none of them covers.
    • Rejected: Extend the group roadmap-service-tools. That group watches tool calls, not outcomes or spend.
    • Rejected: Extend the group roadmap-service. That group watches the Service rounds; the new alert reads the decision counter, and one case file per group is the project pattern.
  • Do the panels keep the hand-written dashboard JSON or come from a generator?: The panels are added to the hand-written k8s/devops/dashboards/roadmap-service-telemetry.json, which the kustomize configMapGenerator provisions. No Grafonnet generator is added. (best practice) [sources: k8s/devops/dashboards/kustomization.yaml:34, k8s/README.md:551]
    • Chosen: Hand-written JSON in git, provisioned by kustomize. The repository keeps this dashboard as JSON, the kustomize generator provisions it, and the dashboard check reads it.
    • Rejected: Grafonnet generator. It adds a generator and a build step for one file that the project keeps, lints and provisions as JSON.
    • Rejected: SRE template generator from services.toml. That generator builds the SLO dashboards listed in services.toml, and roadmap-service-telemetry.json is not one of them.
  • What happens to the four log-derived alerts?: They are filed as a new issue and are not built here. k8s/logging/loki-rules.yaml does not exist: the only change that adds it is openspec/changes/3485-the-coder-tier-serves-no-second, whose tasks are still unticked, and the body records that Loki and its ruler are configured in dan-petty/homelab, the follow-up of feat(monitoring): record job grades from result lines in Prometheus #5172. (best practice) [sources: openspec/changes/3485-the-coder-tier-serves-no-second/proposal.md:9, openspec/changes/3485-the-coder-tier-serves-no-second/tasks.md:7, docs/CLUSTER.md:147]
    • Chosen: File the four alerts as a new issue. The ruler is outside this repository and no rule file for it exists here, so the rest of the issue can ship while the alerts wait.
    • Rejected: Add k8s/logging/loki-rules.yaml here. The repository holds no Loki ruler deployment, and the file that fix(k8s): the coder tier serves no second chat model #3485 would add is not built.
    • Rejected: Use Grafana alert rules. The project keeps its alerts as Prometheus and Loki ruler rules; no Grafana alert rule is kept in git here.
  • Which dependencies remain?: None. feat(roadmap): log one result line for each roadmap job attempt #4845 is built: the Roadmap Job Success row is in the dashboard. feat(roadmap): add the soft-cap and fix-check chain to decision points #4847 is built: devops_cli_decision_point_total, devops_cli_decision_point_duration_seconds and devops_cli_decision_point_failed_total are served, and implement.extension is in the registry. [sources: k8s/devops/dashboards/roadmap-service-telemetry.json:1256, docs/TELEMETRY.md:149, docs/TELEMETRY.md:150, openspec/changes/archive/2026-11-12-4845-log-one-result-line-for-each/proposal.md]
  • What happens to the fix-check panel and the repair success share?: They stay out of this proposal, as the body records under "Moved to new items". The result data exists: devops_cli_service_fix_checks_jobs_total carries the result label and the dashboard already charts it in the panel "Fix-checks: fix-checks jobs per hour by result", and the repair success share is the repaired or ready results over the created or resumed ones. No site or path label and no site or path field of the fix_checks result line exists, so the panel "fix checks by site, path and result" cannot be built without new data. [sources: k8s/devops/dashboards/roadmap-service-telemetry.json:1006, docs/CLUSTER.md:53, openspec/specs/roadmap-fix-checks/spec.md:215]
  • Which runbook action stops model-only extensions that pass too rarely?: Set the decision point to mode rule: rule runs the deterministic rule and the ordered guards without a cuts file and records model answers without acting, and it is a supported mode of roadmap.decisions for implement.extension. (best practice) [sources: docs/CONFIGURATION.md:341, docs/ROADMAP_WORKFLOW.md:420, docs/adr/0020-a-decision-point-is-a-unit-of-a-workflow-with-a-resolver-chain-and-a-rule-goes-before-a-decision-model.md:250]
    • Chosen: Set the point to rule. rule is a supported mode for implement.extension: the deterministic rule and the guards decide, and the model answers are only recorded.
    • Rejected: Set the point to off. off runs nothing, so the extension decision falls back to the behavior before the point and no rule guards it.
    • Rejected: Set the point to shadow. shadow still sends the model request and changes nothing, so the model-only extension keeps acting.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Moved to new items

#7089, #7362

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/monitoring
    on Nov 11, 2026
  3. added
    status/new
    value/medium
    effort/medium
    on Nov 11, 2026
  4. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/monitoring. The (monitoring) scope of the title gives the scope.
    • Priority: P2-Medium. The panels and alerts improve visibility of cost and repair results, but no failure or security risk blocks the project.
    • Value: Medium. Users see where extensions and repairs spend tokens and get alerts on weak gates.
    • Effort: Medium. The item adds many panels, several alert rules, promtool tests and runbook entries, at about half a day of work.
    • Related: feat(roadmap): a dashboard and alerts for the pipeline #3655, which asks for a different change. Both items add dashboard panels and alerts, but #3655 holds the pipeline view and the candidate adds a new row for extensions, repairs and fix checks.
  5. added
    priority/p2-medium
    effort/medium
    on Nov 11, 2026
  6. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches found Grafana (dashboards kept as JSON in git), Prometheus/promtool (alert rules with unit tests) and Loki (LogQL), and the issue itself already names all three as the tools it will use. Grafana covers the panel half of the need, but the alert rules and their promtool tests are Prometheus work and the token, repair and fix-check queries, thresholds and runbook entries are specific to this repository, so no single tool covers the whole need.

    The repository already uses this tool.

    Tool: grafana/grafana (https://github.com/grafana/grafana)

    • License: AGPL-3.0
    • Last activity: 2026-11-14
    • Maintained: yes

    Covers:

    • Grafana dashboards as code: the panels go into the dashboard JSON the project keeps in git, which is the file the issue targets
    • Grafana reads Prometheus and Loki data sources, so one panel can show token, decision, repair and LogQL runner Job series
    • Grafana gives the dashboard model and panels that the dashboard check validates

    Lacks:

    Tools considered:

    Searches run:

    • Grafana dashboards as code Jsonnet Grafonnet generate dashboard JSON, results: 5
    • promtool unit test alerting rules prometheus, results: 5
    • grafonnet library grafana dashboards jsonnet, results: 5
    • prometheus promtool test rules alert alertname example, results: 5
    • grafana dashboard linter validate dashboard JSON CI, results: 5
    • grafana loki LogQL query metrics from logs range aggregation, results: 5
    • prometheus alerting rules unit tests promtool test rules yaml alert_rule_test, results: 5

    Sources:

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  7. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at ca62d6a while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: src/devops_cli/roadmap/decision_registry.py, src/devops_cli/roadmap/decision_point.py, k8s/logging/loki-values.yaml.

  8. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at b1c4892 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  9. added
    status/ready
    and removed
    status/new
    on Nov 25, 2026
  10. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  11. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  12. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 28, 2026
  13. removed
    status/in-review
    owner/agent
    on Nov 28, 2026
  14. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-28 18:38 UTC

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/mediumpriority/p2-mediumscope/monitoringsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions