Skip to content

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

Merged
glebedel merged 5 commits into
mainfrom
s2d2/audit-warn-duplicate-names-once
Nov 11, 2026
Merged

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

Conversation

@glebedel

@glebedel glebedel commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

The duplicate-tool-names warning is now logged once, when Tools is built. Before, _first_per_name repeated it on every adapter call that dropped the duplicate: to_openai, to_langchain and to_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 one get_tool returns. Only the repeat goes.

Changes

  • stackone_ai/tools.py: _first_per_name no 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: new test_construction_warns_once, plus test_merging_collections_warns_once for a caller-merged collection. The adapter tests now assert that the adapters log nothing.
  • tests/test_shared_vectors.py and tests/vectors: synced from sdk-conformance branch s2d2/warn-duplicate-names-once. That branch changes the openai-adapter-duplicate-names scenario to expect no warning from to_openai. The message text is unchanged.

#262 changed the _warn_duplicate_names docstring 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 conformance job 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

Check Result
uv run pytest 873 passed
ruff check, ruff format --check, ty check stackone_ai examples clean
sdk-conformance full suite with this branch and the matching Node build RESULT: PASS (openai-adapter-duplicate-names 11 checks each)

Gates

The gates ran on 05398a3, the last code commit. 9bb35ff 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, every new Python Tools warns the same way, 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 9bb35ff: every job passes, conformance included
Unresolved review threads 0

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

🤖 Generated with Claude Code

s2d2-s1 and others added 4 commits November 11, 2026 01:22
…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>
@glebedel glebedel self-assigned this Nov 11, 2026
…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>
@glebedel
glebedel merged commit 67e6973 into main Nov 11, 2026
14 checks passed
@glebedel
glebedel deleted the s2d2/audit-warn-duplicate-names-once branch November 11, 2026 10:57
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