Skip to content

fix(clinepass): unwrap { data, success } envelope in non-streaming responses - #3387

Open
linhdmn wants to merge 1 commit into
decolua:masterfrom
linhdmn:fix/clinepass-nonstream-choices
Open

fix(clinepass): unwrap { data, success } envelope in non-streaming responses#3387
linhdmn wants to merge 1 commit into
decolua:masterfrom
linhdmn:fix/clinepass-nonstream-choices

Conversation

@linhdmn

@linhdmn linhdmn commented Aug 17, 2026

Copy link
Copy Markdown

Problem

api.cline.bot wraps non-streaming chat completions in { data: { ... }, success: true }:

{ data: { choices: [...], model: deepseek/deepseek-v4-flash, ... }, success: true }

The openai → openai non-stream path passes the upstream body through untranslated (translateNonStreamingResponse returns it as-is), so the router's JSON response has no top-level choices. Clients and the model test then fail with Provider returned no completion choices for this model.

Fix

In handleNonStreamingResponse, unwrap the data envelope when it actually contains choices. The guard only triggers when the top level has no choices but data.choices is an array, so plain OpenAI-shaped responses are untouched.

Verified

  • Live upstream: 200 with choices under data.choices; after unwrap, top-level choices present.
  • /api/v1/chat/completions (non-stream) now returns top-level choices.
  • Streaming path (SSE) unaffected — upstream emits plain OpenAI chunks there.

…sponses

api.cline.bot wraps non-streaming chat completions in { data: { ... }, success: true }.
The openai→openai non-stream path passed the raw body through, so the router's JSON
response had no top-level `choices` and model tests reported "Provider returned no
completion choices for this model". Unwrap the envelope when data.choices is present.
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