Fix virtual tool grouping dropping tools - #327576
Draft
bhavyaus wants to merge 2 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes virtual-tool regrouping so tools remain reachable during long agent sessions.
Changes:
- Adds lossless grouping fallbacks and hard-limit handling.
- Preserves used and pending tools across regrouping.
- Improves missing-tool telemetry and regression coverage.
Show a summary per file
| File | Description |
|---|---|
virtualToolGrouping.spec.ts |
Tests stable ordering and called-tool expansion. |
virtualToolGrouper.spec.ts |
Expands grouping boundary coverage. |
toolDropRepro.spec.ts |
Reproduces tool-loss scenarios. |
virtualToolGrouper.ts |
Recovers omitted tools and allocates grouping slots. |
toolGrouping.ts |
Stabilizes regrouping and preserves used tools. |
toolEmbeddingsComputer.ts |
Adds lossless embedding fallbacks. |
toolCalling.tsx |
Revises missing-request-tool handling and telemetry. |
toolCalling.spec.ts |
Tests missing-tool telemetry. |
defaultIntentRequestHandler.spec.ts |
Tests pending-tool expansion. |
defaultIntentRequestHandler.ts |
Expands pending calls before regrouping. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 3
- Review effort level: Medium
Comment on lines
+263
to
+265
| for (const nested of item.all()) { | ||
| placed.add(nested.name); | ||
| } |
| outcome = ToolInvocationOutcome.DisabledByUser; | ||
| throw new Error(`Tool ${props.toolCall.name} is currently disabled by the user, and cannot be called.`); | ||
| outcome = ToolInvocationOutcome.NotInRequestToolset; | ||
| throw new Error(`Tool ${props.toolCall.name} is not part of this request's toolset, so it cannot be called. It is either disabled in Configure Tools, or grouped behind an activate_* tool that has not been called yet.`); |
| const result = VirtualToolGrouper.deduplicateGroups(items) as Array<VirtualTool | LanguageModelToolInformation>; | ||
| expect(result).toHaveLength(1); | ||
| expect(result[0].name).toBe(dupName); | ||
| expect(VirtualToolGrouper.deduplicateGroups(items)).toHaveLength(items.length); |
bhavyaus
marked this pull request as draft
July 27, 2026 05:31
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.
Summary
Fix virtual tool regrouping so registered tools remain reachable throughout long agent sessions.
Fixes #324113