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":