tests(claude_code): raise MIN_STREAM_EVENTS floor for tool-use streaming
Some checks are pending
Unit Tests: Proxy DB Operations / schema-migration (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-utils (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Waiting to run
Unit Tests: Proxy DB Operations / auth-checks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / budgets (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / custom-logging (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / db-and-spend (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / key-generation (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / logging-misc (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-runtime (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-server-core (push) Blocked by required conditions
Unit Tests: Security / security (push) Waiting to run

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 <yassin@berri.ai>
This commit is contained in:
Cursor Agent 2026-05-19 06:19:25 +00:00
parent 5ad351bbd2
commit a253bd940b
No known key found for this signature in database

View file

@ -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: