From 0bfab91ec980e4453c110f5a99110b723d234572 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 22 May 2026 00:28:39 +0000 Subject: [PATCH] =?UTF-8?q?tests(claude=5Fcode):=20bugbot=20=E2=80=94=20ra?= =?UTF-8?q?ise=20MIN=5FSTREAM=5FEVENTS=20for=20tool-use=20streaming=20on?= =?UTF-8?q?=20remaining=204=20providers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per Bugbot, MIN_STREAM_EVENTS=4 is below the buffered-proxy baseline for tool-use streaming: even a buffered wire produces ~5 stream-json records (system + assistant w/ tool_use + user tool_result + assistant text + result), so the < 4 check would silently pass for a regression that collapses the upstream stream. Bring azure / bedrock_invoke / bedrock_converse / vertex_ai in line with test_anthropic.py (MIN=8, already raised in a253bd940b) so every provider catches the regression this row is designed to detect. Co-authored-by: Mateo Wang --- tests/claude_code/tool_use_streaming/test_azure.py | 13 ++++++++++++- .../tool_use_streaming/test_bedrock_converse.py | 13 ++++++++++++- .../tool_use_streaming/test_bedrock_invoke.py | 13 ++++++++++++- .../tool_use_streaming/test_vertex_ai.py | 13 ++++++++++++- 4 files changed, 48 insertions(+), 4 deletions(-) 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: