litellm/litellm/responses
izzybn 65d87da578
fix(responses): replay tool calls a client answers in managed WebSocket history (#53410)
* fix(responses): replay tool calls a client answers in managed WebSocket history

The managed Responses WebSocket kept only messages and function calls when it stored a turn for previous_response_id replay, so a custom tool call (Codex code mode exec) was dropped and the provider rejected the next turn's custom_tool_call_output. Every output item carrying a call_id is now replayed.

* fix(responses): replay MCP approval requests in managed WebSocket history

A client answers an mcp_approval_request by its id rather than a call_id, so the
call_id rule dropped it and providers rejected the approval response on the next
turn. Also pins that items no later turn answers stay out of the replay.

* test(responses): pin replay of server tool search items that carry a call_id

* fix(responses): replay the MCP call that used an approval so the tool does not run again

* fix(responses): replay an MCP call only when the client sent its approval

* fix(responses): keep the session alive when a replayed output item has a non-string type or approval id

* fix(responses): replay a tool call cut off by an incomplete turn only when the next turn answers it

* fix(responses): keep a call and its output that both finished before an incomplete turn ended

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-22 22:23:30 +00:00
..
file_search refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
litellm_completion_transformation fix(router): make the constructor stub work for mypy and guard it in CI (#50354) 2026-11-22 21:25:00 +00:00
mcp refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
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
bridge_check.py feat(vertex_ai): add Meta Muse models on Vertex AI (#50768) 2026-11-21 13:00:24 -08:00
dispatch.py fix(rust): run native async calls through python's async wrapper steps (#50423) 2026-11-10 00:24:20 +00:00
input_items_query.py fix(proxy): forward limit, order, after, before and include on GET /v1/responses/{id}/input_items (#51259) 2026-11-20 07:54:26 -08:00
instructions_length.py fix(responses): send bridged system prompts too long for instructions as input (#52964) 2026-11-20 11:56:47 -08:00
main.py refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
retrieve_stream_query.py fix(responses): resume background response streams with stream and starting_after (#48819) 2026-10-29 02:31:22 -07:00
sse_output_recovery.py refactor(typing): clear 1181 basedpyright Any errors across 431 files (#47789) 2026-10-24 11:31:09 -07:00
streaming_iterator.py fix(responses): replay tool calls a client answers in managed WebSocket history (#53410) 2026-11-22 22:23:30 +00:00
utils.py fix(router): make the constructor stub work for mypy and guard it in CI (#50354) 2026-11-22 21:25:00 +00:00