Skip to content

fix(roadmap): stage and refine send no answer count or row - #4484

Merged
dan-petty merged 2 commits into
mainfrom
fix/4475-stage-and-refine-send-no-answer
Nov 11, 2026
Merged

dan-petty merged 2 commits into
mainfrom
fix/4475-stage-and-refine-send-no-answer

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Since #4237, the stage, refine and alternatives runs send no devops_cli_ai_model_answers_total. The hook of build_agent writes one spend record for each request, but adds no answer count and passes no cached prompt tokens, so a cached prompt costs the full input rate. No AI series names the job row of a request.

  • The hook counts each reply that names its model and passes cache_read_tokens.
  • model_answer_labels holds the fallback rule and the row for the hook and record_run_spend.
  • track_request_spend adds row (the request_scope row or other) to the request, token and spend series.
  • The runner Job applies its plan in the scope of the row implement.

Only the implement step calls record_run_spend, and its agent has no hook, so a request counts one time.

Closes #4475

Change: openspec/changes/archive/2026-11-11-4475-stage-and-refine-send-no-answer/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must 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

Fail-to-pass (uv run devops ci fail-to-pass --base origin/main, before the rebase onto 8fec1f6): 9 failed on base, all pass on the branch.

  • New: test_each_model_request_of_an_agent_adds_one_answer_count (assert [] == [...]), test_the_ai_series_of_a_request_carry_the_job_row_that_sent_it (KeyError: 'row'), test_a_request_on_the_deepseek_group_costs_its_cached_and_new_input_and_its_output (0.10192 == 0.033477), test_each_model_request_of_the_run_counts_its_answer_one_time_under_its_row, test_confirm_in_a_runner_counts_its_model_requests_under_the_implement_row (KeyError: 'row').
  • Changed: the 4 label tests of tests/ai/client/test_roadmap_agent_run.py now expect row: other.

Premise check. The title of the task said "record no model spend". That is not correct: since #4237 the hook writes one ledger row and the token and spend counters for each request (the reasoning tokens of roadmap-service, which only the hook sends, grew from about 72K to 1.4M in 6 hours after 2026-11-09T17:32Z). The answer count stopped at 2026-11-09T17:32:53Z for job roadmap-service; the runner Jobs (devops-cli-job) still send it. The cached prompt tokens were also missing from the hook (DeepSeek prices were not changed; #4403 merged as #4454).

Series. In the 7 days to 2026-11-11, roadmap-service sent 53 series of the four (tokens 32, spend 8, requests 11, answers 2). With row, each splits into at most 6 (intake, refine, retitle, stage, alternatives, other): at most 318. Runner Jobs and command lines send one row, so no change there.

Local checks. pytest on tests/ai/client, tests/ai/spend, tests/prometheus, tests/server, tests/telemetry/test_telemetry_instruments.py, tests/docs and the investigation and implement command tests: all pass. devops docs generate --check and devops openspec check pass. I did not run the full devops ci: the CI lock was held for more than 10 minutes, so the GitHub checks are the gate.

Out of scope. The hook records duration_seconds 0 for each request, where record_run_spend recorded the run time. No cluster, ConfigMap or setting change is necessary.

The spend hook of build_agent writes one spend record for each model
request since #4237, but it adds no count to
devops_cli_ai_model_answers_total and gives the ledger no cached prompt
tokens. The stage, refine and alternatives runs go through that hook, so
the Service sends no answer count after the rollout of #4237. No AI
series names the job row that sent a request.

The hook now counts each reply that names its model and passes the
cached prompt tokens. model_answer_labels holds the fallback rule and
the row for the hook and for record_run_spend. track_request_spend adds
the row of request_scope to the request, token and spend series, and the
runner Job applies its plan in the scope of the implement row.
@dan-petty
dan-petty force-pushed the fix/4475-stage-and-refine-send-no-answer branch from 69db5f9 to 6b983ed Compare November 11, 2026 04:28
@dan-petty
dan-petty marked this pull request as ready for review November 11, 2026 04:36
@dan-petty
dan-petty enabled auto-merge (squash) November 11, 2026 04:36
@dan-petty
dan-petty merged commit d9c8ee8 into main Nov 11, 2026
32 checks passed
@dan-petty
dan-petty deleted the fix/4475-stage-and-refine-send-no-answer branch November 11, 2026 04:38
dan-petty pushed a commit that referenced this pull request Nov 11, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.111.0](v0.110.0...v0.111.0)
(2026-11-11)


### Features

* **roadmap:** a decision-point registry with a resolver chain
([#4453](#4453))
([b73e97a](b73e97a))
* **roadmap:** eval verify stores each case and resumes
([#4451](#4451))
([7c59565](7c59565))
* **roadmap:** extend a step budget when the run makes progress
([#4464](#4464))
([c8ed108](c8ed108))


### Bug Fixes

* **ai:** a failed model transport names its phase and its error
([#4460](#4460))
([54743c4](54743c4))
* **ai:** price the DeepSeek group and its cached input
([#4454](#4454))
([3b1f6bd](3b1f6bd))
* **roadmap:** stage and refine send no answer count or row
([#4484](#4484))
([d9c8ee8](d9c8ee8))
* **roadmap:** tool docstrings garble the answer format
([#4486](#4486))
([2f6114f](2f6114f))


### Performance Improvements

* **roadmap:** parse only the bodies that hold a job record
([#4455](#4455))
([c653bde](c653bde))
* **tests:** evaluate hour-scale promtool tests every hour
([#4462](#4462))
([0ac2f76](0ac2f76))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
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/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(roadmap): stage and refine send no answer count or row

1 participant