Skip to content

fix(headroom): drop stream options after CCR conversion - #40075

Closed
qdivan wants to merge 3 commits into
BerriAI:mainfrom
qdivan:litellm_fix_headroom_stream_options
Closed

qdivan wants to merge 3 commits into
BerriAI:mainfrom
qdivan:litellm_fix_headroom_stream_options

Conversation

@qdivan

@qdivan qdivan commented Sep 7, 2026

Copy link
Copy Markdown

TLDR

Problem this solves:

  • CCR changes streaming calls to non-streaming upstream requests
  • DeepSeek rejects stream_options when stream is false

How it solves it:

  • Remove stream_options only during the CCR stream conversion
  • Preserve stream options when the request remains streaming

User Flow

Before: a developer streams a chat completion through the proxy and receives a 400 response when CCR retrieval runs

  1. They send POST https://litellm-domain/v1/chat/completions with "stream": true and "stream_options": {"include_usage": true}
  2. CCR retrieval runs for the long request history
  3. The upstream provider returns 400 stating stream_options should be set along with stream = true

After: the same developer receives the streamed completion when CCR retrieval runs

  1. They send POST https://litellm-domain/v1/chat/completions with "stream": true and "stream_options": {"include_usage": true}
  2. CCR retrieval runs for the long request history
  3. The upstream request is valid and the proxy returns the completion stream

Relevant issues

Fixes #40068

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • The focused Headroom guardrail tests pass locally
  • make lint passes locally
  • 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

Screenshots / Proof of Fix

Live provider proof was not run because this environment has no Headroom or DeepSeek credentials. The draft includes provider-free regression coverage for both the conversion and unchanged streaming paths

Type

🐛 Bug Fix

Caveats (if any)

Low

  • Live provider confirmation remains for a credentialed environment

Final Attestation

  • The regression tests cover conversion and unchanged streaming controls

@codspeed

codspeed Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing qdivan:litellm_fix_headroom_stream_options (8ecd31d) with litellm_internal_staging (02522a5)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (168a005) during the generation of this report, so 02522a5 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yuneng-berri
yuneng-berri deleted the branch BerriAI:main September 13, 2026 04:50
@yuneng-berri yuneng-berri reopened this Sep 13, 2026
@devin-ai-integration
devin-ai-integration Bot changed the base branch from litellm_internal_staging to main September 23, 2026 14:41
@CLAassistant

CLAassistant commented Nov 5, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@mateo-berri

Copy link
Copy Markdown
Contributor

This is covered by #45433, which drops stream options during conversion. Please reopen if this still happens or anything is missing

@mateo-berri mateo-berri closed this Nov 9, 2026
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.

[Bug]: Headroom CCR streaming conversion leaves stream_options in the upstream request after setting stream=false (DeepSeek 400)

4 participants