Skip to content

test(agent): raise the eager tool schema ceiling to 3650 - #877

Open
Vasanthdev2004 wants to merge 1 commit into
mainfrom
fix/eager-tool-budget-view-image
Open

test(agent): raise the eager tool schema ceiling to 3650#877
Vasanthdev2004 wants to merge 1 commit into
mainfrom
fix/eager-tool-budget-view-image

Conversation

@Vasanthdev2004

@Vasanthdev2004 Vasanthdev2004 commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

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.

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.
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

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.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Zero automated PR review

Verdict: No blockers found

Blockers

  • None found.

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.

@Vasanthdev2004

Copy link
Copy Markdown
Collaborator Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant