From 2c8cd8e07f79e1564be48a16bd6c1451024d6839 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Wed, 26 Nov 2025 19:18:33 +0000 Subject: [PATCH] Fixed streaming tests in integration for agent fw --- .../test_agent_streaming_integration.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/integration/test_agent_streaming_integration.py b/tests/integration/test_agent_streaming_integration.py index 9992b74a..ea7c890d 100644 --- a/tests/integration/test_agent_streaming_integration.py +++ b/tests/integration/test_agent_streaming_integration.py @@ -36,9 +36,20 @@ Args: { }""" if streaming and chunk_callback: - # TEMPORARY: Send as single chunk to verify streaming path works - # TODO: Investigate why line-by-line chunking causes parser to extract empty action name - await chunk_callback(full_text) + # Send chunks that avoid parser state bug + # Parser bug: if "Args:" starts a new chunk while in ACTION state, + # it overwrites action_buffer with empty string (line_buffer[:0]) + # Solution: Keep "Action:" line and "Args:" together in same chunk + chunks = [ + "Thought: I need to search for information about machine learning.\n", + "Action: knowledge_query\nArgs: {\n", # Keep Action and Args together! + ' "question": "What is machine learning?"\n', + "}" + ] + + for chunk in chunks: + await chunk_callback(chunk) + return full_text else: # Non-streaming response - same text