Skip to content

fix(roadmap): count the reported input in the run window estimate - #4238

Merged
dan-petty merged 5 commits into
mainfrom
fix/4221-window-estimate-tracks-real-input
Nov 9, 2026
Merged

dan-petty merged 5 commits into
mainfrom
fix/4221-window-estimate-tracks-real-input

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The window estimate of an investigation run counted the JSON dump of all messages. That count ran about 1.4 times above the reported input of the provider, so tools were refused too early. The estimate now takes the usage of the last reply (input plus output) and adds the text after it. If the provider reports no input, it counts the text parts, not the JSON.

Closes #4221

Change: openspec/changes/archive/2026-11-09-4221-window-estimate-tracks-real-input/
Elapsed: 9.93s

@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 9, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test record for #4221.

  • New tests: tests/roadmap/refine/test_roadmap_refine_investigation_window.py (6 tests, hand-built messages with reported usage) and a guard test of the retry text in test_roadmap_refine_investigation.py.
  • fail-to-pass: uv run devops ci fail-to-pass --base origin/main gave "4 failed on base (4 failed and 54 passed in the 2 files; 0 errored)". The 4 fail on base for the right reason: the estimate was 165k against 105,412 reported; tools were refused at 105k; the first request counted JSON, not text; the zero-usage case counted JSON, not text.
  • Full uv run devops ci (before the rebase onto origin/main): exit 0, all gates passed. Known class: tests took 19m 40s (slowest test_k8s_monitoring_alerting, 197s), issue fix(ci): the pytest step of devops ci exceeds the 5-minute budget #3593. Not caused by this change.
  • After the rebase: narrow tests pass (refine investigation 60, stage toolbox and window 63), docs generate --check ok, mypy on roadmap ok. Full CI was not rerun after the rebase.
  • Scope: AC3 of the issue (the unknown-tool retry spends the output retry) is refuted by pydantic-ai source and a run; this PR delivers bullets 1 and 2 (AC1, AC2, AC5). See the Feasibility section of the proposal.
  • No live model call was made.

@dan-petty
dan-petty force-pushed the fix/4221-window-estimate-tracks-real-input branch from dd8c2a7 to ff0f6eb Compare November 9, 2026 16:13
@dan-petty

dan-petty commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner Author

Update after the rebase onto origin/main (four commits came in; no conflict, no overlap with the files of this change).

  • Narrow tests after the rebase pass: the window test file (7), the investigation test file (54), the stage window test file (13) and the stage toolbox test file (50).
  • The first push failed two checks, both mine. The diff coverage was 88%, under 90%: three lines of _part_text had no test. The ceiling of type: ignore in tests was 79 and my new test made 80. Fix: one test now covers every kind of part with no type: ignore (commits test(roadmap): cover every part kind in the window estimate and test(roadmap): drop a type ignore from the window estimate test).
  • All checks of the head pass now. Full uv run devops ci was not run again on this host after the rebase.

@dan-petty
dan-petty marked this pull request as ready for review November 9, 2026 16:53
@dan-petty
dan-petty merged commit af9c27a into main Nov 9, 2026
26 checks passed
@dan-petty
dan-petty deleted the fix/4221-window-estimate-tracks-real-input branch November 9, 2026 16:57
dan-petty pushed a commit that referenced this pull request Nov 9, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.101.1](v0.101.0...v0.101.1)
(2026-11-09)


### Bug Fixes

* **devcontainer:** a rejected unlock password becomes the keyring
password ([#4249](#4249))
([cc3d22e](cc3d22e))
* **roadmap:** count the reported input in the run window estimate
([#4238](#4238))
([af9c27a](af9c27a))
* **roadmap:** send one tool call at a time to a Claude group
([#4243](#4243))
([b855601](b855601))


### Code Refactoring

* **ai:** replace PydanticAgent with pydantic-ai Agent
([#4237](#4237))
([5edd7a5](5edd7a5))

---
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>
dan-petty added a commit that referenced this pull request Nov 9, 2026
…4260)

The stage job kept only the last problem of a refused reply and kept no
refused reply, so a failed plan could not be read. A reply of
placeholders in every text also used the second request and gave the
same reply. The job now logs each refused reply with the request number,
the input tokens and the tool offer, keeps the first and second refused
reply with their problems in a file beside the plan file until the item
is staged, and ends a placeholder reply at once as the new result
degenerate (metric and stage eval). Other changes removed the causes of
the placeholder replies: #4215, #4216, #4224, #4238 and #4243.

Closes #4204

Change:
`openspec/changes/archive/2026-11-09-4204-keep-refused-stage-reply/`
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): the stage window estimate drops tools too early

1 participant