Skip to content

ci(backend): widen the AutoPilot tool-schema budget to 65,000 chars - #14455

Open
Pwuts wants to merge 1 commit into
devfrom
pwuts/tool-schema-budget-65k
Open

ci(backend): widen the AutoPilot tool-schema budget to 65,000 chars#14455
Pwuts wants to merge 1 commit into
devfrom
pwuts/tool-schema-budget-65k

Conversation

@Pwuts

@Pwuts Pwuts commented Sep 8, 2026

Copy link
Copy Markdown
Member

Why / What / How

Raises _CHAR_BUDGET in tool_schema_test.py from 61,000 to 65,000 characters, and replaces the stale comment above it.

This widens a gate; it does not fix a problem. The tool-schema budget is a drift alarm — it serialises every schema in TOOL_REGISTRY and fails if the total passes a threshold — and nothing about 61,000 is physically meaningful. What it caught is real drift, and the honest response is a deliberately sized new threshold rather than a claim that anything is now smaller.

dev alone measures 60,984 of 61,000 — sixteen characters of headroom, against a comment claiming ~1,400. That is why #14434 was ejected from the merge queue at 22:34Z: it is green on its own head, green on dev, and the merged combination measures 61,037. It adds 53 characters and had the bad luck to be first.

This is accumulation, not one bad PR. The last bump (#14099, 2026-08-23) granted 1,376 characters of headroom, and the comment recording that was accurate when written — I measured dev at that commit at 59,624. Seventeen days later it is gone, spread across nine tools with no single contribution over 411 characters:

tool at #14099 today Δ
list_team 411 +411 (new tool)
raise_expert 1,793 2,118 +325
ask_question 806 986 +180
hire_expert 610 722 +112
list_workspace_files 604 691 +87
read_workspace_file 1,060 1,132 +72
delegate_to_expert 1,206 1,268 +62
write_workspace_file 1,217 1,271 +54
run_sub_session 881 935 +54
store_skill 711 712 +1
net +1,358

Every one of those authors was reading a comment that promised 1,400 characters of room and adding something that plainly fitted. A wrong comment next to the constant is most of how this reached a release cut unnoticed, so it is corrected in the same diff.

Why 65,000 and not 63,000

The instinct is to pick the smaller number, and one of the ten release PRs (#14424) already proposes 63,000. 63,000 leaves 253 characters over the final state — less than one new parameter description, and about three days at the drift rate measured above (~80 chars/day). The next tool anyone adds ejects a PR from the merge queue again.

65,000 leaves 2,253 characters, sized against what concurrent in-flight PRs add in aggregate rather than against whatever sits on dev today. That is the number that matters, because each branch's CI only ever sees its own delta — a global counter can only fail once the branches are combined, which is the merge queue, which is the most expensive place to discover it. The ten v0.7.5 PRs add 1,763 characters between them and every one of them is individually green. Headroom smaller than that aggregate guarantees another ejection. 2,253 also buys roughly 28 days at the observed drift rate, against the 17 days the last bump bought.

It remains a real ceiling: 3.5% above today's merged total, and any single PR adding a substantial tool without thinking still trips it.

#11220 is a twelfth PR, and it sharpens the ordering question

#11220 is not in the release set I measured, but it touches two registry tools (manage_presets, setup_agent_webhook_trigger) and sets the budget to 62,000. Measured: its head merged into dev is 61,162, a net +178 — it adds trigger_config and constant_inputs on top of a trim to the same two tools. All ten release PRs plus #11220 measures 62,925, which leaves 2,075 against this PR's 65,000. So it does not change the recommendation.

It does change what the smaller ceilings are worth. That same end state leaves 75 characters under 63,000, and exceeds 62,000 by 925. Neither of the other two proposed values survives the set of PRs currently in flight, whichever order they land in — and each is carried by a PR whose own CI is green, because no branch can see the sum. Landing this one first is what makes the order stop mattering.

Why not trim instead

Trimming is a legitimate answer and it is not available tonight at this size. The merged set is 1,747 characters over the current budget, against copy that twenty-one separate bump comments each argue is load-bearing, with no test that would notice if the model behaved worse after a cut.

Two measurements bound how much a trim could yield. Only 53% of the serialized total is description text at all — 33,164 of 62,747 characters; the rest is JSON structure: keys, braces, type names, parameter names, enum values. And the clearest genuine redundancy in the whole registry is connect_integration, which states its supported-providers rule three times ("ONLY call this tool for one of the supported providers listed above — do NOT call it for Google, Gmail, Slack…", "Double-check that the provider is in the supported list above before calling.", "The provider parameter must match what the failing CLI/API actually needs."). Collapsing those to one recovers about 230 characters. Closing 1,747 would need eight such wins, and after connect_integration there are not eight — schedule_followup's 850-character description, the next largest, spends every sentence on a distinct rule.

A trim pass is worth doing on its own merits, with someone watching model behaviour. It is not a release-night lever.

Changes 🏗️

  • _CHAR_BUDGET: 61,000 → 65,000 in autogpt_platform/backend/backend/copilot/tools/tool_schema_test.py.
  • Replaces the trailing comment, which claimed "~1.4k headroom" when the true figure was 16, with the measured drift and the sizing rule for the new number.

No product code changes; the diff is one file and eight lines.

Verified

I measured every one of the ten v0.7.5 PRs merged into dev individually, and all ten merged together, then ran the gate against the combined tree.

The measurement is validated two ways before any number below was trusted. My script's total is byte-identical to the test function's own assertion message on dev (60,984), and merging #14434 into dev locally reproduces the CI failure exactly — 61,037, matching run 34284792185. Local and CI agree, so the note in the file about env-flagged registrations pushing CI higher no longer applies.

Executed on this branch: backend/copilot/tools/tool_schema_test.py (217 passed), backend/util/architecture_test.py (3 passed), backend/blocks/test/test_block.py (1,647 passed, 84 skipped).

Executed on this branch with all ten release PRs merged in locally: tool_schema_test.py, 223 passed, registry measuring 62,747 across 73 tools — the new budget holds against the actual end state, which is the claim this PR rests on. #14424 conflicts on the _CHAR_BUDGET line in that merge, as it must, since it changes the same line to 63,000; that conflict is the intended outcome and makes the newer number visible to whoever resolves it, rather than silently regressing.

Reasoned about but not executed: nothing bearing on the number. The gate is a pure function of the registry.

Full measurement tables, per-PR and per-tool, are in a comment below.

Agents and large language models used

Claude Code with Claude Opus 5

Checklist 📋

For code changes:

  • I have clearly listed my changes in the PR description
  • I have made a test plan
  • I have tested my changes according to the test plan:
    • tool_schema_test.py passes on this branch (217 passed)
    • tool_schema_test.py passes on this branch with all ten v0.7.5 PRs merged in (223 passed, 62,747 chars vs the 65,000 budget)
    • architecture_test.py and blocks/test/test_block.py pass, as they scan the whole tree and no diff points at them
    • The gate still fails when it should: setting the budget to 1 produces Tool schemas use 60984 chars … exceeding budget of 1 chars

dev alone measures 60,984 of the 61,000 budget — sixteen characters of
headroom, against a comment claiming ~1,400. The previous bump's headroom
was consumed in 17 days by nine tools growing 50-400 chars each, with no
single PR at fault, and the next PR to add anything (#14434, +53) was
ejected from the merge queue.

65,000 is sized against what concurrent in-flight PRs add in aggregate —
the ten v0.7.5 PRs add 1,763 chars — because each branch's CI only sees
its own delta, so a global counter can only ever fail in the merge queue.
It leaves 2,253 chars over the 62,747 the registry measures with all ten
merged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-project-automation github-project-automation Bot moved this to 🆕 Needs initial review in AutoGPT development kanban Sep 8, 2026
@github-actions github-actions Bot added cla: signed CLA signed by all contributors platform/backend AutoGPT Platform - Back end and removed cla: signed CLA signed by all contributors labels Sep 8, 2026
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 8c2b8579-20b4-4db2-920d-905149a3676d

📥 Commits

Reviewing files that changed from the base of the PR and between 4ac3646 and d03544c.

📒 Files selected for processing (1)
  • autogpt_platform/backend/backend/copilot/tools/tool_schema_test.py

Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.

📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (1)
Format Python code with `poetry run format`

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • autogpt_platform/backend/backend/copilot/tools/tool_schema_test.py
🔇 Additional comments (1)
autogpt_platform/backend/backend/copilot/tools/tool_schema_test.py (1)

115-122: LGTM!


Walkthrough

The tool schema regression test raises _CHAR_BUDGET from 61,000 to 65,000. Its comment now documents recent tool growth, concurrent v0.7.5 changes, and the remaining headroom.

Changes

Tool schema budget

Layer / File(s) Summary
Update schema character budget
autogpt_platform/backend/backend/copilot/tools/tool_schema_test.py
The test increases _CHAR_BUDGET to 65,000 and documents the headroom calculation based on concurrent tool changes.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to d0354

This updates the tool-schema test budget to accommodate measured schema growth without changing product behavior. No current merge-readiness risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: increasing the AutoPilot tool-schema budget to 65,000 characters.
Description check ✅ Passed The description directly explains the budget increase, its rationale, measured impact, and validation results. It is fully related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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 pwuts/tool-schema-budget-65k

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the cla: signed CLA signed by all contributors label Sep 8, 2026
@Pwuts

Pwuts commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

🤖 Full measurement tables

Every row is that PR merged into dev 4ac3646361 and measured, then reset — independent of each other, except the 14428→14431→14432 stack which is cumulative because that is how it lands. Measurement is len(json.dumps([tool.as_openai_tool() for tool in TOOL_REGISTRY.values()])), the same expression the test uses.

Per-PR totals against the current 61,000 budget

state measured total chars Δ vs dev margin vs 61,000
dev alone (4ac3646361) 60,984 16
+ #14411 60,984 0 16
+ #14412 60,984 0 16
+ #14420 60,984 0 16
+ #14423 60,984 0 16
+ #14424 62,694 +1,710 −1,694
+ #14428 (stack layer 1) 60,984 0 16
+ stack through #14431 60,984 0 16
+ stack through #14432 60,984 0 16
+ #14395 60,984 0 16
+ #14446 60,984 0 16
+ #14434 61,037 +53 −37
all eleven merged 62,747 +1,763 −1,747

Two cross the line. #14434 by 37, and #14424 by 1,694 — though #14424 carries its own bump to 63,000, so on its own head it passes with 306 to spare. All nine merges applied cleanly; there are no conflicts in the set other than the intended one this PR creates with #14424 on the budget line.

What actually grows

Between dev and the merged set, exactly three schemas change:

tool dev merged Δ from
read_expert_chat 1,053 +1,053 #14424, new tool
list_expert_chats 653 +653 #14424, new tool
run_agent 1,998 2,051 +53 #14434

Nothing else moves by a single character. #14412 and #14420 touch copilot/tools/ and change no schema — they changed logic, not descriptions.

The ten largest tools in the merged state

all desc is every description string anywhere in that tool's schema; top desc is the tool-level one only.

# tool schema chars all desc top desc params
1 memory_store 2,816 1,226 293 8
2 raise_expert 2,118 1,301 611 8
3 run_agent 2,051 1,299 453 10
4 schedule_followup 2,045 1,568 850 5
5 connect_integration 2,018 1,623 1,187 3
6 add_understanding 1,993 720 281 16
7 create_agent 1,813 873 162 7
8 setup_agent_webhook_trigger 1,607 943 466 7
9 fix_agent_graph 1,422 788 224 3
10 post_to_chat_platform 1,410 834 485 6

Top ten: 19,293 chars, 30.7% of the total. Across all 73 tools, description text is 33,164 chars — 53% of the serialized total. The biggest tools are big because of nested parameter structure, not prose: memory_store's 2,816 characters carry only 1,226 of description across a nested rule/procedure schema.

Reconciliation

Per-tool figures are each schema serialised alone, and they close against the list total exactly — json.dumps separates list items with ", ", so on dev: 60,842 + 2×70 + 2 = 60,984. A trim of n characters from a description moves the total by exactly n.

Test output
# on this branch
backend/copilot/tools/tool_schema_test.py     217 passed in 0.39s
backend/util/architecture_test.py               3 passed in 7.11s
backend/blocks/test/test_block.py            1647 passed, 84 skipped in 39.70s

# on this branch with all ten v0.7.5 PRs merged in locally
budget in tree: _CHAR_BUDGET = 65_000
backend/copilot/tools/tool_schema_test.py     223 passed in 0.32s
merged total: 62747 tools: 73

# the gate can still fail
$ python -c "import backend.copilot.tools.tool_schema_test as t; t._CHAR_BUDGET = 1; t.test_total_schema_char_budget()"
AssertionError: Tool schemas use 60984 chars (~15246 tokens), exceeding budget of 1 chars ...

One follow-up, not part of this PR

The assertion prints a total and nothing else, so whoever hits it next has to rebuild the attribution above from scratch. Having the failure print the ten largest tools and the delta against the last recorded total would turn that into reading the CI log. Worth a small PR after the release.

@github-actions github-actions Bot added the size/s label Sep 8, 2026
Pwuts added a commit that referenced this pull request Sep 8, 2026
Four comments ran to four and five lines where two or three carry the same
constraint. No behaviour change.

Also record, above `_CHAR_BUDGET` where a resolver will actually see it, that
a merge conflict on that constant resolves to the higher value: #14424 and
#14455 are bumping the same line concurrently, and each branch's CI only
measures its own delta against dev, so taking the incoming side lowers a
ceiling that has to cover every in-flight PR at once.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.47%. Comparing base (4ac3646) to head (d03544c).
⚠️ Report is 3 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #14455      +/-   ##
==========================================
- Coverage   81.48%   81.47%   -0.01%     
==========================================
  Files        3553     3553              
  Lines      265706   265704       -2     
  Branches    24618    24618              
==========================================
- Hits       216514   216491      -23     
+ Misses      43830    43765      -65     
- Partials     5362     5448      +86     
Flag Coverage Δ
platform-backend 86.45% <100.00%> (-0.01%) ⬇️
platform-frontend-e2e 28.01% <ø> (-0.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Platform Backend 86.46% <100.00%> (-0.01%) ⬇️
Platform Frontend 63.16% <ø> (-0.05%) ⬇️
AutoGPT Libs ∅ <ø> (∅)
Classic AutoGPT 28.43% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Pwuts
Pwuts marked this pull request as ready for review September 9, 2026 00:54
@Pwuts
Pwuts requested a review from a team as a code owner September 9, 2026 00:54
@Pwuts
Pwuts requested review from Abhi1992002 and kcze and removed request for a team September 9, 2026 00:54
@Pwuts
Pwuts enabled auto-merge September 9, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: signed CLA signed by all contributors platform/backend AutoGPT Platform - Back end size/s

Projects

Status: 🆕 Needs initial review

Development

Successfully merging this pull request may close these issues.

1 participant