Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

test: cancellation edge case in test (#6379)

cthomas898c0ed83e43
diff --git a/tests/integration_test_send_message_v2.py b/tests/integration_test_send_message_v2.py
index e38c97158..66028048a 100644
--- a/tests/integration_test_send_message_v2.py
+++ b/tests/integration_test_send_message_v2.py
@@ -224,6 +224,11 @@ def assert_tool_call_response(
assert messages[index].otid and messages[index].otid[-1] == str(otid_suffix)
index += 1
+ # If cancellation happens before tool return, we might get LettaStopReason directly
+ if with_cancellation and index < len(messages) and isinstance(messages[index], LettaStopReason):
+ assert messages[index].stop_reason == "cancelled"
+ return # Skip remaining assertions for very early cancellation
+
# Tool return message
otid_suffix = 0
assert isinstance(messages[index], ToolReturnMessage)