Repository navigation
Description
Split from #5460.
Problem: The new run, step, path-class and cache-read records need a measurement on real runs. A pull request cannot show this measurement before a release. Deferral: the proof waits on a release and on real Service runs. Acceptance criteria: after release, one Prometheus query gives the cache-read share of the rows stage and refine. The count of step start lines of each implement run equals its count of groups. The next start-context review gives, for each run, the first 10 calls by tool, the calls of retry runs, the repeat reads, and the cache-read share of each row. The issue records the query and the result.
Proposed design
Problem statement
The records of #5460 for runs, steps, path classes and cache reads need a measurement on real Service runs. A pull request cannot show this measurement before a release. This item records one PromQL query and its result for the cache-read share of the stage row and of the refine row. It compares the step start lines of each implement run with its task groups. It records the tool calls, the retry calls, the repeat reads and the cache-read share in the next start-context review.
Acceptance criteria
Requirement: Cache-read share query
The item MUST record one PromQL expression that gives the cache-read share of the stage row and of the refine row.
Scenario: One expression gives one share for each row
- WHEN A person runs the recorded expression on the Service Prometheus after the release that writes
devops_cli_ai_tokens_total{type="cache_read"}. - THEN The result holds one series for
row="stage"and one forrow="refine", and each value is between 0 and 1.
Requirement: Step start count
The item MUST show that the count of step start lines of each implement run equals the count of task groups that have an unticked task at the start of that run.
Scenario: One implement run has one step start line for each unticked group
- WHEN A live check counts the
step startlines of one implement run in Loki and counts the task groups of its change that had an unticked task at the start of the run. - THEN The two counts are equal.
Requirement: Start-context review record
The next start-context review MUST record for each run the first 10 calls by tool, the calls of the retry runs, the repeat reads and the cache-read share of each row.
Scenario: The review gives the four items for each run
- WHEN The next start-context review runs after the release.
- THEN Its record gives the first 10 calls by tool, the retry calls, the repeat reads and the cache-read share of each row.
Requirement: Pending a person after the merge
A person MUST record the query text and its result in one comment on issue #6238 after the measurement.
Scenario: One comment holds the query text and the result
- WHEN A person reads the comments of issue chore(telemetry): measure run records and cache-read share after release #6238 after the release.
- THEN One comment holds the query text and the result table for the
stageandrefinerows.
Existing Tool Considered
No alternatives check has run on this item. Prometheus with PromQL covers the cache-read share query of the stage and refine rows. Loki with LogQL covers the count of step start lines of an implement run. Both tools are open and maintained. Prometheus lacks log-line counting, and Loki lacks metric arithmetic. The item adds no code, so it has no build cost.
Key questions
- Which PromQL expression gives the cache-read share of the
stageandrefinerows?: The share is the cache-read tokens divided by the prompt tokens of the row. Use one expression with a 7-day window and a zero for a row with no cache-read series:(sum by (row) (increase(devops_cli_ai_tokens_total{type="cache_read",row=~"stage|refine"}[7d])) or on (row) 0 * sum by (row) (increase(devops_cli_ai_tokens_total{type="prompt",row=~"stage|refine"}[7d]))) / sum by (row) (increase(devops_cli_ai_tokens_total{type="prompt",row=~"stage|refine"}[7d])). Thecache_readseries exists only when its count is above 0. Theor on (row)part gives 0 to a row with no cache reads. The 7-day window matches the live proof that reads the values 7 days after the merge. (best practice) [sources: src/devops_cli/ai/spend/ledger.py:1099, openspec/specs/command-telemetry/spec.md:327, docs/guidelines/agentic-jobs.md:107, docs/ROADMAP_WORKFLOW.md:286]- Chosen: One expression with a 7-day
increase,sum by (row), and anor on (row)zero. One query gives one share for each row. A row with no cache read gets 0. The 7-day window matches the live-proof precedent. - Rejected: One expression with a 24-hour window. A day holds too few real runs for a stable share.
- Rejected: Two expressions, one for each row. The body asks for one query that gives both rows.
- Rejected: An instant
rateexpression. Arateneeds a short window and is noisy. Anincreaseover the stated window gives the share.
- Chosen: One expression with a 7-day
- Which row labels do the
stageand therefinerecords carry?: Therowlabel carries the job row of the Service. The stage command setsrow="stage"on its request scope. The refine run setsrow="refine"on itsRunTrace, and the run loop sets the request scope to the job row. [sources: src/devops_cli/commands/roadmap_jobs.py:628, src/devops_cli/roadmap/refine/refine.py:4656, openspec/specs/ai-spend-pricing/spec.md] - Does the count of
step startlines of one implement run equal the count of task groups of its change?: The runner logs onestep start group=<n>line when each implement step begins. The implement job makes one step for each task group that has an unticked task. So the two counts are equal when every group has an unticked task at the start of the run. A run that resumes an item with ticked groups logs fewerstep startlines than the change has groups. [sources: src/devops_cli/roadmap/implement/implement_step.py:2593, openspec/specs/roadmap-implement-step/trace/spec.md:333, CONTEXT.md:146] - Which record holds the first 10 calls by tool, the retry calls and the repeat reads that the start-context review gives for each run?: The record is
RunTrace.tool_calls. The stage job writes it into the stage comment on the item issue withrun_report, one group for eachrun_indexand its row. EachToolCallRecordholdsname, maskedargument,outcome,run_indexandrow. A retry run has its ownrun_indexgroup, so the calls of a retry run are the calls of that group. A repeat read is aread_filecall with the same path argument. [sources: src/devops_cli/roadmap/agent_run.py:404, src/devops_cli/roadmap/stage/stage.py:3938, openspec/specs/roadmap-stage/toolbox/spec.md:341, tests/roadmap/stage/test_roadmap_stage_trace_runs.py:131] - Where does the item keep the query and the result?: One comment on issue chore(telemetry): measure run records and cache-read share after release #6238 holds the query text and the result table for the
stageandrefinerows. The body asks the issue to record the query and the result. The item adds no file, because the record is one measurement. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:286]- Chosen: One comment on issue chore(telemetry): measure run records and cache-read share after release #6238. The body asks the issue to record the query and the result.
- Rejected: One new document under
docs/. It adds a file to keep for one measurement. - Rejected: The body of the issue. Each refine round rewrites the refine block of the body.
- Rejected: One dashboard panel query in
k8s/devops/dashboard_queries/devops-roadmap-service.yaml. The item records one measurement. A panel adds a chart and keeps no record of the measurement.
Fit
Fits in one pull request.
Suspected block
The next devops-cli release that holds the records of #5460, and the real Service runs after that release.
Dependencies
Watched files
A commit on the default branch that changes one of these files starts the next refine round.
src/devops_cli/ai/spend/ledger.pysrc/devops_cli/roadmap/agent_run.pysrc/devops_cli/roadmap/stage/stage.pysrc/devops_cli/telemetry/instruments.py
Activity
devops-cli-service commentedon Nov 18, 2026
Both concern run, step, and path-class records; #5460 creates them, the candidate measures them post-release.devops-cli-service commentedon Nov 19, 2026
Refine cannot set this item to Ready at 6ff83d4 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.
devops-cli-service commentedon Nov 27, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
devops-cli-service commentedon Nov 29, 2026
Owner question: See Suspected block and Watched files in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 29, 2026
Owner question: See Suspected block and Watched files in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Dec 1, 2026
Owner question: See Suspected block and Watched files in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Dec 1, 2026
Owner question: See Suspected block and Watched files in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence