@@ -199,6 +199,16 @@ def test_append_sub_output_part_caps_buffer_at_200_chars():
199199 assert len (combined ) <= 200
200200
201201
202+ def test_append_sub_output_part_caps_buffer_across_multiple_appends ():
203+ block = _ToolCallBlock (_tool_call ("Agent" , '{"description":"scan"}' ))
204+ call = _tool_call_with_id ("sub-1" , "Bash" , '{"command":"ls"}' )
205+ block .append_sub_tool_call (call )
206+ for _ in range (30 ):
207+ block .append_sub_output_part ("sub-1" , "x" * 10 ) # 300 chars total, 10 at a time
208+ combined = "" .join (block ._subagent_output_parts ["sub-1" ])
209+ assert len (combined ) <= 200
210+
211+
202212def test_append_sub_output_part_tracks_stderr ():
203213 block = _ToolCallBlock (_tool_call ("Agent" , '{"description":"scan"}' ))
204214 call = _tool_call_with_id ("sub-1" , "Bash" , '{"command":"cat missing"}' )
@@ -222,9 +232,6 @@ def test_mark_sub_execution_started_discards_unknown_id():
222232
223233
224234def test_finish_sub_tool_call_cleans_up_output_state ():
225- from pythinker_code .wire .types import ToolResult
226- from pythinker_core .tooling import ToolOk
227-
228235 block = _ToolCallBlock (_tool_call ("Agent" , '{"description":"scan"}' ))
229236 call = _tool_call_with_id ("sub-1" , "Bash" , '{"command":"ls"}' )
230237 block .append_sub_tool_call (call )
0 commit comments