[v2] Dispatcher/ServerRunner receive-path swap — replaces BaseSession (#2710)

This commit is contained in:
Max 2026-06-09 12:58:47 +01:00 • committed by GitHub
commit 5d826490b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -120,6 +120,16 @@ def test_validate_tool_use_result_messages_raises_when_tool_result_without_previ
validate_tool_use_result_messages(messages)
def test_validate_tool_use_result_messages_raises_when_previous_message_has_no_tool_use() -> None:
"""Raises when tool_result follows a message that has content but no tool_use."""
messages = [
SamplingMessage(role="assistant", content=TextContent(type="text", text="just text")),
SamplingMessage(role="user", content=ToolResultContent(type="tool_result", tool_use_id="tool-1")),
]
with pytest.raises(ValueError, match="do not match any tool_use in the previous message"):
validate_tool_use_result_messages(messages)
def test_validate_tool_use_result_messages_raises_when_tool_result_ids_dont_match_tool_use() -> None:
"""Raises when tool_result IDs don't match tool_use IDs."""
messages = [