improvement(tools): tell the model which duplicate tool instance is which - #7079
Merged
Merged
Conversation
…hich An agent can hold two entries of the same tool bound to different resources, but they reach a provider byte-identical: user-filled params are stripped from the schema, and only id/description/parameters go on the wire. The second instance's opaque `__sim_2` alias carries no meaning, so the model picks between them arbitrarily. When two or more tools collapse to the same canonical id, each description now names what that instance is bound to — the OAuth account, knowledge base, or workflow. Single-instance tools are untouched and cost no extra lookup. Also removes ProviderToolConfig.name, which no provider ever sent, and the unreferenced createExecutionToolSchema.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThe PR disambiguates duplicate agent-tool instances by appending workspace-scoped resource labels to their descriptions while leaving single-instance tools unchanged.
Confidence Score: 5/5The PR appears safe to merge; no concrete changed-code defect or security-boundary failure remains. Duplicate labeling is conservatively suppressed when labels are incomplete or non-unique, resolution remains workspace-scoped, cache lifetime stays within one execution workspace, and tool routing continues to use provider tool identities rather than the removed name field.
|
| Filename | Overview |
|---|---|
| apps/sim/executor/utils/tool-binding-labels.ts | Adds duplicate grouping, workspace-scoped label resolution, sanitization, caching, and conservative description annotation. |
| apps/sim/providers/tool-binding.ts | Introduces weakly associated resource-binding metadata and canonical duplicate grouping without widening the provider wire shape. |
| apps/sim/providers/utils.ts | Registers resource bindings during tool transformation and removes the unused provider-tool name field. |
| apps/sim/executor/handlers/agent/agent-handler.ts | Annotates duplicate tools after formatting and before provider identity assignment. |
| apps/sim/executor/handlers/pi/local/sim-tools.ts | Applies the same duplicate-binding descriptions to local Pi tools before assigning wire identities. |
| apps/sim/lib/knowledge/service.ts | Adds a narrow, workspace-scoped, non-deleted knowledge-base name lookup. |
| apps/sim/executor/types.ts | Adds an optional run-shared binding-label cache to execution context. |
| apps/sim/providers/types.ts | Removes the unused ProviderToolConfig.name property while retaining id-based provider identity. |
| apps/sim/tools/params.ts | Removes the unreferenced execution-tool schema builder. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Configured agent tools] --> B[Transform to provider tools]
B --> C[Collect bound resource metadata]
C --> D{Duplicate canonical IDs?}
D -- No --> G[Assign provider identities]
D -- Yes --> E[Resolve workspace-scoped labels]
E --> F{All labels distinct and complete?}
F -- No --> G
F -- Yes --> H[Append binding descriptions]
H --> G
G --> I[Provider or local Pi backend]
Reviews (1): Last reviewed commit: "improvement(tools): tell the model which..." | Re-trigger Greptile
This was referenced Aug 26, 2026
Merged
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
id/description/parametersgo on the wire. The second instance's opaque__sim_2alias carries no meaning, so the model picks between them arbitrarily.credential.display_namehas no uniqueness constraint.ProviderToolConfig.name(written in four places, read by none — every provider sendstool.id) and the unreferencedcreateExecutionToolSchema.Type of Change
Testing
26 new unit tests covering the emission rule, partial/duplicate-label suppression, cross-workspace omission, resolver failure, label sanitization, and run-cache reuse. Verified the guards can fail by reverting them. Full suite green: 3,930 tests,
tscclean, all 33 audits pass, lint clean.Backwards compatibility:
ProviderToolConfigis internal only — no API contract, no persistence, no client type — so removingnamehas no wire or stored-data impact. The newExecutionContextcache field is optional and ignored by the snapshot serializer, so resumed runs simply re-resolve. Descriptions change only for duplicate tools.Checklist