diff --git a/tests/claude_code/tool_use_streaming/test_azure.py b/tests/claude_code/tool_use_streaming/test_azure.py index d2a0d3d190f..da54d1ac93e 100644 --- a/tests/claude_code/tool_use_streaming/test_azure.py +++ b/tests/claude_code/tool_use_streaming/test_azure.py @@ -50,7 +50,18 @@ TOOL_USE_ARGS = [ "dontAsk", ] -MIN_STREAM_EVENTS = 4 +# Floor on the number of stream-json records we expect to see for a +# tool-use turn. A buffered (non-streamed) wire for this multi-turn +# flow collapses to roughly: one `system` init + one `assistant` with +# the `tool_use` block + a `user` tool_result + one `assistant` final +# text + one `result`, i.e. ~5 records (the CLI executes the tool +# locally and sends the result back, producing a second model turn +# even on a fully buffered proxy). Real fine-grained streaming +# produces many more (incremental input_json_delta events, +# intermediate assistant deltas, etc., typically 15+). We pick a +# floor comfortably above the buffered case so the assertion catches +# the regression without being flaky on short responses. +MIN_STREAM_EVENTS = 8 def _has_tool_use_event(events: Sequence[Mapping[str, Any]]) -> bool: diff --git a/tests/claude_code/tool_use_streaming/test_bedrock_converse.py b/tests/claude_code/tool_use_streaming/test_bedrock_converse.py index 1d943a57c80..ef80001e389 100644 --- a/tests/claude_code/tool_use_streaming/test_bedrock_converse.py +++ b/tests/claude_code/tool_use_streaming/test_bedrock_converse.py @@ -56,7 +56,18 @@ TOOL_USE_ARGS = [ "dontAsk", ] -MIN_STREAM_EVENTS = 4 +# Floor on the number of stream-json records we expect to see for a +# tool-use turn. A buffered (non-streamed) wire for this multi-turn +# flow collapses to roughly: one `system` init + one `assistant` with +# the `tool_use` block + a `user` tool_result + one `assistant` final +# text + one `result`, i.e. ~5 records (the CLI executes the tool +# locally and sends the result back, producing a second model turn +# even on a fully buffered proxy). Real fine-grained streaming +# produces many more (incremental input_json_delta events, +# intermediate assistant deltas, etc., typically 15+). We pick a +# floor comfortably above the buffered case so the assertion catches +# the regression without being flaky on short responses. +MIN_STREAM_EVENTS = 8 def _has_tool_use_event(events: Sequence[Mapping[str, Any]]) -> bool: diff --git a/tests/claude_code/tool_use_streaming/test_bedrock_invoke.py b/tests/claude_code/tool_use_streaming/test_bedrock_invoke.py index eb58373ed4b..fd42aa8f194 100644 --- a/tests/claude_code/tool_use_streaming/test_bedrock_invoke.py +++ b/tests/claude_code/tool_use_streaming/test_bedrock_invoke.py @@ -54,7 +54,18 @@ TOOL_USE_ARGS = [ "dontAsk", ] -MIN_STREAM_EVENTS = 4 +# Floor on the number of stream-json records we expect to see for a +# tool-use turn. A buffered (non-streamed) wire for this multi-turn +# flow collapses to roughly: one `system` init + one `assistant` with +# the `tool_use` block + a `user` tool_result + one `assistant` final +# text + one `result`, i.e. ~5 records (the CLI executes the tool +# locally and sends the result back, producing a second model turn +# even on a fully buffered proxy). Real fine-grained streaming +# produces many more (incremental input_json_delta events, +# intermediate assistant deltas, etc., typically 15+). We pick a +# floor comfortably above the buffered case so the assertion catches +# the regression without being flaky on short responses. +MIN_STREAM_EVENTS = 8 def _has_tool_use_event(events: Sequence[Mapping[str, Any]]) -> bool: diff --git a/tests/claude_code/tool_use_streaming/test_vertex_ai.py b/tests/claude_code/tool_use_streaming/test_vertex_ai.py index cd63851e86c..3f8d2265a96 100644 --- a/tests/claude_code/tool_use_streaming/test_vertex_ai.py +++ b/tests/claude_code/tool_use_streaming/test_vertex_ai.py @@ -53,7 +53,18 @@ TOOL_USE_ARGS = [ "dontAsk", ] -MIN_STREAM_EVENTS = 4 +# Floor on the number of stream-json records we expect to see for a +# tool-use turn. A buffered (non-streamed) wire for this multi-turn +# flow collapses to roughly: one `system` init + one `assistant` with +# the `tool_use` block + a `user` tool_result + one `assistant` final +# text + one `result`, i.e. ~5 records (the CLI executes the tool +# locally and sends the result back, producing a second model turn +# even on a fully buffered proxy). Real fine-grained streaming +# produces many more (incremental input_json_delta events, +# intermediate assistant deltas, etc., typically 15+). We pick a +# floor comfortably above the buffered case so the assertion catches +# the regression without being flaky on short responses. +MIN_STREAM_EVENTS = 8 def _has_tool_use_event(events: Sequence[Mapping[str, Any]]) -> bool: