From a253bd940bc6a58e14901cc68bb7993ae521df62 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 19 May 2026 06:19:25 +0000 Subject: [PATCH] tests(claude_code): raise MIN_STREAM_EVENTS floor for tool-use streaming A tool-use conversation is multi-turn (model emits tool_use, CLI executes the tool locally, sends the result back, model summarizes), so a fully buffered proxy can produce 4+ stream-json records and still slip past a '< 4' floor. Raise the floor to 8 (real fine-grained streaming emits 15+ events) and update the comment to reflect the multi-turn baseline so the streaming assertion actually catches buffered proxies on this row. Co-authored-by: Yassin Kortam --- .../tool_use_streaming/test_anthropic.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/claude_code/tool_use_streaming/test_anthropic.py b/tests/claude_code/tool_use_streaming/test_anthropic.py index f2a54ee6391..54c31a1686b 100644 --- a/tests/claude_code/tool_use_streaming/test_anthropic.py +++ b/tests/claude_code/tool_use_streaming/test_anthropic.py @@ -64,13 +64,17 @@ TOOL_USE_ARGS = [ ] # Floor on the number of stream-json records we expect to see for a -# tool-use turn. A buffered (non-streamed) wire collapses to one -# `system` init record + one `assistant` final + one `result`, total 3. -# Real fine-grained streaming produces many more (incremental -# input_json_delta events, intermediate assistant deltas, etc.). We -# pick a floor above the buffered case so the assertion catches the -# regression without being flaky on short responses. -MIN_STREAM_EVENTS = 4 +# 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: