From 9a1a7b2e66fc51a58659f283dcacb912ec31371d Mon Sep 17 00:00:00 2001 From: jinwukong <134120444+jinwukong@users.noreply.github.com> Date: Fri, 11 Sep 2026 11:48:44 +0800 Subject: [PATCH] test(responses): cover reasoning events before response assembly --- .../test_streaming_iterator_transformation.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_litellm/responses/litellm_completion_transformation/test_streaming_iterator_transformation.py b/tests/test_litellm/responses/litellm_completion_transformation/test_streaming_iterator_transformation.py index 6007784a166..d343766c801 100644 --- a/tests/test_litellm/responses/litellm_completion_transformation/test_streaming_iterator_transformation.py +++ b/tests/test_litellm/responses/litellm_completion_transformation/test_streaming_iterator_transformation.py @@ -1245,3 +1245,21 @@ async def test_streamed_signature_only_thinking_is_replayable(asynchronous: bool ) tool_message: Final = next(message for message in messages if message.get("tool_calls")) assert tool_message["thinking_blocks"] == [block] + + +def test_reasoning_done_without_a_response_snapshot_preserves_summary() -> None: + iterator: Final = _build_iterator([]) + + event: Final = iterator.create_reasoning_output_item_done_event( + reasoning_item_id="rs_pending", + reasoning_content="The response snapshot is not available yet.", + sequence_number=7, + ) + + assert event.type == "response.output_item.done" + assert event.sequence_number == 7 + assert event.item.model_dump(exclude_none=True) == { + "id": "rs_pending", + "type": "reasoning", + "summary": [{"type": "summary_text", "text": "The response snapshot is not available yet."}], + }