GeezerVison is showing github.com — test(agent): raise the eager tool schema ceiling to 3650 by Vasanthdev2004 · Pull Request #877 · Twigpine/zero
Conversation
Vasanthdev2004
commented
Aug 8, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
main is red and every open PR inherits it. TestEagerToolSchemaTokenBudget fails at 3578 tokens against a 3550 ceiling.
Where it came from
Bisected: edf660ab and 4ca4fa75 pass, cd0eb194 (#843, which added view_image to the core set) fails at 3588. #867 later trimmed it to 3578, still over.
#843's own CI was green. The ceiling is only crossed once the tool set is combined, so no per-PR check could have caught it, and I merged it on the strength of "CLEAN, no failing checks". Worth knowing that is a blind spot for anything measuring a whole-set budget.
Raised rather than paid down
The overrun is 28 tokens. Per-tool cost in the eager set:
exec_command 909 request_permissions 397
ask_user 387 update_plan 256
lsp_navigate 252 grep 215
write_stdin 205 web_fetch 187
read_file 181 glob 160
read_minified_file 121 list_directory 114
skill 112 view_image 82
view_image is the second cheapest tool in the set. It is not the problem, it is just what crossed the line. The alternative was trimming a description to reclaim 28 tokens, degrading a tool's usability to satisfy a line drawn against a 2026-07 measurement that predates two tools since added.
The ratchet did its job: it caught the creep and forced this to be a decision rather than a drift. Keeping it that way means raising it deliberately, with the reason written down, which is what this does.
The failure message was wrong
It advised "defer a tool". This test pins DeferThreshold at 0, so deferral is inactive and marking a tool deferred leaves it exposed here, changing nothing. I confirmed that by actually deferring view_image: the count stayed at 3578 across 14 tools, and it broke registry_test.go besides, since the deferrable-builtin list is curated.
Deferring is still worth doing for real sessions, it just cannot move this number. The message now names the levers that can: a smaller schema, one fewer core tool, or a deliberate raise.
Validation
go build ./..., go vet, gofmt, and the full internal/agent and internal/tools suites pass. One file changed.
Summary by CodeRabbit
- Tests
- Increased the allowed tool-schema token threshold.
- Improved test failure guidance with clearer troubleshooting options and rationale.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
main is red. TestEagerToolSchemaTokenBudget fails at 3578 tokens against
a 3550 ceiling, and every open PR inherits it.
Bisected: edf660a and 4ca4fa7 pass, cd0eb19 (#843, which added
view_image to the core set) fails at 3588. #867 later trimmed it to 3578.
#843's own CI was green, because the ceiling is only crossed once the
tool set is combined, so no per-PR check could have caught it.
Raised rather than paid down. The overrun is 28 tokens, and view_image
costs 82, the second cheapest tool in the set against exec_command's 909
and request_permissions' 397. It is simply the one that crossed the line.
The alternative was trimming a description to reclaim 28 tokens,
degrading a tool's usability to satisfy a line drawn against a 2026-07
measurement that predates two tools. The ratchet worked exactly as
intended: it caught the creep and forced a decision instead of a drift.
Also corrects the failure message. It advised "defer a tool", but this
test pins DeferThreshold at 0 so deferral is inactive and marking a tool
deferred leaves it exposed here, changing nothing. Deferring is still
worth doing for real sessions; it just cannot move this number. The
levers that can are a smaller schema, one fewer core tool, or a
deliberate raise, and the message now says so.
|

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 47e48b37-d77f-4fe9-aa01-d71adfb78d89
📥 Commits
Reviewing files that changed from the base of the PR and between 57858a3 and 8e282f7.
📒 Files selected for processing (1)
internal/agent/prompt_budget_test.go
Walkthrough
The prompt budget test raises the eager tool schema token ceiling from 3550 to 3650. It documents the measured count and updates failure guidance to identify schema reduction, core tool removal, or deliberate ceiling increases as remediation options.
Changes
Prompt budget validation
| Layer / File(s) |
Summary |
Eager schema budget and failure guidance internal/agent/prompt_budget_test.go |
The test raises maxEagerToolSchemaTokens to 3650, documents the measured token count, and clarifies that deferring tools cannot reduce the eager count. |
Estimated code review effort: 1 (Trivial) | ~5 minutes
Suggested reviewers: anandh8x
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name |
Status |
Explanation |
| Description Check |
✅ Passed |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
✅ Passed |
The title clearly and concisely describes the main change: raising the eager tool schema ceiling to 3650. |
| Docstring Coverage |
✅ Passed |
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check |
✅ Passed |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
✅ Passed |
Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
📝 Generate docstrings
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
fix/eager-tool-budget-view-image
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Zero automated PR review
Verdict: No blockers found
Blockers
Validation
- [pass] Diff hygiene:
git diff --check
- [pass] Tests:
go test ./...
- [pass] Build:
go run ./cmd/zero-release build
- [pass] Smoke build:
go run ./cmd/zero-release smoke
Scope
Head: 8e282f7745c9
Changed files (1): internal/agent/prompt_budget_test.go
This deterministic review checks validation status and basic diff hygiene. A human reviewer still owns product judgment and design quality.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@anandh8x @jatmn this one is small and it unblocks everyone, so it is worth jumping the queue.
main is red. TestEagerToolSchemaTokenBudget fails at 3578 tokens against a 3550 ceiling on ff608c78, and every open PR inherits it. I bisected it to cd0eb19 (#843, which added view_image to the core set); 4ca4fa75 and edf660ab both pass. #843's own CI was green, because the ceiling is only crossed once the tool set is combined, so no per-PR check could have caught it. I merged it, so this is mine to clean up.
This raises the ceiling to 3650 with the reasoning written into the constant. One file, test-only.
Two things worth your eyes rather than a rubber stamp:
The choice to raise instead of trim. The overrun is 28 tokens and view_image costs 82, the second cheapest tool in the set against exec_command's 909. Trimming a description to reclaim 28 tokens would degrade a tool to satisfy a line drawn against a 2026-07 measurement that predates two tools. If either of you thinks the ratchet should bite here instead, say so and I will trim rather than raise.
I also corrected the failure message. It advised "defer a tool", which cannot work: the test pins DeferThreshold at 0, so deferral is inactive and a deferred tool stays exposed. I confirmed that by actually deferring view_image, which left the count at 3578 and broke registry_test.go besides, since the deferrable-builtin list is curated.
Separately, and not part of this PR: CI reported success on ff608c78 while this test fails locally. Something is not running it, or not failing on it. A budget ratchet that only trips on a developer's machine is not doing its job, and that is worth someone chasing.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed at 8e282f77. I went to verify the premise before the change, and I can't reproduce it — so this is a comment rather than an approval.
The red main this fixes appears to already be green
The PR opens with "main is red and every open PR inherits it. TestEagerToolSchemaTokenBudget fails at 3578 against a 3550 ceiling." I measured the eager set at three points and it is 3423 tokens across 14 tools at every one:
| ref |
measured |
ceiling |
result |
57858a31 (#867 — this PR's own base) |
3423 |
3550 |
PASS, 127 headroom |
7f39a630 (current main, #879) |
3423 |
3550 |
PASS |
8e282f77 (this PR's head) |
3423 |
3650 |
PASS |
It passes at the PR's own base, so the ceiling was not being crossed at the commit this branched from, let alone on current main. GitHub's CI agrees: the CI job is success on both 7f39a630 and ff608c78, the two most recent commits on main. And independently — when I rebased #829 onto current main yesterday, its go test ./... leg ran green, internal/agent included.
I genuinely can't find where 3578 comes from. The set is deterministic (CoreToolsScoped(dir, nil) — no MCP, 14 tools; estimateToolDefTokens marshals a key-sorted map, so it's stable across runs and platforms). The most likely explanation is a transient local measurement — extra tools registered in the session, or a tree state before #867's description trims fully settled — rather than the committed reality. If there's a CI run on main that's actually red on this test, point me at it and I'll withdraw this; I looked and found only green.
What that means for the change
As written, the effect is to raise a deliberate ratchet from 3550 to 3650 — from 127 tokens of headroom to 227 — to fix a failure that isn't occurring. That is exactly the reflexive raise the new comment warns against: "keep raising it deliberately rather than reflexively." The ratchet's value is that 3423 sits close under 3550; widening the gap by 100 tokens on a premise that doesn't hold spends that value for nothing.
The rest of the PR is genuinely good and I'd keep it
Two things here are correct and worth landing regardless of the ceiling number:
- The failure-message fix is a real bug. The old text said "defer a tool or raise the ceiling," but the test sets
Options{}, which pins DeferThreshold at 0 — the comment right above the assertion says so. Deferring a tool leaves it exposed here and moves the number by zero. The new message ("trim a schema, drop a core tool, or raise the ceiling deliberately — deferring will NOT help: this test disables deferral") sends the next person to a lever that actually works. That's a good catch.
- The whole-set-budget blind-spot note in the description is a sharp observation: #843 was green on its own CI and only crossed a combined-set budget once merged, which no per-PR check measures. That's worth codifying somewhere more durable than a PR body.
Suggestion
Rather than raise the ceiling, I'd split the value out: keep 3550, keep the improved failure message and the DeferThreshold-is-0 comment, and retitle to the message/documentation fix it really is. If you can reproduce a red main I can't see, then the raise is justified — but then the PR body's numbers (3588 → 3578) should be re-measured against current main, because what I see committed is 3423.
Also minor: the branch is 2 commits behind main (#873, #879) and would want a rebase before merge.
Not blocking — it's a test-only change and harmless to correctness. But I don't want to approve loosening a guard to fix a failure I've now checked for at three commits plus CI and can't find.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
jatmn
jatmn approved these changes
anandh8x
Awaiting requested review from anandh8x
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|