Skip to content

fix(responses): backport #46099 and #46109 to stable/1.103.x for v1.103.5 - #46949

Merged
mrinal-berri merged 5 commits into
stable/1.103.xfrom
litellm_backport_responses_bridge_stable_1_103_x
Oct 17, 2026
Merged

mrinal-berri merged 5 commits into
stable/1.103.xfrom
litellm_backport_responses_bridge_stable_1_103_x

Conversation

@mrinal-berri

@mrinal-berri mrinal-berri commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

p0-regression: LIT-9197

TLDR

Problem this solves:

How it solves it:

  • Fold every message, citation, reasoning item and tool call into choices[0]
  • Number bridged tool calls 0, 1 like native chat completions
  • Bump litellm to 1.103.5, one patch above v1.103.4

User Flow

Before: an agent built on a choices[0]-only client never calls its weather tool

  1. They send POST https://litellm-domain/v1/chat/completions with model: azure/gpt-5.4-mini, a get_weather tool and no reasoning_effort
  2. The model answers with two short progress messages and then the get_weather call
  3. The response has two choices, choices[0] is plain text with finish_reason: stop and the tool call sits on choices[1]
  4. Their agent reads choices[0], sees plain text, and replies to the user without running the tool

After: the same request returns one choice that carries the text and the tool call

  1. They send the same POST https://litellm-domain/v1/chat/completions
  2. The model answers with the same two messages and the get_weather call
  3. The response has one choice, choices[0] holds both messages' text and the tool call with finish_reason: tool_calls
  4. Their agent runs the tool. With two tools the calls come back as index 0 and 1

Relevant issues

Backport of #46099 and #46109, reported by a customer (Pylon #9888)

Affected release

Regression in v1.97.0

Linear ticket

Resolves LIT-9197

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally
  • My PR passes all required CI/CD checks
  • 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

Backport details

The two picks keep their original authors and name the main commit they came from. The fix code matches main line for line, with two exceptions. A TypeVar line that sat next to the upstream hunk is left out because the line never uses it and has no TypeVar import. from itertools import accumulate, chain is added because main already has it and the line did not

The unit tests go into the line's existing files under tests/test_litellm/ and only the two PRs' own tests are carried. #46109's black-only reformat of older tests is not. test_responses_bridge_incomplete.py is new on this line and holds only these PRs' 8 integration tests, so its 7 older tests from main stay behind. Those tests import list_value, which is hand-ported from main (#43981) as its own commit

The line's integration conftest refuses any test missing from tests/integration/contracts.json, so a separate commit gives the 8 tests covers marks and manifest entries. Main has no manifest. The version bump is the last commit and touches only pyproject.toml and uv.lock. enterprise/ and litellm-proxy-extras/ are unchanged, so no subpackage needs a bump

A grype sweep of the line's uv.lock found nothing to bump. mlflow clears with a lock-only bump, but it ships only in the optional mlflow extra that the Docker image does not install. diskcache has no fixed release, and main is on the same version

Local checks were the following. The two affected unit test folders pass, 438 tests. A wider run that also covers the OpenAI responses guardrail handler passes 575. With the source reverted, 5 of the 6 new unit tests fail. The 6th is the index 0 case, which already worked. The integration providers group collects all 25 tests. A scan for module-level names the picks remove found none, so nothing on the line loses an import

Gauntlet-mini: SURVIVED, 5/5 lenses, 1 confirmed (all fixed), reviewed 34996a0, bump 6ed7a3d. The confirmed finding was the missing contracts.json entries, which broke collection of the whole providers group. The strongest dissent was rejected. It said citation offsets shift by Python code points rather than UTF-16 units, but that matches how the provider produces them. The added docstring on the fold helper was also flagged and rejected, because it is upstream's text and the backport stays identical to main

Screenshots / Proof of Fix

Not captured yet. A live before and after run against a proxy on stable/1.103.x with a real gpt-5.4 deployment is still to do

Type

🐛 Bug Fix

Caveats (if any)

Medium

  • No live proxy proof yet, see Proof of Fix
  • The 8 new integration tests collect but were not run here

Low

  • Callers reading choices[1] from bridged replies now get one folded choice
  • Inherited rust-wheel red, same 4 failures on the line tip (run 37675147208)

devin-ai-integration Bot and others added 5 commits October 16, 2026 13:33
Prerequisite for the backport of #46099 to stable/1.103.x: its integration
tests import list_value, which reached main in #43981.
Hand-ported from 43f07d0 (main).
…46099)

Backport of #46099 to stable/1.103.x.
Cherry-picked from 4b7b8ef (main).
Adapted to the line: unit test lives under tests/test_litellm/, and only this
PR's own tests are carried into the integration file.
…ning bridge shapes (#46109)

Backport of #46109 to stable/1.103.x.
Cherry-picked from b6df3d7 (main).
Adapted to the line: unit tests live under tests/test_litellm/, and the
black-only reformat of the existing completion-responses tests is not carried.
…able/1.103.x

The line's integration conftest refuses any owned test missing from
contracts.json, so the backported #46099 and #46109 tests get covers marks
and manifest entries here; main has no manifest.
@mrinal-berri
mrinal-berri requested a review from a team October 16, 2026 18:45
@greptile-apps

greptile-apps Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are disabled for this repository.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ mrinal-berri
❌ devin-ai-integration[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

@mrinal-berri
mrinal-berri merged commit dec1691 into stable/1.103.x Oct 17, 2026
10 of 11 checks passed
@mrinal-berri
mrinal-berri deleted the litellm_backport_responses_bridge_stable_1_103_x branch October 17, 2026 01:50
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.

3 participants