Skip to content

Commit f33c983

Browse files
test: cover non-ambiguous id-less decision path in _apply_tool_execution_decisions
Adds a regression test where a decision without a tool_call_id has a unique tool name: the ambiguity guard must not raise and the decision should be applied normally. This exercises the guard's non-raising branch, which the two existing same-name tests (both asserting the raise) did not cover.
1 parent 481ba7b commit f33c983

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/human_in_the_loop/test_strategies.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,22 @@ def test_two_teds_same_name_one_with_id_one_without(self):
412412
],
413413
)
414414

415+
def test_ted_without_id_unique_name_applies_normally(self):
416+
# An id-less decision whose tool name is unique is not ambiguous, so the guard must not raise: name-based
417+
# matching is unambiguous here. The decision should be applied normally.
418+
message_with_tool_calls = ChatMessage.from_assistant(
419+
tool_calls=[ToolCall(tool_name="search", arguments={"q": "a"})]
420+
)
421+
rejection_messages, new_tool_call_messages = _apply_tool_execution_decisions(
422+
tool_call_messages=[message_with_tool_calls],
423+
tool_execution_decisions=[
424+
ToolExecutionDecision(tool_name="search", execute=True, final_tool_params={"q": "a"})
425+
],
426+
)
427+
assert rejection_messages == []
428+
assert len(new_tool_call_messages) == 1
429+
assert new_tool_call_messages[0].tool_calls == [ToolCall(tool_name="search", arguments={"q": "a"})]
430+
415431

416432
class TestUpdateChatHistory:
417433
@pytest.fixture

0 commit comments

Comments
 (0)