Repository navigation
Description
Part of #5164 (child 3).
Problem or Motivation
The owner grades a workflow by "success with no fix rounds" and, at 80% or more, by "cost, time, and token efficiency" (2026-11-12, #5164). The result line of roadmap/job_result.py gives neither for most jobs:
- No line says whether the attempt succeeded with no fix round. A query must know the counts of each job, and
refine,refine_judge,alternativesandintakehave no count of fix rounds. tokensandsecondsexist only forstage,implementandfix_plan. No line has a count of model calls, the cost in money or the GitHub requests.retitlemakes one model call for each item and writes no line.- The spend ledger (
ai/spend/ledger.py) keepscost_usdfor each request, but no attempt adds it up. In 7 days, $72.95 of $78.31 ofdevops_cli_ai_spend_usd_totalhad norowlabel.
Proposed Solution & Architectural Design
- Add
first_pass=<true|false>to each line. A tableFIRST_PASSnext toSUCCESS_RESULTSgives the rule of each job:
| Job | First pass |
|---|---|
stage |
staged, plan_calls ≤ 1, gate_returns = 0, verify_rounds ≤ 1 |
implement |
ready, repair_rounds = 0, extensions = 0 |
fix_plan |
revised or cleared, gate_returns = 0, verify_rounds ≤ 1, after = 0 |
refine |
success with tries = 1 |
refine_judge |
approved with round = 1 and findings = 0 |
alternatives |
a verdict with returns = 0 |
intake |
placed or duplicate with no model fallback (fallbacks = 0) |
retitle |
retitled or kept on the first reply |
- Add one attempt context (a context variable that the job opens around one attempt). The spend ledger adds
model_calls,tokensandcost_usd_micros(integer micro-dollars) to it for each request, and the paced GitHub session addsgh_requests.secondsis the wall time of the context. The writer adds these counts to every line. A local model adds 0 to the cost; its tokens show its load (fix(ai): an agent run on a hosted group is not local spend #3665). - Add the counts that the first-pass rules need:
tries(refine),round(refine_judge),returns(alternatives),fallbacks(intake). - Add
RoadmapJob.RETITLE, its results (retitled,kept,failed) and its intended results (retitled,kept). - Update the table of
docs/roadmap/job-success.mdand the specopenspec/specs/roadmap-service-logs/spec.md.
Target Subsystem
SDLC, Git & PR Governance (src/devops_cli/roadmap/, src/devops_cli/ai/spend/ledger.py).
Existing Tool Considered
OpenTelemetry spans can carry the same counts, but Loki holds the result lines and the spans keep no prompt text by the privacy defaults; a span does not give a ratio for each attempt. LiteLLM spend logs hold a cost for each request, but they do not know the attempt. Custom code: the attempt context (about 150 lines) and the table. Cost: about 400,000 tokens, 10 hours elapsed.
Acceptance Criteria
- For each job, a test writes an attempt and finds
first_pass,model_calls,tokens,seconds,cost_usd_microsandgh_requestswith the values of the fake ledger and session. - A table test covers each
FIRST_PASSrule on its boundary values. - A retitle attempt writes one line.
devops docs checkpasses.
Dependencies
#5166 (the measure defects, so the new counts start from a correct line).
Owner decision 2026-11-13
The approved pipeline split (tracker #5482, Phase 0) uses tokens and cost_usd_micros of this item as a Phase 0 exit check. The scope of this item does not change. The other result-line fields (attempt, class, extensions, pipeline and unit) go to #5500, after this item. The trial arm uses the trial field of #5177.
The row label of devops_cli_ai_tokens_total and devops_cli_ai_spend_usd_total must name the job in a Job pod too.
- A test: a model call in a Job pod adds to the counters with the
rowlabel of its job. - Live proof: after the merge and the release, the stage, refine, intake and fix-plan jobs run as the App. A comment gives one result line of each with
tokensandcost_usd_micros.
Activity
dan-petty commentedon Nov 12, 2026
Both work on roadmap result lines in job_result.py; #4845 created the lines, the candidate extends them with first-pass, cost, and call-count fields.devops-cli-service commentedon Nov 15, 2026
Released in v0.148.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.148.0
devops-cli-service commentedon Nov 15, 2026
Live since 2026-11-15 04:09 UTC