Repository navigation
fix(agent): reject duplicate client tool names - #34
Closed
alexb-openrouter wants to merge 1 commit into
Closed
alexb-openrouter wants to merge 1 commit into
alexb-openrouter wants to merge 1 commit into
Conversation
Tool calls are dispatched by name to the first matching client tool, so two tools with the same name let the first one receive arguments the model or an approver meant for the other, including an approved call resumed with a different tool list. call_model now raises when client tool names collide.
Contributor
|
Superseded; this PR was closed. |
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.
Summary
Tool calls are dispatched by name to the first matching client tool (
model_result.py,tool_executor.py,conversation_state.py). With two client tools sharing a name, the first one listed receives arguments meant for the other. That includes an approved call: pause with[trusted], resume with[other, trusted]andapprove_tool_calls, andotherruns with the approved arguments.ModelResult.__init__now callsassert_unique_client_tool_names(options["tools"]), which raisesValueError('Duplicate tool name "<name>" ...')before any request or tool execution. Server tools are skipped. This ports upstream@openrouter/agent1.2.1 (assertUniqueClientToolNames).Tests:
tests/unit/test_duplicate_tool_names.py(the resume case fails onmainand passes here);pytest tests/unit,ruff check,ruff format --check,mypy src testsclean.