feat(runtime): bucket ungrouped native tools by categoryHint in tool search - #4376
Open
liugddx wants to merge 1 commit into
Open
feat(runtime): bucket ungrouped native tools by categoryHint in tool search#4376liugddx wants to merge 1 commit into
liugddx wants to merge 1 commit into
Conversation
…search Deferred tool discovery collapsed every ungrouped native tool into a single opaque `other` group in the tool_search inventory, giving the model no capability signal to browse by. Bucket ungrouped tools by the permission `categoryHint` (ToolCategory) already present on the bound tool into compact capability families (filesystem, shell, web, browser, computer_use, client capabilities, agents). This reads existing metadata only — no tool schema is loaded and permission classification is untouched. A caller-supplied group with a colliding id keeps precedence (family members merge into it); tools with no hint or `custom_tool` still fall back to `other`. Adds two regression tests: family bucketing by categoryHint, and explicit-group precedence over a categoryHint family. Part of apache#4267. Closes apache#4353. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Deferred tool discovery (
tool_search) collapsed every ungrouped native tool into a single opaqueothergroup in the searchable inventory. When the model browses the inventory it sees one undifferentiatedotherbucket with no capability signal to steer by.This buckets ungrouped native tools by the permission
categoryHint(ToolCategory) already present on the bound tool, producing a compact capability-family map instead:read/file_write/fs_destructivefilesystemshell_safe/shell_unsafe/privileged/git_destructiveshellweb_read/network_sendwebbrowserbrowsercomputer_usecomputer_useclient_capabilityclient_capabilitysubagentagentsWhy it's safe
custom_tool) still fall back toother— no behavior change for them.Tests
Two regression tests added to
tool-availability.test.ts:buckets ungrouped native tools into capability families by categoryHint— asserts distinct hints land in distinct families,custom_tool/hint-less fall back toother, family ids surface in the searchable inventory, and every tool stays gated + deferred.a caller-supplied group keeps precedence over a categoryHint family— an explicit group claims a tool; only the remaining hinted tool is family-bucketed; noother.Causal proof (fail-without / pass-with): with the production hunk temporarily reverted to the old "all →
other" logic, exactly these two new tests fail (bySource.agents/web/computer_usecome backundefined); with the fix restored, all 20 tests in the suite pass. So the tests gate on this logic rather than passing vacuously.Part of #4267. Closes #4353.