Skip to content

feat(roadmap): keep the tokens of each implement attempt - #4594

Merged
dan-petty merged 2 commits into
mainfrom
feat/4587-keep-attempt-tokens
Nov 11, 2026
Merged

dan-petty merged 2 commits into
mainfrom
feat/4587-keep-attempt-tokens

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The record implement.spend kept only the first request of each step, and the trace drops its oldest model events in a long run, so no record showed which step used the tokens or its largest request. Each entry under implement.spend.steps now also holds the requests, the input and output tokens, the repair rounds and largest_request_tokens of the step. The budget count does not change. The cached and uncached split waits for #4553, which adds cache_read_tokens to StepOutcome on the same lines.

Closes #4587

Change: openspec/changes/archive/2026-11-11-4587-keep-the-tokens-of-each-implement/

@dan-petty dan-petty added type/feature Type feature: a new function scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 11, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test evidence.

uv run devops ci fail-to-pass --base origin/main (base 5f75d25):

failed on base: tests.roadmap.implement.test_roadmap_implement_job_trace::test_the_spend_holds_the_repair_rounds_of_a_step_and_the_requests_of_its_rounds (KeyError: 'repair_rounds')
failed on base: tests.roadmap.implement.test_roadmap_implement_job_trace::test_the_spend_holds_the_requests_the_tokens_and_the_largest_request_of_each_step (KeyError: 'requests')
2 failed on base (2 failed and 7 passed in tests/roadmap/implement/test_roadmap_implement_job_trace.py; 0 errored).

On the branch, uv run devops ci test tests/roadmap/implement/ tests/roadmap/test_roadmap_explain.py: 1684 passed.

mypy on the two changed source files and the test file gives the same 19 errors on base and on the branch (all in other test support files).

Overlap with open pull requests: #4553 (#4387) changes _Run, StepOutcome, TierSpend and _spend in the same files. This change puts its lines in other places of those classes and does not change _spend or implement_limits.py. After #4553 merges, one line in _step_spend can add cache_read_tokens of the step.

@dan-petty
dan-petty marked this pull request as ready for review November 11, 2026 10:48
Each entry under implement.spend.steps holds the requests, the input
and output tokens, the repair rounds and the largest request of the
step, apart from the trace that drops old events.
@dan-petty
dan-petty force-pushed the feat/4587-keep-attempt-tokens branch from e1fe663 to 05196cf Compare November 11, 2026 12:57
@dan-petty
dan-petty enabled auto-merge (squash) November 11, 2026 12:57
@dan-petty
dan-petty merged commit 66fdaab into main Nov 11, 2026
32 checks passed
@dan-petty
dan-petty deleted the feat/4587-keep-attempt-tokens branch November 11, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(roadmap): keep the tokens of each implement attempt

1 participant