Skip to content

fix(responses): announce every reasoning run the bridge streams, not only the first - #45282

Closed
mateo-berri wants to merge 2 commits into
mainfrom
litellm_responses_bridge_reasoning_after_tool_call
Closed

mateo-berri wants to merge 2 commits into
mainfrom
litellm_responses_bridge_reasoning_after_tool_call

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • The Responses bridge announced only the first reasoning item of a stream
  • Reasoning after a tool call or after text streamed deltas at an index nobody announced, or into a reasoning item already closed
  • The OpenAI SDK 2.x responses.stream crashed with IndexError on that hole; SDK 3.x passed through deltas for an item it never saw added or closed
  • response.completed listed a reasoning item the stream never announced, or dropped the second run

How it solves it:

  • Reasoning is tracked per run, each run with its own item id and output index
  • A reasoning delta with no open run announces a new reasoning item first
  • Each run closes with its own done events, on the sync and the async stream alike
  • response.completed lists one reasoning item per run, signed thinking blocks split by the run that streamed them
  • Thinking blocks no run signed go to the first reasoning item

User Flow

Before: a developer streaming /v1/responses through the gateway to a provider that thinks again after a tool call (Claude with web search and reasoning here) gets reasoning deltas for an item the stream never announces or closes

  1. They call client.responses.stream(model="claude-sonnet-5-5", input=..., tools=[{"type": "web_search_preview"}], reasoning={"effort": "high"}) with the OpenAI Python SDK, which sends POST https://litellm-domain/v1/responses with "stream": true
  2. The stream returns response.created, then response.reasoning_summary_text.delta events at output_index 1 for a reasoning item rs_…, with no response.output_item.added for that item before them
  3. No response.reasoning_summary_text.done or response.output_item.done ever arrives for that item; the stream announces the message at output_index 2 and streams its text
  4. response.completed lists a reasoning item the stream never announced or closed, so an app that renders items as they are added shows the answer with no reasoning (a function tool call followed by reasoning does the same and crashes the OpenAI SDK 2.x with IndexError: list index out of range at the message; reasoning, a tool call, then reasoning again streams the second run's delta into the first reasoning item after it was closed, and response.completed lists one reasoning item for two runs)

After: the same request announces each reasoning item before its deltas, closes it, and completes with the items the stream announced

  1. They call client.responses.stream(model="claude-sonnet-5-5", input=..., tools=[{"type": "web_search_preview"}], reasoning={"effort": "high"}) with the OpenAI Python SDK, which sends POST https://litellm-domain/v1/responses with "stream": true
  2. The stream returns response.created, then response.output_item.added for a reasoning item at output_index 1, then its response.reasoning_summary_text.delta events carrying that item's id
  3. response.reasoning_summary_text.done and response.output_item.done close the reasoning item, then the stream announces the message at output_index 2 and streams its text
  4. response.completed lists the web search call, the reasoning item, and the message under the ids and indexes the stream announced, so the app shows the reasoning and the answer (a function tool call followed by reasoning streams and completes the same way, on SDK 2.x too; reasoning, a tool call, then reasoning again gives two reasoning items with distinct ids, each announced and closed on its own)

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Screenshots / Proof of Fix

Setup shared by both legs. One proxy per leg, booted with python litellm/proxy/proxy_cli.py --config config.yaml --port <random port> --num_workers 2 (2 uvicorn workers, Before at the merge base on port 52187, After at the tip on port 44277, run one after the other on the same machine). The client is the OpenAI Python SDK 3.26.0 (pip install openai today) driving client.responses.stream against http://127.0.0.1:<port>/v1. The bridge iterator only serves /v1/responses streaming, so that is the one endpoint under test. The live provider case is Anthropic claude-sonnet-5-5 with web_search_preview and reasoning.effort high, the only shape in which a real provider thinks again after a tool call inside one stream (costs real $$$). The three other cases go through the same gateway and client to a scripted chat-completions upstream that replays a fixed delta sequence (a deepseek/ alias, so the request takes the bridge), because no live provider thinks again after a client-side function tool call inside one stream; they are the shapes the new unit tests cover, seen from the client.

config.yaml:

model_list:
  - model_name: claude-sonnet-5-5
    litellm_params:
      model: anthropic/claude-sonnet-5-5
      api_key: os.environ/ANTHROPIC_API_KEY
  - model_name: tool-then-reasoning
    litellm_params:
      model: deepseek/tool-then-reasoning
      api_base: http://127.0.0.1:22312
      api_key: scripted
  - model_name: reasoning-tool-reasoning
    litellm_params:
      model: deepseek/reasoning-tool-reasoning
      api_base: http://127.0.0.1:22312
      api_key: scripted
  - model_name: text-then-reasoning
    litellm_params:
      model: deepseek/text-then-reasoning
      api_base: http://127.0.0.1:22312
      api_key: scripted
litellm_settings:
  drop_params: true

Scripted upstream deltas, in order per model: tool-then-reasoning sends a get_weather tool call, then reasoning_content, then text; reasoning-tool-reasoning sends reasoning_content, the tool call, reasoning_content again, then text; text-then-reasoning sends text, then reasoning_content, then text.

client_stream.py (TOOLS is one get_weather function tool taking a city string):

import json
import os
import sys
from typing import Final

from openai import OpenAI

PORT: Final = sys.argv[1]
MODEL: Final = sys.argv[2]
PROMPT: Final = sys.argv[3] if len(sys.argv) > 3 else "hello"
TOOLS: Final = json.loads(sys.argv[4]) if len(sys.argv) > 4 else None
EXTRA: Final = json.loads(sys.argv[5]) if len(sys.argv) > 5 else {}

client: Final = OpenAI(base_url=f"http://127.0.0.1:{PORT}/v1", api_key=os.environ["LITELLM_MASTER_KEY"])
kwargs: Final = {"model": MODEL, "input": PROMPT, **({"tools": TOOLS} if TOOLS else {}), **EXTRA}
with client.responses.stream(**kwargs) as stream:
    for event in stream:
        kind: Final = event.type
        if kind in ("response.output_item.added", "response.output_item.done"):
            print(f"{kind:40s} output_index={event.output_index} item={event.item.type} id={event.item.id}")
        elif kind in ("response.reasoning_summary_text.delta", "response.output_text.delta", "response.function_call_arguments.delta"):
            print(f"{kind:40s} output_index={event.output_index} item_id={event.item_id} delta={event.delta!r}")
        elif kind in ("response.reasoning_summary_text.done", "response.reasoning_summary_part.done"):
            print(f"{kind:40s} output_index={event.output_index} item_id={event.item_id}")
    final: Final = stream.get_final_response()
print("final output:", [(item.type, item.id) for item in final.output])

Before (03ba79d)

Claude web search, then reasoning (live Anthropic)

  1. python client_stream.py 52187 claude-sonnet-5-5 "Use web search once to find the current population of Iceland from a reliable source. After reading the result, reason step by step about how many years at 1% annual growth it would take to reach half a million, then answer in one sentence." '[{"type":"web_search_preview"}]' '{"reasoning":{"effort":"high"},"max_output_tokens":6000}'
  2. Observed (15 reasoning deltas at output_index 1 for rs_6ca9d47c… with no response.output_item.added before them and no reasoning_summary_text.done or output_item.done after; response.completed lists that reasoning item anyway):
response.reasoning_summary_text.delta    output_index=1 item_id=rs_6ca9d47c-724a-4ea3-ba92-ad163b57c694 x15, first delta='Using Statistics I'
response.output_item.added               output_index=2 item=message id=msg_d941fa96-3e8c-4f8b-bb8f-cc4c405997eb
response.output_text.delta               output_index=2 item_id=msg_d941fa96-3e8c-4f8b-bb8f-cc4c405997eb x64, first delta='Stat'
response.output_item.added               output_index=0 item=web_search_call id=ws_srvtoolu_014GGVCwYAjaXLbXDqWGnkds
response.output_item.done                output_index=0 item=web_search_call id=ws_srvtoolu_014GGVCwYAjaXLbXDqWGnkds
response.output_item.done                output_index=2 item=message id=msg_d941fa96-3e8c-4f8b-bb8f-cc4c405997eb
final output: [('web_search_call', 'ws_srvtoolu_014GGVCwYAjaXLbXDqWGnkds'), ('reasoning', 'rs_6ca9d47c-724a-4ea3-ba92-ad163b57c694'), ('message', 'msg_d941fa96-3e8c-4f8b-bb8f-cc4c405997eb')]

Function tool call, then reasoning (scripted upstream)

  1. python client_stream.py 52187 tool-then-reasoning "What is the weather in Reykjavik?" "$TOOLS" '{}'
  2. Observed (the reasoning delta at output_index 1 is never announced or closed; response.completed lists the reasoning item the stream never announced):
response.output_item.added               output_index=0 item=function_call id=fc_call_weather_1
response.function_call_arguments.delta   output_index=0 item_id=fc_call_weather_1 x2, first delta='{"city":"R'
response.reasoning_summary_text.delta    output_index=1 item_id=rs_9c8739e5-1288-4c79-a3f4-f200993dee8c delta='I called the weather tool; now I weigh the answer.'
response.output_item.added               output_index=2 item=message id=msg_c8553295-6c9d-4657-bfd4-2885fe22ba0c
response.output_text.delta               output_index=2 item_id=msg_c8553295-6c9d-4657-bfd4-2885fe22ba0c x2, first delta='Reykjavik is '
response.output_item.done                output_index=0 item=function_call id=fc_call_weather_1
response.output_item.done                output_index=2 item=message id=msg_c8553295-6c9d-4657-bfd4-2885fe22ba0c
final output: [('function_call', 'fc_call_weather_1'), ('reasoning', 'rs_9c8739e5-1288-4c79-a3f4-f200993dee8c'), ('message', 'msg_c8553295-6c9d-4657-bfd4-2885fe22ba0c')]

Reasoning, tool call, reasoning again (scripted upstream)

  1. python client_stream.py 52187 reasoning-tool-reasoning "What is the weather in Reykjavik?" "$TOOLS" '{}'
  2. Observed (the second reasoning run's delta lands in the first reasoning item (output_index 0, rs_18080366…) after that item was already closed, and response.completed lists one reasoning item for two runs):
response.output_item.added               output_index=0 item=reasoning id=rs_18080366-d0f0-4b8e-8b09-05484f4dc8c3
response.reasoning_summary_text.delta    output_index=0 item_id=rs_18080366-d0f0-4b8e-8b09-05484f4dc8c3 delta='First I decide which tool to call.'
response.reasoning_summary_text.done     output_index=0 item_id=rs_18080366-d0f0-4b8e-8b09-05484f4dc8c3
response.reasoning_summary_part.done     output_index=0 item_id=rs_18080366-d0f0-4b8e-8b09-05484f4dc8c3
response.output_item.done                output_index=0 item=reasoning id=rs_18080366-d0f0-4b8e-8b09-05484f4dc8c3
response.output_item.added               output_index=1 item=function_call id=fc_call_weather_1
response.function_call_arguments.delta   output_index=1 item_id=fc_call_weather_1 x2, first delta='{"city":"R'
response.reasoning_summary_text.delta    output_index=0 item_id=rs_18080366-d0f0-4b8e-8b09-05484f4dc8c3 delta='Now I think about what the tool will return.'
response.output_item.added               output_index=2 item=message id=msg_283b2b3a-3bfd-4048-8ac5-b2d8de98babb
response.output_text.delta               output_index=2 item_id=msg_283b2b3a-3bfd-4048-8ac5-b2d8de98babb delta='Checking the weather for you.'
response.output_item.done                output_index=1 item=function_call id=fc_call_weather_1
response.output_item.done                output_index=2 item=message id=msg_283b2b3a-3bfd-4048-8ac5-b2d8de98babb
final output: [('reasoning', 'rs_18080366-d0f0-4b8e-8b09-05484f4dc8c3'), ('function_call', 'fc_call_weather_1'), ('message', 'msg_283b2b3a-3bfd-4048-8ac5-b2d8de98babb')]

Text, then reasoning (scripted upstream)

  1. python client_stream.py 52187 text-then-reasoning "What is the weather in Reykjavik?" "$TOOLS" '{}'
  2. Observed (the reasoning delta at output_index 1 is never announced or closed; response.completed lists it):
response.output_item.added               output_index=0 item=message id=msg_4e47f634-ebae-497c-ac34-e1e9edcd71ba
response.output_text.delta               output_index=0 item_id=msg_4e47f634-ebae-497c-ac34-e1e9edcd71ba delta='Let me think. '
response.reasoning_summary_text.delta    output_index=1 item_id=rs_222a3676-404c-4e58-a89f-9b2ae71c0eec delta='Reasoning that arrives after visible text.'
response.output_text.delta               output_index=0 item_id=msg_4e47f634-ebae-497c-ac34-e1e9edcd71ba delta='Done.'
response.output_item.done                output_index=0 item=message id=msg_4e47f634-ebae-497c-ac34-e1e9edcd71ba
final output: [('message', 'msg_4e47f634-ebae-497c-ac34-e1e9edcd71ba'), ('reasoning', 'rs_222a3676-404c-4e58-a89f-9b2ae71c0eec')]

After (8daf874)

Claude web search, then reasoning (live Anthropic)

  1. python client_stream.py 44277 claude-sonnet-5-5 "Use web search once to find the current population of Iceland from a reliable source. After reading the result, reason step by step about how many years at 1% annual growth it would take to reach half a million, then answer in one sentence." '[{"type":"web_search_preview"}]' '{"reasoning":{"effort":"high"},"max_output_tokens":6000}'
  2. Observed (the reasoning item is announced at output_index 1 before its 36 deltas, closed with reasoning_summary_text.done and output_item.done, and response.completed lists the web search call, that reasoning item, and the message under the announced ids):
response.output_item.added               output_index=1 item=reasoning id=rs_33fd64ff-e32c-4a3e-b23d-a4360f222eb7
response.reasoning_summary_text.delta    output_index=1 item_id=rs_33fd64ff-e32c-4a3e-b23d-a4360f222eb7 x36, first delta='Population est'
response.reasoning_summary_text.done     output_index=1 item_id=rs_33fd64ff-e32c-4a3e-b23d-a4360f222eb7
response.reasoning_summary_part.done     output_index=1 item_id=rs_33fd64ff-e32c-4a3e-b23d-a4360f222eb7
response.output_item.done                output_index=1 item=reasoning id=rs_33fd64ff-e32c-4a3e-b23d-a4360f222eb7
response.output_item.added               output_index=2 item=message id=msg_6ae45076-6983-4c90-8484-86c20c3e970d
response.output_text.delta               output_index=2 item_id=msg_6ae45076-6983-4c90-8484-86c20c3e970d x62, first delta='**'
response.output_item.added               output_index=0 item=web_search_call id=ws_srvtoolu_015wPMyQGt95Keok28Spq1N1
response.output_item.done                output_index=0 item=web_search_call id=ws_srvtoolu_015wPMyQGt95Keok28Spq1N1
response.output_item.done                output_index=2 item=message id=msg_6ae45076-6983-4c90-8484-86c20c3e970d
final output: [('web_search_call', 'ws_srvtoolu_015wPMyQGt95Keok28Spq1N1'), ('reasoning', 'rs_33fd64ff-e32c-4a3e-b23d-a4360f222eb7'), ('message', 'msg_6ae45076-6983-4c90-8484-86c20c3e970d')]

Function tool call, then reasoning (scripted upstream)

  1. python client_stream.py 44277 tool-then-reasoning "What is the weather in Reykjavik?" "$TOOLS" '{}'
  2. Observed (the reasoning item is announced at output_index 1 before its delta and closed, and response.completed lists function call, reasoning, message under the announced ids):
response.output_item.added               output_index=0 item=function_call id=fc_call_weather_1
response.function_call_arguments.delta   output_index=0 item_id=fc_call_weather_1 x2, first delta='{"city":"R'
response.output_item.added               output_index=1 item=reasoning id=rs_c983bac9-97a1-4e4d-b668-bd365c351d92
response.reasoning_summary_text.delta    output_index=1 item_id=rs_c983bac9-97a1-4e4d-b668-bd365c351d92 delta='I called the weather tool; now I weigh the answer.'
response.reasoning_summary_text.done     output_index=1 item_id=rs_c983bac9-97a1-4e4d-b668-bd365c351d92
response.reasoning_summary_part.done     output_index=1 item_id=rs_c983bac9-97a1-4e4d-b668-bd365c351d92
response.output_item.done                output_index=1 item=reasoning id=rs_c983bac9-97a1-4e4d-b668-bd365c351d92
response.output_item.added               output_index=2 item=message id=msg_2d5ba782-0d7e-49b0-a111-5f8ec9b16f1f
response.output_text.delta               output_index=2 item_id=msg_2d5ba782-0d7e-49b0-a111-5f8ec9b16f1f x2, first delta='Reykjavik is '
response.output_item.done                output_index=0 item=function_call id=fc_call_weather_1
response.output_item.done                output_index=2 item=message id=msg_2d5ba782-0d7e-49b0-a111-5f8ec9b16f1f
final output: [('function_call', 'fc_call_weather_1'), ('reasoning', 'rs_c983bac9-97a1-4e4d-b668-bd365c351d92'), ('message', 'msg_2d5ba782-0d7e-49b0-a111-5f8ec9b16f1f')]

Reasoning, tool call, reasoning again (scripted upstream)

  1. python client_stream.py 44277 reasoning-tool-reasoning "What is the weather in Reykjavik?" "$TOOLS" '{}'
  2. Observed (two reasoning items with distinct ids at output_index 0 and 2, each announced before its delta and closed on its own, both listed by response.completed):
response.output_item.added               output_index=0 item=reasoning id=rs_22ef9163-1497-4195-92e4-dcffd7e97ba9
response.reasoning_summary_text.delta    output_index=0 item_id=rs_22ef9163-1497-4195-92e4-dcffd7e97ba9 delta='First I decide which tool to call.'
response.reasoning_summary_text.done     output_index=0 item_id=rs_22ef9163-1497-4195-92e4-dcffd7e97ba9
response.reasoning_summary_part.done     output_index=0 item_id=rs_22ef9163-1497-4195-92e4-dcffd7e97ba9
response.output_item.done                output_index=0 item=reasoning id=rs_22ef9163-1497-4195-92e4-dcffd7e97ba9
response.output_item.added               output_index=1 item=function_call id=fc_call_weather_1
response.function_call_arguments.delta   output_index=1 item_id=fc_call_weather_1 x2, first delta='{"city":"R'
response.output_item.added               output_index=2 item=reasoning id=rs_17bffa10-d607-46cb-8161-5c579398fbcf
response.reasoning_summary_text.delta    output_index=2 item_id=rs_17bffa10-d607-46cb-8161-5c579398fbcf delta='Now I think about what the tool will return.'
response.reasoning_summary_text.done     output_index=2 item_id=rs_17bffa10-d607-46cb-8161-5c579398fbcf
response.reasoning_summary_part.done     output_index=2 item_id=rs_17bffa10-d607-46cb-8161-5c579398fbcf
response.output_item.done                output_index=2 item=reasoning id=rs_17bffa10-d607-46cb-8161-5c579398fbcf
response.output_item.added               output_index=3 item=message id=msg_89552bcc-2baa-4b76-8e3e-d1205201ffe1
response.output_text.delta               output_index=3 item_id=msg_89552bcc-2baa-4b76-8e3e-d1205201ffe1 delta='Checking the weather for you.'
response.output_item.done                output_index=1 item=function_call id=fc_call_weather_1
response.output_item.done                output_index=3 item=message id=msg_89552bcc-2baa-4b76-8e3e-d1205201ffe1
final output: [('reasoning', 'rs_22ef9163-1497-4195-92e4-dcffd7e97ba9'), ('function_call', 'fc_call_weather_1'), ('reasoning', 'rs_17bffa10-d607-46cb-8161-5c579398fbcf'), ('message', 'msg_89552bcc-2baa-4b76-8e3e-d1205201ffe1')]

Text, then reasoning (scripted upstream)

  1. python client_stream.py 44277 text-then-reasoning "What is the weather in Reykjavik?" "$TOOLS" '{}'
  2. Observed (the reasoning item is announced at output_index 1 after the message, closed, and listed by response.completed):
response.output_item.added               output_index=0 item=message id=msg_9e5c7e0f-c38d-4417-b8de-a9d50edfe298
response.output_text.delta               output_index=0 item_id=msg_9e5c7e0f-c38d-4417-b8de-a9d50edfe298 delta='Let me think. '
response.output_item.added               output_index=1 item=reasoning id=rs_36db468c-4337-454f-8cc9-008b6944f0f3
response.reasoning_summary_text.delta    output_index=1 item_id=rs_36db468c-4337-454f-8cc9-008b6944f0f3 delta='Reasoning that arrives after visible text.'
response.reasoning_summary_text.done     output_index=1 item_id=rs_36db468c-4337-454f-8cc9-008b6944f0f3
response.reasoning_summary_part.done     output_index=1 item_id=rs_36db468c-4337-454f-8cc9-008b6944f0f3
response.output_item.done                output_index=1 item=reasoning id=rs_36db468c-4337-454f-8cc9-008b6944f0f3
response.output_text.delta               output_index=0 item_id=msg_9e5c7e0f-c38d-4417-b8de-a9d50edfe298 delta='Done.'
response.output_item.done                output_index=0 item=message id=msg_9e5c7e0f-c38d-4417-b8de-a9d50edfe298
final output: [('message', 'msg_9e5c7e0f-c38d-4417-b8de-a9d50edfe298'), ('reasoning', 'rs_36db468c-4337-454f-8cc9-008b6944f0f3')]

Observations from the run:

  • web_search_call item announced after the message; pre-existing, left alone
  • OpenAI SDK 2.33.0 crashes on that late item, reasoning or not
  • function_call done event arrives after later items; pre-existing, untouched
  • SDK 3.26.0 warns serializing reasoning items, both legs, out of scope

Type

🐛 Bug Fix

Caveats (if any)

Low

  • Open PR fix(responses): include encrypted_content in streamed reasoning done events #45044 edits the same reasoning done-event builder to add encrypted_content; whichever lands second rebases a few lines
  • The three new unit cases and the wire contract fail on main and pass here (IndexError in the SDK on main)
  • Hosted web search through the bridge still announces its web_search_call item after the message, which crashes the OpenAI SDK 2.x even with reasoning off; pre-existing, independent of this change, and tracked separately

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Note

Medium Risk
Changes event ordering and output shape for /v1/responses streaming (reasoning item lifecycle and response.completed output), which can affect OpenAI SDK clients but is covered by new contract tests.

Overview
Fixes the chat-completions → Responses API streaming bridge so each reasoning segment is a first-class output item instead of reusing a single global reasoning slot.

The iterator now tracks _ReasoningRun instances (own item_id, output_index, accumulated text, and signed thinking-block keys). Starting a new run queues response.output_item.added before any reasoning_summary_text.delta; ending a run (when non-reasoning output appears) emits the matching done events on both sync and async paths. response.completed is rebuilt to emit one reasoning item per run, with encrypted_content split across runs via encode_thinking_blocks / decode_thinking_blocks.

Adds integration and unit tests for reasoning after tool calls, multiple reasoning runs, and reasoning after visible text.

Reviewed by Cursor Bugbot for commit 8daf874. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Changes how reasoning runs are tracked during streaming responses.

The PR appears safe to merge, with both previous findings addressed and no new blocking issues

What we checked:

  • Closing reasoning still allows completion: Both iterator paths drain queued events before reading again. finished is set only after those events drain, and closing a run clears it so its done events are not repeated

Summary

This PR gives each reasoning run its own announced item, done events, and place in response.completed

  • The latest change also closes reasoning carried by the final chunk before completing the response
  • Both previous findings are addressed. No new actionable issues were found
  • The review checked code and test assertions; tests were not run

Reviews (2) · Last reviewed commit: "fix(responses): close a reasoning run th..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_responses_bridge_reasoning_after_tool_call (6255ac9) with main (fbbb54c)

Open in CodSpeed

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.92473% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...lm_completion_transformation/streaming_iterator.py 98.92% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 8daf874. Configure here.

… open

A chunk carrying both reasoning content and a finish_reason never counted as the end of the run, so the reasoning item was announced and listed by response.completed but never closed. The done path now closes any open run before the final events, and the test helper that checks announcements is a pure comprehension.
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor Author

Closing this one to re-open the same branch as a Devin-authored PR, which can be self-approved; link coming in a moment

@mateo-berri mateo-berri closed this Oct 8, 2026
@mateo-berri

Copy link
Copy Markdown
Contributor Author

Re-opened as #45300 (Devin-authored) so it can be self-approved; same branch and tip, the review history carries on there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant