Skip to content

fix(tools): warn about duplicate tool names once, when a collection is built - #409

Merged
glebedel merged 3 commits into
mainfrom
s2d2/warn-duplicate-names-once
Nov 13, 2026
Merged

glebedel merged 3 commits into
mainfrom
s2d2/warn-duplicate-names-once

Conversation

@glebedel

@glebedel glebedel commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Duplicate tool names now produce one warning, from the Tools constructor. Before, the same line was repeated by every adapter call that dropped the duplicate (toOpenAI, toAISDK, toLangChain, toClaudeAgentSdk and the rest). One fetch followed by the usual conversions logged it 8 times. The existing test asserted exactly that.
  • The adapters still keep the first tool per name, the one getTool() returns. Only the repeat goes.
  • The warning moves from 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 with new Tools([...a, ...b]) would drop one tool silently. A new test covers that path.
  • tests/vectors is synced from sdk-conformance branch s2d2/warn-duplicate-names-once. That branch changes the openai-adapter-duplicate-names scenario to expect no warning from toOpenAI, and rewords the vector note. The message text is unchanged.

CI and merge order

The conformance job 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

Check Result
pnpm lint (oxfmt, oxlint type-aware, knip) clean
pnpm vitest run src 891 passed
pnpm test (all projects) all pass except scripts/package-exports.test.ts Node16 consumer check, which needs tsc on PATH and fails the same way on unchanged main in this environment
sdk-conformance full suite with this build and the matching Python branch RESULT: PASS (openai-adapter-duplicate-names 11 checks each)

Gates

The gates ran on 8c7af61, the last code commit. 8e2183f changes only the two pins in .github/workflows/ci.yaml.

Gate Result
/forge:forge meter on all three branches: 0 findings, 0 copies, longest added comment 2 lines; one dash in a doc comment this change touched was removed
Security scan + Aikido no dependency or manifest change, so the dependency reviewer does not apply. Aikido open issues in all three repos sit in lockfiles, workflows and unrelated scripts, none on a file this change touches
Codex security first pass (all three branches): one finding. Node collections built by hand, e.g. two fetches merged with new Tools([...a, ...b]), dropped duplicates with no warning at all. Fixed by warning in the Tools constructor (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's name after 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 change
/security-review only log calls move; no secret, header or account id is newly logged, and the warning text is unchanged
/code-review Reviewer agent: one test gap fixed (Python now has the merged-collection test, 05398a3). Two items declined: the Node vector note was already synced, and the dashes flagged are in lines this change did not add
CI 8e2183f: every job passes, conformance included
Unresolved review threads 0. Aikido raised one low (renaming a tool after construction skips the warning); declined in the thread, same reasoning as the Codex re-check

Requested by guillaume@stackone.com in Slack (repo audit thread).

🤖 Generated with Claude Code

s2d2-s1 and others added 2 commits November 11, 2026 09:55
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>
@glebedel
glebedel requested a review from a team as a code owner November 11, 2026 10:09
@glebedel glebedel self-assigned this Nov 11, 2026
@pkg-pr-new

pkg-pr-new Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/StackOneHQ/stackone-ai-node/@stackone/ai@409

commit: 8e2183f

Comment thread src/tool.ts Resolved
…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>
@glebedel
glebedel requested a review from StuBehan November 11, 2026 14:06
@glebedel
glebedel merged commit 332be70 into main Nov 13, 2026
31 checks passed
@glebedel
glebedel deleted the s2d2/warn-duplicate-names-once branch November 13, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants