Repository navigation
fix(tools): warn about duplicate tool names once, when a collection is built - #409
Merged
Merged
Conversation
fetchTools() already warns when two accounts serve the same tool name. Every adapter (toOpenAI, toAISDK, toLangChain, toClaudeAgentSdk and the rest) repeated the same warning each time it dropped the duplicate, so a caller that converts one collection several times saw the line again and again. The adapters still keep the first tool per name; they just stop repeating the warning. Matches sdk-conformance openai-adapter-duplicate-names, which now expects toOpenAI to add no warning, and syncs tests/vectors to that branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
Moving the warning out of the adapters left fetchTools() as its only source, so a collection built by hand, for example two separately fetched collections merged with new Tools([...a, ...b]), dropped the duplicate from every adapter without a warning. The Tools constructor now warns, as the Python SDK's does, and fetchTools() relies on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
commit: |
…hanges Pins sdk-conformance to the commit that expects adapters not to repeat the duplicate-tool-names warning, and the Python SDK to its matching change. Re-pin both to their main commits once those PRs merge. Co-Authored-By: Claude Opus 5.5 <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.
Summary
Toolsconstructor. Before, the same line was repeated by every adapter call that dropped the duplicate (toOpenAI,toAISDK,toLangChain,toClaudeAgentSdkand the rest). One fetch followed by the usual conversions logged it 8 times. The existing test asserted exactly that.getTool()returns. Only the repeat goes.fetchTools()into the constructor, the same place the Python SDK warns. This means a collection built by hand also warns. Without the move, two collections fetched separately and merged withnew Tools([...a, ...b])would drop one tool silently. A new test covers that path.tests/vectorsis synced from sdk-conformance branchs2d2/warn-duplicate-names-once. That branch changes theopenai-adapter-duplicate-namesscenario to expect no warning fromtoOpenAI, and rewords the vector note. The message text is unchanged.CI and merge order
The
conformancejob pins sdk-conformance and the Python SDK by commit. The last commit on this branch points those pins at the sdk-conformance change (6aba490) and the matching Python branch (05398a3), so CI grades this branch against the new scenario. Those are PR heads, not main commits.Order: merge the sdk-conformance change, then this PR and the matching Python PR. Once all three are in, re-pin both SDKs to the main commits.
Test plan
pnpm lint(oxfmt, oxlint type-aware, knip)pnpm vitest run srcpnpm test(all projects)scripts/package-exports.test.tsNode16 consumer check, which needstscon PATH and fails the same way on unchangedmainin this environmentopenai-adapter-duplicate-names11 checks each)Gates
The gates ran on 8c7af61, the last code commit. 8e2183f changes only the two pins in
.github/workflows/ci.yaml.new Tools([...a, ...b]), dropped duplicates with no warning at all. Fixed by warning in theToolsconstructor (Node 8c7af61), with conformance wording to match (6aba490). Re-check on 8c7af61: 2 P2s, both declined.filter()warns again when duplicates survive: it builds a new collection, the Python SDK does the same, and the contract defines the warning per built collection. Changing a tool'snameafter construction bypasses the check, but that predates this change. A third P2 is left as a follow-up: the warning text says the lowest account id is used, which is wrong for a collection a caller merged in another order. That text is a shared vector both SDKs emit, so changing it needs its own conformance changeconformanceincludedRequested by guillaume@stackone.com in Slack (repo audit thread).
🤖 Generated with Claude Code