Skip to content

docs(openspec): plan #2919 stuck-item age metrics and alert - #3171

Merged
dan-petty merged 4 commits into
mainfrom
feat/2919-stuck-item-age-metrics-and-one
Nov 2, 2026
Merged

dan-petty merged 4 commits into
mainfrom
feat/2919-stuck-item-age-metrics-and-one

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Plans #2919

The plan adds three gauges to the metrics row of the Service: the age of the oldest item in each state, the issue number of that item, and the age of the oldest claim. The age is the clock minus the time of the label event. The store reads the events of one issue, and the row reads them again only when the label changes: 78 requests at a start, and about 9 an hour after it. One alert, RoadmapServiceItemStuck, fires for an item that stays in blocked, or in ready with a plan, for more than a day. Its message names the item, and a promtool test pins it. A panel joins the items row of the project dashboard. The item number is the value of a gauge and not a label, so no label holds an issue number. The change has a spec delta because the metrics, the alert and the panel are observable.

Change: openspec/changes/2919-stuck-item-age-metrics-and-one/

🤖 Generated with Claude Code

https://claude.ai/code/session_01PeiMDoPafqUWqpk1WxhaYW

Copy link
Copy Markdown
Owner

Review of the plan for #2919.

CI: all 18 checks green or skipped (head 9e42e3a). Premise: the gap is real (no age gauge exists on main), but the plan puts the work in the wrong place and has holes in the alert design.

  1. Group 2 changes the wrong module. The metrics row computes and emits in src/devops_cli/github/metrics.py (collect_project_metrics_report line 627, emit_project_metrics_telemetry, _emit_item_counts). src/devops_cli/roadmap/run.py:620 (_run_metrics_adapter) only calls them. The plan changes run.py and tests/roadmap/test_roadmap_run.py and never names metrics.py or tests/github/test_github_metrics.py, where the PROJECT_ITEMS tests live (line 583). Fix: move group 2 to metrics.py, add the age fields to ProjectMetricsReport, send them from emit_project_metrics_telemetry, and follow the "send 0 once for a gone label set" rule of _emit_item_counts (spec project-metrics-dashboard, requirement "A label set that has no items is sent as 0 once"), or the gauge keeps a stale age after the oldest item leaves a state.

  2. The plan reads the label events of each open item, and ADR 0016 rejected that. docs/adr/0016-labels-hold-the-roadmap-items-fields.md:28 rejects a timeline read per Item because "a read of each Item's timeline costs one request for each Item". The plan does not mention this. It also ignores the request budget (service.github_requests_per_hour) and project_metrics_requests (metrics.py:678), which lists the requests of the row for the dry run. github_store.py:453 already has repository_issue_events_endpoint (repos/{repo}/issues/events), a repository-wide read, and the store timeline code reads only closure events. Fix: decide the read (repository events endpoint, paged, versus per item), state its request cost per round, add it to project_metrics_requests, and record the ADR 0016 conflict in design.md "Rejected alternatives" with the evidence.

  3. The alert cannot name the item. Task 3.1 and the spec require "the item number in the message", but the gauges carry only state and repository (design.md and tasks 1.2/2.2). An age gauge by state has no item number. Fix: add the number of the oldest item as a label (and say how a changing label is cleared, see point 1) or as an info series, and write the scenario so a promtool test can assert it.

  4. The configurable threshold has no task. Design.md and the PR body say the threshold is a Service setting; no task adds the setting, the settings model, docs/ENV_VARS.md, configmap.example.yaml or a series that carries it to the rule. A Prometheus rule cannot read a Service setting unless it is exported. The existing request-volume alert scenarios use a limit series, so a pattern may exist (not verified in detail). Fix: add the task and a scenario, or drop the claim and use a literal threshold with the evidence for it.

  5. "ready with a plan" is not defined. The gauge by state cannot tell Ready with a plan from Ready without one. Say which signal marks "with a plan" (the item record stage.pr, or a plan folder on the default branch) and where it enters the metric.

  6. Spec and task defects.

    • The spec delta lacks the requirement "Age is computed from the label event time with an injectable clock" that the issue lists as an acceptance criterion. Only task 2.1 covers it.
    • Task 1.1 says "six state age gauges"; task 1.2 adds two instruments (ROADMAP_ITEM_AGE with a state label, ROADMAP_CLAIM_AGE). Align the spec scenario ("the gauges for the six states") with that shape.
    • Task 5.2 is malformed ("docs/TELEMETRY.md, run uv run devops docs generate --sync-readme", no verb).
    • Task 3.1 and 4.1 have no failing step. If kept as other groups, give a check that fails on base (a promtool case that fires on base would fail).
    • The "Pending a person: review the diff in tuicr" bullet is a plain bullet and openspec/config.yaml allows it. Not a defect.
  7. Proposal text. Feasibility lists agent tool calls (search_code, list_files) and two test commands. It does not confirm the premise (label event time is readable for the budget, point 2). "Existing Tool Considered" gives no tokens or elapsed time (rule 3 and openspec/config.yaml), and does not say what internal code the change deletes. The PR title has "plan ... plan"; suggest docs(openspec): plan #2919 stuck-item age metrics and alert.

