litellm/tests/unit/responses
Rick 047b4f9a9a
fix(responses): preserve incomplete status in synthetic streams (#52489)
* fix(responses): preserve incomplete status in synthetic streams

Emit response.incomplete when a synthetic stream replays a truncated
response, and finalize both terminal event types in the mock and cached
iterators so usage and success callbacks still run. Incomplete responses
stay out of the response cache.

Co-Authored-By: AaronHowell <111272993+AaronHowell@users.noreply.github.com>

* fix(responses): read response.incomplete where streams end cut off

A replayed Responses stream now ends a cut-off answer with
response.incomplete, so every reader that only knew response.completed
has to accept it too. The Admin UI chat, litellm.harness usage, Langfuse
OTEL output, guardrail-blocked usage and the WebSocket Presidio unmask now
read both events

A replayed cut-off answer is still written to the response cache, as it
was before the terminal event changed. Provider streams still skip it

* fix(responses): mask a cut-off WebSocket answer and test the BigModel JSON replay

The WebSocket output mask only read response.completed, so a cut-off answer
reached the client with Presidio-restored or model-written PII unmasked. It
now reads both terminal events. The output-mask test runs for both terminal
types, and a new BigModel test replays one JSON answer through
litellm.responses and aresponses for a finished and a cut-off body

* fix(interactions): report a cut-off streamed answer as incomplete

The Interactions bridge only read response.completed, so a stream that ends
with response.incomplete closed through the end-of-stream fallback with status
completed. It now reads both terminal events and passes the status on, which
matches what the same request returns without stream

---------

Co-authored-by: AaronHowell <111272993+AaronHowell@users.noreply.github.com>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-19 22:24:50 -08:00
..
litellm_completion_transformation fix(responses): preserve deferred tool references on Anthropic routes (#52977) 2026-11-19 15:55:31 -08:00
mcp feat(model_armor): scan MCP tool results on post_mcp_call (#51887) 2026-11-18 12:17:47 -08:00
__init__.py
test_additional_tools.py feat(proxy): mixed Codex model picker and LiteLLM routing on native codex routes (#49408) 2026-11-06 11:14:47 -08:00
test_custom_tool_call.py
test_metadata_codex_callback.py
test_no_duplicate_spend_logs.py
test_null_test_fix.py
test_responses_api_bridge_flag.py fix(tool_choice): accept the Responses API's flat allowed_tools layout on chat completions (#50467) 2026-11-10 13:04:06 -08:00
test_responses_api_lifecycle.py fix(responses): log the resolved provider on Responses API calls (#52622) 2026-11-18 22:34:16 +00:00
test_responses_api_request_body.py fix(responses): log the resolved provider on Responses API calls (#52622) 2026-11-18 22:34:16 +00:00
test_responses_prompt_management.py fix(sdk): decide MCP gateway routing without importing the proxy handler (#45961) 2026-10-20 01:44:54 +00:00
test_responses_router_cooldown.py refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
test_responses_streaming_iterator.py fix(responses): resume background response streams with stream and starting_after (#48819) 2026-10-29 02:31:22 -07:00
test_responses_supported_endpoints_passthrough.py
test_responses_utils.py fix(responses): accept a string or tuple allowed_openai_params on Responses models instead of answering 500 (#51751) 2026-11-14 04:32:38 -05:00
test_responses_websocket_all_providers.py fix(responses): preserve incomplete status in synthetic streams (#52489) 2026-11-19 22:24:50 -08:00
test_rust_bridge_websocket.py refactor(rust-bridge): require the native extension (#48852) 2026-10-28 13:16:56 -07:00
test_sse_output_recovery.py
test_streaming_iterator.py fix(responses): preserve incomplete status in synthetic streams (#52489) 2026-11-19 22:24:50 -08:00
test_streaming_iterator_error_events.py fix(responses): surface mid-stream upstream errors that arrive without an event type (#50466) 2026-11-07 14:53:07 -08:00
test_text_format_conversion.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00