Skip to content

fix(roadmap): cap output and deadline of a step model call - #2881

Merged
dan-petty merged 7 commits into
mainfrom
fix/2869-step-output-cap-and-call-timeout
Oct 31, 2026
Merged

dan-petty merged 7 commits into
mainfrom
fix/2869-step-output-cap-and-call-timeout

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

One model call in an implement step could run for 25 minutes. The model never stopped, made 57,653 tokens, and held the only slot of the model tier. Nothing in the chain capped one reply or one call.

  • The agent of a step now sets max_tokens (16384) and request_timeout (600 s) from two constants. The deadline is one clock over the whole call, the stream included. It is less than the 1500 s timeout of the gateway router, and a test holds this.
  • A reply that ends with the finish reason length stops the step at once, with the reason OutputCapReached that names the cap. Pydantic AI does not stop on such a reply: a cut write_file call wrote its broken arguments as a file.
  • A call that runs past the deadline stops the step with the reason ModelRequestTimeout and the deadline in seconds.
  • Neither stop is sent again. This differs on purpose from the issue text, which says the resend takes over: a resend would repeat a call that costs up to 600 s.
  • OutputCapReached is a domain error with the code OUTPUT_CAP_REACHED.
  • The instructions of the step tell the model that a reply has an output cap, and to write a long file in parts with edit_file.

The gateway does not change. The OpenSpec change is archived with this pull request.

Closes #2869

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

Copy link
Copy Markdown
Owner Author

Test results

Fail-to-pass

uv run devops ci fail-to-pass --base origin/main: 2 tests fail on the base, 121 pass, and 2 test files error on the base because they test new code (collection failure). The failing tests are the deadline reason and the instruction text. The log is in .data/agent/scratch/f2p-2869.log.

Review findings fixed

  • The comment on the constants and the Feasibility section now say that 38 tokens per second is the average of the longest call, and that the 3-second rate fell to 27.55. A very slow call ends at the deadline before the cap.
  • New test: a call that keeps streaming ends at the deadline, with no second request.
  • The task text and the test docstring now say what the test proves (three quarters of a small cap passes). A test with 12,000 tokens against the real cap took 19 s, so it stays out of CI.
  • The proposal says that the missing resend is a deliberate change from the issue text.
  • OutputCapReached moved to exceptions/ai_pydantic.py, with the code OUTPUT_CAP_REACHED. A test holds it.
  • Probe file tests/roadmap/test_zz_probe_2869.py: not in the branch. git status is clean before each commit and push.

Declined

None.

@dan-petty
dan-petty marked this pull request as ready for review October 31, 2026 15:55
@dan-petty
dan-petty merged commit 0c4bd3a into main Oct 31, 2026
19 checks passed
@dan-petty
dan-petty deleted the fix/2869-step-output-cap-and-call-timeout branch October 31, 2026 15:55
dan-petty pushed a commit that referenced this pull request Oct 31, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.28.0](v0.27.0...v0.28.0)
(2026-10-31)


### Features

* **ai:** preview requests in dry run for rag ingest analyze
([#2873](#2873))
([c53bcec](c53bcec)),
closes [#2244](#2244)
* **ai:** preview requests in dry run for runs cost cache
([#2884](#2884))
([0df9777](0df9777))
* **roadmap:** the Service marks green stage drafts ready
([#2882](#2882))
([63fae06](63fae06)),
closes [#2865](#2865)
* **roadmap:** tool log names the reason of a retried call
([#2875](#2875))
([03d3dc5](03d3dc5)),
closes [#2866](#2866)


### Bug Fixes

* **ci:** devops ci test expands or refuses a path argument
([#2879](#2879))
([884a80b](884a80b)),
closes [#2868](#2868)
* **roadmap:** cap output and deadline of a step model call
([#2881](#2881))
([0c4bd3a](0c4bd3a)),
closes [#2869](#2869)

---
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): a model call of an implement step has no output cap and a runaway reply holds the tier for 25 minutes

1 participant