mirror of
https://github.com/open-webui/computer.git
synced 2026-11-05 01:17:24 +00:00
[GH-ISSUE #193] bug: stream defaults to true, so non-streaming OpenAI-compatible clients receive SSE and fail #113
Labels
No labels
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/computer#113
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @penradioGables on GitHub (Jul 28, 2026).
Original GitHub issue: https://github.com/open-webui/computer/issues/193
Summary
ChatCompletionRequest.streamdefaults toTrueinrouters/gateway.py. The OpenAI API specifiesstreamas defaulting tofalsewhen the field is omitted, so any client that wants a single JSON response — and therefore omits the field — silently receives an event-stream instead, and fails to parse it.The agent itself answers correctly; only the transport framing is wrong.
Version: cptr 0.9.10, Python 3.12, SQLite backend. Reproduced against a running instance.
Root cause
routers/gateway.py:The dispatch below it is correct, and the non-streaming branch is fully implemented:
_collect()drains the queue, handlesdelta/output/done/errorevents, and returns a well-formedchat.completionobject. Theelse:branch appears correct — it is simply unreachable in practice, because real clients omitstreamrather than sendingfalseexplicitly.Reproduction
Behind a proxy the failure surfaces as a 500. Via LiteLLM:
The correct answer is visible inside that unparsed stream.
There is no client-side workaround
Setting
"stream": falseexplicitly does not help when a proxy sits in between. Verified against LiteLLM 1.95.0: an explicit"stream": falsein the client request still produces the same failure, because LiteLLM omits the field on the wire for non-streaming calls rather than forwardingfalse. The caller cannot reach theelse:branch at all.Suggested fix
This should be safe for existing consumers: Open WebUI sets
stream: trueexplicitly, so its behaviour is unchanged. Only clients that currently omit the field are affected, and those are the ones that are broken today.Secondary, in the same branch
The non-streaming response hardcodes token counts to zero:
This is currently invisible because the branch is unreachable. Once the default is corrected it becomes live, and any proxy or client doing token accounting off
usagewill record zeros for every non-streaming call. The streaming path already surfaces real counts.Happy to open a PR for the one-line change if that is useful.
@owui-terminator[bot] commented on GitHub (Jul 28, 2026):
🔍 Related Issues Found
I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions:
Related only at the broad component level: it also concerns OpenAI-compatible chat/completions behavior in the same codepath, but the bug is about premature termination on streaming
usageevents, not the defaultstreamparameter or SSE vs JSON framing.by sandrogauci
💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead.
This comment was generated automatically. React with 👍 if helpful, 👎 if not.
@tjbck commented on GitHub (Jul 31, 2026):
Should be addressed!