Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion stackone_ai/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
22 changes: 18 additions & 4 deletions tests/test_multi_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -684,6 +684,20 @@ 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_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()
Expand All @@ -693,7 +707,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()
Expand All @@ -704,7 +718,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()
Expand All @@ -715,7 +729,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]
Expand Down
7 changes: 3 additions & 4 deletions tests/test_shared_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/vectors/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 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",
Expand Down
Loading