From 3475abe21c18501612d7deecadcffb73bfbc09a7 Mon Sep 17 00:00:00 2001 From: S2D2 Date: Wed, 11 Nov 2026 01:22:48 +0000 Subject: [PATCH 1/5] fix(tools): warn once about duplicate tool names (local WIP, blocked on conformance) Co-Authored-By: Claude Opus 5.5 Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com> --- stackone_ai/tools.py | 1 - tests/test_multi_account.py | 13 +++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/stackone_ai/tools.py b/stackone_ai/tools.py index 486b6aa..acdce1d 100644 --- a/stackone_ai/tools.py +++ b/stackone_ai/tools.py @@ -1674,7 +1674,6 @@ def _first_per_name(self) -> list[StackOneTool]: name would not find. OpenAI was sent two functions of one name, and LangChain and Pydantic AI each kept whichever their own lookup happened to find. """ - self._warn_duplicate_names() return list(self._tool_map.values()) def __getitem__(self, index: int) -> StackOneTool: diff --git a/tests/test_multi_account.py b/tests/test_multi_account.py index 3f27c2d..ef542ff 100644 --- a/tests/test_multi_account.py +++ b/tests/test_multi_account.py @@ -663,7 +663,7 @@ def test_a_case_or_space_variant_of_an_sdk_owned_header_is_dropped(self): def _duplicated() -> Tools: - """hris_list on acc1 and acc2. Constructing it warns, so a test clears caplog after.""" + """hris_list on acc1 and acc2. Constructing it warns once; the adapters do not repeat it.""" def tool(name: str, account: str) -> StackOneMcpTool: return StackOneMcpTool( @@ -684,6 +684,11 @@ class TestAdaptersKeepTheFirstOfEachName: "from the lowest account id, is used — pass account ids to choose." ) + def test_construction_warns_once(self, caplog): + with caplog.at_level(logging.WARNING, logger="stackone.tools"): + _duplicated() + assert [r.getMessage() for r in caplog.records] == [self.DUPLICATE_WARNING] + def test_openai(self, caplog): tools = _duplicated() caplog.clear() @@ -693,7 +698,7 @@ def test_openai(self, caplog): ("hris_list", "on acc1"), ("other", "on acc1"), ] - assert [r.getMessage() for r in caplog.records] == [self.DUPLICATE_WARNING] + assert caplog.records == [] def test_langchain(self, caplog): tools = _duplicated() @@ -704,7 +709,7 @@ def test_langchain(self, caplog): ("hris_list", "on acc1"), ("other", "on acc1"), ] - assert [r.getMessage() for r in caplog.records] == [self.DUPLICATE_WARNING] + assert caplog.records == [] def test_pydantic_ai(self, caplog): tools = _duplicated() @@ -715,7 +720,7 @@ def test_pydantic_ai(self, caplog): ("hris_list", "on acc1"), ("other", "on acc1"), ] - assert [r.getMessage() for r in caplog.records] == [self.DUPLICATE_WARNING] + assert caplog.records == [] def test_no_warning_without_a_clash(self, caplog): unique = _duplicated().tools[:2] From 13bec9996033c03155c058b6e814f2cc583589e3 Mon Sep 17 00:00:00 2001 From: S2D2 Date: Wed, 11 Nov 2026 09:55:16 +0000 Subject: [PATCH 2/5] test(vectors): expect the duplicate-names warning once, from construction 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 --- tests/test_shared_vectors.py | 7 +++---- tests/vectors/messages.json | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_shared_vectors.py b/tests/test_shared_vectors.py index 1ac2dad..bddc5c7 100644 --- a/tests/test_shared_vectors.py +++ b/tests/test_shared_vectors.py @@ -464,11 +464,10 @@ def _skip_account(mp, log) -> Emitted: def _duplicate_tool_names(mp, log) -> Emitted: tools = Tools([_served_tool({"type": "object", "properties": {}}, "t") for _ in range(2)]) - # Once by the collection, and again by each adapter that keeps the first of each name. + # Once by the collection; the adapter drops the duplicate without repeating it. tools.to_openai() - collection, adapter = _warnings(log) - assert collection == adapter - return adapter, {"count": 1, "names": "t"} + (warning,) = _warnings(log) + return warning, {"count": 1, "names": "t"} def _account_id_env_ignored(mp, log) -> Emitted: diff --git a/tests/vectors/messages.json b/tests/vectors/messages.json index b5a1d47..f74d00f 100644 --- a/tests/vectors/messages.json +++ b/tests/vectors/messages.json @@ -190,7 +190,7 @@ "python": true, "node": true }, - "notes": "Language-neutral wording: neither SDK's method or parameter names. Emitted once when a fetched collection holds a clashing name, and again by every adapter that keeps the first tool per name and drops the rest: OpenAI, LangChain, Pydantic AI, AI SDK and Claude Agent SDK. Listing order is ascending account id, so the first is the lowest account id's." + "notes": "Language-neutral wording: neither SDK's method or parameter names. Emitted once, when a fetched collection holds a clashing name. The adapters that keep the first tool per name and drop the rest (OpenAI, LangChain, Pydantic AI, AI SDK and Claude Agent SDK) do not repeat it. Listing order is ascending account id, so the first is the lowest account id's." }, { "id": "mcp-timeout", From b465c08f37cd5e5f1c84544cd520c5343ec5f2ed Mon Sep 17 00:00:00 2001 From: S2D2 Date: Wed, 11 Nov 2026 10:00:20 +0000 Subject: [PATCH 3/5] test(vectors): sync the duplicate-names note Co-Authored-By: Claude Opus 5.5 --- tests/vectors/messages.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/vectors/messages.json b/tests/vectors/messages.json index f74d00f..7a33528 100644 --- a/tests/vectors/messages.json +++ b/tests/vectors/messages.json @@ -190,7 +190,7 @@ "python": true, "node": true }, - "notes": "Language-neutral wording: neither SDK's method or parameter names. Emitted once, when a fetched collection holds a clashing name. The adapters that keep the first tool per name and drop the rest (OpenAI, LangChain, Pydantic AI, AI SDK and Claude Agent SDK) do not repeat it. Listing order is ascending account id, so the first is the lowest account id's." + "notes": "Language-neutral wording: neither SDK's method or parameter names. Emitted once, when a tool collection holding a clashing name is built: by listing, or by the caller combining collections. The adapters that keep the first tool per name and drop the rest (OpenAI, LangChain, Pydantic AI, AI SDK and Claude Agent SDK) do not repeat it. Listing order is ascending account id, so the first is the lowest account id's." }, { "id": "mcp-timeout", From 05398a3f1e119297beb7e514f92c17601a75583e Mon Sep 17 00:00:00 2001 From: S2D2 Date: Wed, 11 Nov 2026 10:08:50 +0000 Subject: [PATCH 4/5] test(tools): merging two collections warns once and the adapter adds 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 Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com> --- tests/test_multi_account.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_multi_account.py b/tests/test_multi_account.py index ef542ff..31e423f 100644 --- a/tests/test_multi_account.py +++ b/tests/test_multi_account.py @@ -689,6 +689,15 @@ def test_construction_warns_once(self, caplog): _duplicated() assert [r.getMessage() for r in caplog.records] == [self.DUPLICATE_WARNING] + def test_merging_collections_warns_once(self, caplog): + tools = _duplicated() + first = Tools([t for t in tools if t.get_account_id() == "acc1"]) + second = Tools([t for t in tools if t.get_account_id() == "acc2"]) + caplog.clear() + with caplog.at_level(logging.WARNING, logger="stackone.tools"): + Tools([*first, *second]).to_openai() + assert [r.getMessage() for r in caplog.records] == [self.DUPLICATE_WARNING] + def test_openai(self, caplog): tools = _duplicated() caplog.clear() From 9bb35ffe5d06fde134e85d93a21d0d44e8004ad3 Mon Sep 17 00:00:00 2001 From: S2D2 Date: Wed, 11 Nov 2026 09:57:38 +0000 Subject: [PATCH 5/5] ci(conformance): grade against the warn-once conformance and Node changes 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 Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com> --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 67bb203..0d2ef1f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -114,7 +114,7 @@ jobs: env: # Pinned to a commit on stackone-ai-node's main, not the branch, so a Node change never # silently changes what this job grades. Bump it deliberately. - NODE_SDK_REF: 099fd1e3405f8a56125f9691e20ccd1333dda12f + NODE_SDK_REF: 8c7af617a4c62c0eedccda4fea1254b77de10e8e steps: - name: Check conformance token is configured env: @@ -134,7 +134,7 @@ jobs: uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: repository: StackOneHQ/sdk-conformance - ref: 4ead1c25bb443ef1fd1986d5f053b2d1475d0e90 + ref: 6aba490ee49b298643e3a0bb9fbbaecf36c0edd7 token: ${{ secrets.CONFORMANCE_REPO_TOKEN }} path: sdk-conformance persist-credentials: false