Repository navigation
Description
Problem or Motivation
The record implement.spend keeps only one figure for each step: first_request_tokens. It does not keep the requests, the input tokens, the output tokens, the repair rounds or the largest request of a step. The totals of the record add all steps of all Jobs of the item, so a reader cannot tell which step or which attempt used the tokens.
Evidence on origin/main 5f75d25:
_step_spend(src/devops_cli/roadmap/implement/implement_run.py:437) writes onlystep,first_request_tokensand an optionalextensionfor each step.StepOutcome(src/devops_cli/roadmap/implement/implement_step.py:469) already holdsrequests,input_tokens,output_tokensandrepair_roundsof the step. No field holds the largest request.- The trace
implement.tracedrops its oldest model events when a run is long (fix(roadmap): keep tool events in the trace of a long run #4393), so the trace cannot give these figures for a long run. - In a study of implement runs, the median first request was 27,924 tokens. The 97,821 tokens in chore(roadmap): inventory the start context of a step #4385 is a request from the middle of a run, not a first request. Without the largest request of each step, the record cannot show this.
The investigations #4385 and #4386, and the work in #4075 and #4394, need these figures for each step.
Proposed Solution & Architectural Design
- Add
largest_request_tokensto_RunandStepOutcomeinimplement_step.py: the largestusage.input_tokensof one reply of the step. - In
_step_spend, also writerequests,input_tokens,output_tokens,repair_roundsandlargest_request_tokensof the step. - The usage of pydantic-ai 2.59.0 gives
cache_read_tokensfor each reply. Pull request fix(roadmap): the step budget counts new tokens, not cached input #4553 (chore(roadmap): count cached tokens in the step budget #4387) addscache_read_tokenstoStepOutcome. When that field is on main,_step_spendalso writes it, so a reader gets the cached and the uncached input tokens of each step apart. - Do not change the budget count in
implement_limits.py(chore(roadmap): count cached tokens in the step budget #4387 changes it).
Test first: a fake-model step with two requests of different size records each new field, and the largest request equals the largest tokens_in of the model events of the step.
Target Subsystem
roadmap implement job (src/devops_cli/roadmap/implement/).
Existing Tool Considered
pydantic-ai RequestUsage gives the counts of each reply. This change only writes the counts that the job already has. No new library is necessary.
Measure
The new fields are in each entry of implement.spend.steps of a new implement run.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.It improves cost observability for implement runs but does not block a broken feature.Readers can finally see which step and attempt used the tokens, aiding cost analysis and debugging.Add fields to two classes, extend one write function, and add a test with a fake model.Both extend the implement.spend record, but #3568 adds budget limits and attempt counts while this candidate adds per-step token breakdowns (requests, input, output, repair_rounds, largest_request_tokens).devops-cli-service commentedon Nov 11, 2026
Released in v0.112.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.112.0
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 14:13 UTC