From b2bd5fe20fe486df7534267fe745d6d87b420729 Mon Sep 17 00:00:00 2001 From: BHAWESHBHASKAR Date: Fri, 30 Oct 2026 15:52:35 +0530 Subject: [PATCH 1/2] test: read the full event stream before asserting in the resubscription test test_task_resubscription broke out of the SSE read loop after the first chunk and then asserted that later artifact events were present. That only held when the first network read happened to contain every event, so the test failed on platforms where the first read returned a single event, for example on Windows. Read the stream to completion before asserting, matching the sibling test_message_send_stream. The behavior under test is unchanged. --- tests/server/test_integration.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/server/test_integration.py b/tests/server/test_integration.py index d46583ff9..3958ef335 100644 --- a/tests/server/test_integration.py +++ b/tests/server/test_integration.py @@ -677,15 +677,15 @@ async def stream_generator(): # Read some content to verify streaming works content = b'' event_count = 0 + # Read the whole stream before asserting. Breaking out after the + # first chunk made the test depend on how SSE events were packed + # into TCP reads: on platforms where the first read returned only + # the first event, the later artifact assertions failed. for chunk in response.iter_bytes(): content += chunk # A more robust check would be to parse each SSE event if b'data:' in chunk: # Naive check for SSE data lines event_count += 1 - if ( - event_count >= 1 and len(content) > 20 - ): # Ensure we've processed at least one event - break # Check content has event data (e.g., part of the first event) assert b'artifact-0' in content # Check for the actual JSON payload From 303aa4ec27aa519a75588b26549f82eca65a4c69 Mon Sep 17 00:00:00 2001 From: BHAWESHBHASKAR Date: Sat, 31 Oct 2026 12:38:09 +0530 Subject: [PATCH 2/2] test: drop the inaccurate comment in the resubscription test --- tests/server/test_integration.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/server/test_integration.py b/tests/server/test_integration.py index 3958ef335..c82fd6c99 100644 --- a/tests/server/test_integration.py +++ b/tests/server/test_integration.py @@ -677,10 +677,6 @@ async def stream_generator(): # Read some content to verify streaming works content = b'' event_count = 0 - # Read the whole stream before asserting. Breaking out after the - # first chunk made the test depend on how SSE events were packed - # into TCP reads: on platforms where the first read returned only - # the first event, the later artifact assertions failed. for chunk in response.iter_bytes(): content += chunk # A more robust check would be to parse each SSE event