Verified: status/planned is in ADR 0016; the roadmap instruments and docs/TELEMETRY.md exist; promtool fixtures are in tests/fixtures/prometheus_rules/; no inbox panel exists in project-metrics.json (owner comment on #2919 says build the age panel without it). Not verified: the layout of prometheus-values.yaml rule groups and the test_the_baseline_rule_set pin.

Related issues: #2968 (inbox gauges and inbox panel; touches instruments.py, project-metrics.json and the metrics row, so expect a merge conflict and a shared label design), #2908 (parent workflow tracker, open), #2950 (alternatives coverage gauge and an alert; same instruments.py and alert files).

Verdict: hold until points 1 to 4 are fixed in the plan (module, request cost versus ADR 0016, item number in the alert, threshold task).


Generated by Claude Code

Move the age code to src/devops_cli/github/metrics.py and the store, read the
label events of one issue and keep the time until the label changes, send the
issue number as the value of a gauge, add the threshold decision, the alert
group with its promtool test, the panel, the criteria and real Feasibility.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PeiMDoPafqUWqpk1WxhaYW
dan-petty pushed a commit that referenced this pull request Nov 2, 2026
#3173)

Plans #2950

The alternatives check ran 34 times in 14 days and searched about 4
times, and no metric showed it. This plan adds two gauges (open items
with no check, age of the oldest check, both by repository) and one
histogram (searches per written check, by verdict). The Service row
records the gauges at the start of each round, also when it has nothing
to write. An alert fires after 3 days with no Firecrawl search while
items have no check. The expression of the issue never fires: its two
sides have different labels. A promtool run with the real labels showed
that, and showed the fixed rule. A row of three panels goes into the
devops-cli dashboard, because no Roadmap dashboard exists. The plan
names #3171, #3174 and #3243 as neighbours.

Change:
`openspec/changes/2950-alternatives-coverage-gauge-searches-per-check/`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01PeiMDoPafqUWqpk1WxhaYW

---------

Co-authored-by: devops-cli-service[bot] <349441588+devops-cli-service[bot]@users.noreply.github.com>
Co-authored-by: Claude <[email protected]>
@dan-petty dan-petty changed the title docs(openspec): plan #2919 plan roadmap stuck-item age metrics and alert docs(openspec): plan #2919 stuck-item age metrics and alert Nov 2, 2026

Copy link
Copy Markdown
Owner

The plan is fixed (head db6a3d2, main merged). What changed for each point of the review:

  1. Module. The age code is now in src/devops_cli/github/metrics.py (ProjectMetricsReport.item_ages, emit_project_metrics_telemetry), the read is a new RoadmapStore.label_changes, and run.py only passes item_ages=True. The age gauges send every pair of a status and a plan flag each round (a closed set of 12), so they need no "send 0 once" memory. The tests are in tests/github/test_github_metrics.py.
  2. Read cost and ADR 0016. The plan reads issues/<n>/events once for each change of a status or owner label and keeps the time in the process. Measured on 2026-11-02: 78 requests for the first round, at most 209 requests in the busiest 24 hours (about 9 an hour), against 360 an hour for a read of every item each round. The repository events listing stops at page 300 (HTTP 422 at page 301), so it cannot reach old events. design.md records the ADR 0016 line and why it does not apply.
  3. Item number. A label item is the "unsafe" label that you rejected on feat(roadmap): metrics for the pipeline outcomes #3069. The number is the value of devops_cli_roadmap_oldest_item_number, and the alert summary reads it with the query function. promtool 3.15.1 accepted the rule and its unit test.
  4. Threshold. It is the literal 86400 in the rule. Five of the six Service rules with a numeric threshold use a literal. A setting needs at least eight files. design.md has the list.
  5. "Ready with a plan" is a plan label that is true when the job record holds stage.pr (docs/ROADMAP_WORKFLOW.md:82, Staged).
  6. Spec and tasks. The metric-instruments delta is gone (the existing requirement already covers declared instruments). The deltas are ADDED in project-metrics-dashboard and roadmap-service-alerts, each under 500 characters. Every group has a failing step first, the ## Criteria section maps the four criteria, and the docs group runs devops docs generate --sync-readme (docs/TELEMETRY.md is generated from the instruments).
  7. Proposal. Feasibility now quotes command output for each premise. Existing Tool Considered names promhippie/github_exporter and gives tokens and hours. The title no longer says "plan" twice.

Open points for the owner: the 24-hour threshold, and that #2950 and #3240 name a "Roadmap dashboard" file that does not exist (this plan uses project-metrics.json).


Generated by Claude Code

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.

2 participants