Repository navigation
Description
Problem
The result lines of five jobs carry no tokens= field, so the grades cannot give their cost per success.
- Loki, 7 d to 2026-11-19,
{namespace="devops",container=~"service|stage|fix-plan"} |= "roadmap job result:", lines withtokens=of all lines: refine 0/926, alternatives 0/591, intake 0/438, fix_checks 0/8, refine_judge 0/11. For comparison: stage 162/173, implement 89/89, retitle 24/24, fix_plan 3/3. - feat(roadmap): result lines state first-pass, model calls and cost #5168 added
tokens=throughjob_result.attempt_context()(src/devops_cli/roadmap/job_result.py:245).src/devops_cli/roadmap/retitle.py:403is the only caller ofattempt_context()on origin/main. - DeepSeek tokens over 7 d (LiteLLM input plus output): 3,857 M. The result lines of stage, implement, fix_plan and retitle hold 2,525 M. So up to 1,332 M tokens have no job. This is an upper bound, because other callers also use the gateway.
devops roadmap eval grades --window 7dshows efficiency null for refine, alternatives and intake. The owner cannot rank these jobs by tokens per success.
Expected
- refine, alternatives, intake, fix_checks and refine_judge open
attempt_context()around each attempt, so each result line carriestokens=. devops roadmap eval gradesshows an efficiency value for these jobs.- Test first, one test for each job: a fake model call inside one attempt gives a result line with
tokens=equal to the tokens of the fake call. - A field for the largest request (
max_request_tokens=) is not part of this item.
Alternatives check of 2026-11-28: none.
Tool: none found.
Reason: Searches found open LLM observability tools (Langfuse, LiteLLM) that record tokens per call, but none writes the roadmap result line field that eval grades read; the work reuses the internal attempt_context() helper.
Lacks:
- No write of tokens into the project's roadmap result lines
- No per-job attribution that devops roadmap eval grades reads
- Adoption needs a separate observability stack or gateway correlation work
Proposed design
Problem statement
The result lines of refine, alternatives and refine_judge carry no tokens= field. The owner cannot rank these jobs by token cost per success. The change opens the existing attempt_context() helper around each attempt so each result line carries token usage. The intake and fix_checks parts are deferred because their model calls and result lines run in separate phases or containers.
Acceptance criteria
Requirement: Refine result line has tokens
The refine job SHALL open attempt_context() around each attempt so its result line carries tokens=.
Scenario: Fake model call in one refine attempt
- WHEN A test runs one refine attempt with a fake model call that reports 123 tokens.
- THEN The result line for that attempt contains
tokens=123.
Requirement: Alternatives result line has tokens
The alternatives job SHALL open attempt_context() around each attempt so its result line carries tokens=.
Scenario: Fake model call in one alternatives attempt
- WHEN A test runs one alternatives attempt with a fake model call that reports 123 tokens.
- THEN The result line for that attempt contains
tokens=123.
Requirement: Refine-judge result line has tokens
The refine_judge job SHALL open attempt_context() around each attempt so its result line carries tokens=.
Scenario: Fake model call in one refine_judge attempt
- WHEN A test runs one refine_judge attempt with a fake model call that reports 123 tokens.
- THEN The result line for that attempt contains
tokens=123.
Requirement: Refine and refine-judge keep separate token counts
The refine job SHALL NOT count the tokens of a refine_judge attempt in its own result line.
Scenario: Refine calls refine-judge
- WHEN A test runs one refine attempt with a fake model call of 100 tokens and a nested refine_judge attempt with a fake model call of 23 tokens.
- THEN The refine result line contains
tokens=100and the refine_judge result line containstokens=23.
Requirement: Grades show efficiency from tokens
devops roadmap eval grades SHALL show a non-null efficiency value for refine, alternatives and refine_judge when their result lines carry tokens=.
Scenario: Efficiency from token result lines
- WHEN A test feeds the grades evaluator one successful result line with
tokens=100for each of refine, alternatives and refine_judge. - THEN The evaluator prints a non-null efficiency value for each job.
Existing Tool Considered
The alternatives check in the issue body records verdict none on 2026-11-19 and names no tool. The block lists what the project's roadmap result lines lack. The change reuses the existing internal attempt_context() helper and adds no new token-tracking code.
Key questions
- Which helper adds
tokens=to a roadmap result line?:attempt_context()insrc/devops_cli/roadmap/job_result.py:245adds the token usage to the result line.src/devops_cli/roadmap/retitle.py:403calls it around an attempt. [sources: src/devops_cli/roadmap/job_result.py:245, src/devops_cli/roadmap/retitle.py:403] - Can intake and fix_checks use
attempt_context()alone to put tokens on their result lines?: No.plan_intake()makes the model calls and returns anIntakePlan.log_job_result(RoadmapJob.INTAKE, ...)runs later inapply_intake(). The fix_checks model repair runs in theagentcontainer of a Kubernetes Job.log_job_result(RoadmapJob.FIX_CHECKS, ...)runs later in_reportin theservicecontainer. The token count must cross a phase or container boundary. [sources: src/devops_cli/roadmap/intake/intake.py:1333, src/devops_cli/roadmap/intake/intake.py:1569, src/devops_cli/roadmap/fix_checks_row.py:408, src/devops_cli/commands/roadmap_step_fix_checks.py:153, src/devops_cli/roadmap/steps/fix_checks_phases.py:388] - Which jobs should this item wrap with
attempt_context()?: Wrap refine, alternatives and refine_judge. Defer intake and fix_checks because their model calls and result lines run in separate phases or containers. (best practice) [sources: src/devops_cli/roadmap/job_result.py:245, src/devops_cli/roadmap/retitle.py:403, src/devops_cli/roadmap/intake/intake.py:1333, src/devops_cli/roadmap/fix_checks_row.py:408]- Chosen: Three in-process jobs. The three jobs make their model call and write their result line in one process. The stage return shows that intake and fix_checks do not.
- Rejected: All five jobs. Intake logs its result after
plan_intake()returns. Fix_checks logs its result after a separate Kubernetes Job. A simple context cannot carry the token count. - Rejected: Only retitle. Retitle already calls the helper. The item needs the three jobs that lack tokens.
- How should refine and refine_judge nest their
attempt_context()calls?: Open oneattempt_context()for each result line. Do not nest the refine_judge context inside the refine context. If refine calls refine_judge, run that call after the refine context exits. (best practice) [sources: src/devops_cli/roadmap/job_result.py:245, src/devops_cli/roadmap/retitle.py:403]- Chosen: Separate context for each result line. Each result line gets its own token count. No model call is counted twice.
- Rejected: Nested context with subtraction. The helper has no subtraction API. It adds code and risks double counting.
- Rejected: One shared context for both. The second result line would repeat the first token count or carry none.
- How should the tests prove the token field for each job?: Add one unit test for each of refine, alternatives and refine_judge. Each test runs one attempt with a fake model call that reports 123 tokens. Each test asserts that the result line contains
tokens=123. (best practice) [sources: src/devops_cli/roadmap/job_result.py:245, src/devops_cli/roadmap/retitle.py:403]- Chosen: One unit test per job. The issue asks for one test for each job. Each test names the attempt boundary of one job.
- Rejected: One parameterized test for all jobs. It hides which job lacks the call. It does not give one test for each job.
- Rejected: Live Loki query. It needs deployed data. It is no offline test.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 19, 2026
Both add fields to roadmap result lines, but #5500 adds attempt, class, pipeline and unit while the candidate adds tokens= to five jobs that lack it.devops-cli-service commentedon Nov 19, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (10)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 19, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
dan-petty commentedon Nov 25, 2026
Returned #6360 to New: the item cannot be built as written on
origin/main.Evidence from the repository
fix_checksdoes not run its model call andlog_job_resultin one attempt context.log_job_result(RoadmapJob.FIX_CHECKS, ...)is called only insrc/devops_cli/roadmap/fix_checks_row.py:408(_report), which runs in theservicecontainer after an external Kubernetes Job (cronjob-runner.yaml,fix_unit) ends._reportmakes no model call.k8s/devops/cronjob-runner.yaml,src/devops_cli/commands/roadmap_step_fix_checks.py:153-183), the model repair runs in theagentcontainer (agent_phaseinsrc/devops_cli/roadmap/steps/fix_checks_phases.py:388-404), which writesout/outcome.jsonandout/summary.json(AgentSummary) and returnsNonewithout callinglog_job_result.publish_phaseruns in thepublishcontainer and printsFixChecksReport.to_json()withouttokensorlog_job_result.fix_checks_row._reportreads only the"result"string from_RESULT_CONTAINERS = ("publish", "prepare")viaresult_of()(src/devops_cli/roadmap/fix_checks_row.py:127-130, 291-351) and passescounts={"attempt": _attempt(job), "seconds": seconds}. Also,RESULT_LINE_SELECTORinsrc/devops_cli/roadmap/job_grade_report.py:123queries{namespace="devops", container=~"service|stage|fix-plan"}and excludes runner containers.attempt_context()around_reportor insidesteps/fix_checks*.py(likeretitle.py:403) therefore cannot place modeltokens=ontoRoadmapJob.FIX_CHECKSresult lines. Carrying model tokens tofix_checksresult lines requires propagating token counts across containers and pods (agent->publish->FixChecksReportor item job record ->fix_checks_row._reportcounts=), which the item's design excludes.intakesplits model calls (plan_intake) andlog_job_result(apply_intake) across separate phases with a shared batch_embedcall.plan_intake()(src/devops_cli/roadmap/intake/intake.py:1333-1380) calls_Planner.decide_all()(intake.py:1199-1214), which embeds all checked candidates in one batch call (_embed,intake.py:1225) before_decide()callsself.run.model.propose()per candidate, and returnsIntakePlan.log_job_result(RoadmapJob.INTAKE, ...)is called later in_count_candidate()insideapply_intake()(src/devops_cli/roadmap/intake/intake.py:1518, 1569-1590), after anyattempt_context()opened inplan_intakehas already reset and exited. Per-candidate tokens therefore cannot come fromattempt_context()alone without carrying counts onIntakeDecisionand deciding how to attribute shared_embed()batch tokens.Needed before re-readiness
Refine
#6360to either:attempt_context()change to the in-process single-loop jobs (alternatives,refine,refine_judge, plus explicitrefine/refine_judgenesting behavior) and split or specify separate designs forintake(IntakeDecisioncounts + batch_embedattribution) andfix_checks(cross-container / cross-pod token reporting intofix_checks_row._report).devops-cli-service commentedon Nov 25, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.
fix(roadmap): log tokens on refine and alternatives lines (#6360)
devops-cli-service commentedon Nov 29, 2026
Released in v0.248.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.248.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 16:50 UTC