From 449f8c954db768a3ad51da4bf37c32aed804fa0c Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 2 Sep 2026 13:41:27 -0700 Subject: [PATCH] test(agent): repoint send-path clone AST contract at turn_context.build_api_messages --- tests/agent/test_send_path_history_isolation.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/agent/test_send_path_history_isolation.py b/tests/agent/test_send_path_history_isolation.py index 051a41472f..1f5f6727a6 100644 --- a/tests/agent/test_send_path_history_isolation.py +++ b/tests/agent/test_send_path_history_isolation.py @@ -172,12 +172,19 @@ class TestSendPathBuildIsWiredToTheClone: import ast import inspect - source = inspect.getsource(cl) - tree = ast.parse(source) + import agent.turn_context as tc + + # The history build lives in turn_context.build_api_messages; the + # prefill insert stays in conversation_loop. Scan both homes. + nodes = [ + node + for mod in (cl, tc) + for node in ast.walk(ast.parse(inspect.getsource(mod))) + ] clone_calls = [] shallow_copies = [] - for node in ast.walk(tree): + for node in nodes: if isinstance(node, ast.Call): fn = node.func if isinstance(fn, ast.Name) and fn.id == "_clone_message_for_send":