Repository navigation
fix(tools): warn about duplicate tool names once, when a collection is built - #266
Merged
Merged
Conversation
…on conformance) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
…tion Syncs tests/vectors to sdk-conformance's updated duplicate-tool-names note, and the shared-vector case now takes the single warning that Tools() emits instead of comparing it with a repeat from to_openai(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…none Covers the path where a caller combines separately fetched collections, which conformance invariant 11 names next to listing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
…nges Pins sdk-conformance to the commit that expects adapters not to repeat the duplicate-tool-names warning, and the Node 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> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.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.
The duplicate-tool-names warning is now logged once, when
Toolsis built. Before,_first_per_namerepeated it on every adapter call that dropped the duplicate:to_openai,to_langchainandto_pydantic_ai. A caller that converts one collection more than once saw the same line each time. The adapters still keep the first tool per name, the oneget_toolreturns. Only the repeat goes.Changes
stackone_ai/tools.py:_first_per_nameno longer calls_warn_duplicate_names.__init__already does, so every collection, including one a caller merges from separate fetches, still warns once.tests/test_multi_account.py: newtest_construction_warns_once, plustest_merging_collections_warns_oncefor a caller-merged collection. The adapter tests now assert that the adapters log nothing.tests/test_shared_vectors.pyandtests/vectors: synced from sdk-conformance branchs2d2/warn-duplicate-names-once. That branch changes theopenai-adapter-duplicate-namesscenario to expect no warning fromto_openai. The message text is unchanged.#262 changed the
_warn_duplicate_namesdocstring to "on every call". A commit on that branch puts the original "Warn once" back, so the two PRs agree.CI and merge order
The
conformancejob pins sdk-conformance and the Node SDK by commit. The last commit on this branch points those pins at the sdk-conformance change (6aba490) and the matching Node branch (8c7af61), 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 Node PR. Once all three are in, re-pin both SDKs to the main commits.
How it was verified
uv run pytestruff check,ruff format --check,ty check stackone_ai examplesopenai-adapter-duplicate-names11 checks each)Gates
The gates ran on 05398a3, the last code commit. 9bb35ff 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, every new PythonToolswarns the same way, 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