fix(harness): give a pi tree Reef's reply budget, and name a reply cut at it - #566
Merged
Merged
Conversation
quao627
enabled auto-merge (squash)
September 21, 2026 19:50
|
Merge Oncall: @BobbyZhouZijian The merge oncall will route reviews and keep this pull request moving toward a clear decision. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Three consecutive reefine requests answered by the coding-agent proposer on
anthropic/claude-sonnet-5produced nothing, each recorded as "the agent changed no entry". The step record shows why: the agent's last model call returnedusage.output_tokens = 16384, exactly its cap, with empty content andstopReason: "length". The model spent the whole reply budget on reasoning, so the turn carried no text and no tool call, pi read that as the end of the turn and exited 0, and Reef read back a workspace nobody had written to.The cap is pi's own fallback:
maxTokens: definition.maxTokens ?? 16384in its provider composer. Reef renderspi-agent/models.jsonwith the model id and nothing else, so every pi tree Reef produces has always taken that fallback. It never showed before because the agent proposer is days old (#538) and the model it was first run against answered within the budget.#565 surfaces a failed model response from the trajectory, but only for
stopReasonerrororaborted; a reply cut atlengthstill reported as a step that changed nothing.Changes
ModelBindinggainsmax_output_tokens(default 32000), the reply budget a harness bound to that endpoint asks for. It sits besidetimeout_s, which already describes how Reef's callers talk to the endpoint, and is validated positive.compose_nodespasses it to the descriptor templates, and_substitutenow returns the value itself for a string that is one placeholder and nothing else, so a number stays a number in the rendered JSON.maxTokensintomodels.jsonfor all three dialects, so an evaluation episode, an agent run, a trial and the installed client tree all carry Reef's budget instead of pi's 16384.stopReason: "length"now records what happened: the reply hit its token budget and carried no answer, namingmaxTokens. A person reading the step page no longer sees "changed no entry" for a run that was cut off.Compatibility and operational impact
Every pi tree Reef renders from now on carries
maxTokens: 32000where it previously carried none; a deployment whose model answers within a smaller budget is unaffected, since the field is a cap, not a request. Providers clamp a cap above a model's real limit (verified against OpenRouter with 60000 foranthropic/claude-sonnet-5). A deployment that wants another value setsmax_output_tokenson the binding. No wire or persisted format changes.Verification
The three ignored modules fail to collect on this machine without ray and slime, on main as well.
New tests: a pi tree carries the binding's budget as a JSON number and rejects a non-positive one; an agent whose reply was cut at the budget records that rather than "changed no entry".
AI assistance
Claude Code diagnosed the failure from the step records, wrote the change, the tests and this description; the author reviewed the change.
Checklist
README.i18n.yaml, or do not affect README content.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.