[GH-ISSUE #96] bug: OpenAI-compatible streaming usage can end responses early #47

Closed
opened 2026-10-18 14:02:21 +00:00 by bsakaguchi · 4 comments
Owner

Originally created by @sandrogauci on GitHub (Jul 3, 2026).
Original GitHub issue: https://github.com/open-webui/computer/issues/96

Some OpenAI-compatible providers emit usage on every streaming chunk instead of only at the end.

chat_task treats a usage event as final when there are no pending tool calls, so the first usage event can save and end the assistant response before the content stream is finished.

Expected behavior: keep streaming content until the stream ends, then persist the final/latest usage payload.

Originally created by @sandrogauci on GitHub (Jul 3, 2026). Original GitHub issue: https://github.com/open-webui/computer/issues/96 Some OpenAI-compatible providers emit `usage` on every streaming chunk instead of only at the end. `chat_task` treats a `usage` event as final when there are no pending tool calls, so the first usage event can save and end the assistant response before the content stream is finished. Expected behavior: keep streaming content until the stream ends, then persist the final/latest usage payload.
Author
Owner

@owui-terminator[bot] commented on GitHub (Jul 3, 2026):

⚠️ Missing Issue Title Prefix

@sandrogauci, your issue title is missing a categorising prefix (e.g. bug:, feat:, docs:).

Please update the title to lead with one of:

  • bug: bug report or error
  • feat: feature request or enhancement
  • docs: documentation issue
  • question: usage question
  • help: support request

Example: bug: Login fails when the password contains special characters

<!-- gh-comment-id:4872566642 --> @owui-terminator[bot] commented on GitHub (Jul 3, 2026): # ⚠️ Missing Issue Title Prefix @sandrogauci, your issue title is missing a categorising prefix (e.g. `bug:`, `feat:`, `docs:`). Please update the title to lead with one of: - **bug**: bug report or error - **feat**: feature request or enhancement - **docs**: documentation issue - **question**: usage question - **help**: support request Example: `bug: Login fails when the password contains special characters`
Author
Owner

@sandrogauci commented on GitHub (Jul 3, 2026):

I have a fix ready on this branch:

https://github.com/sandrogauci/computer/tree/fix/openai-compatible-stream-usage

Compare:

https://github.com/open-webui/computer/compare/main...sandrogauci💻fix/openai-compatible-stream-usage

I tried opening a PR, but GitHub returned:

GraphQL: sandrogauci does not have the correct permissions to execute `CreatePullRequest` (createPullRequest)

Patch summary:

  • store the latest streaming usage payload in stream_openai_completions
  • emit one final usage event after the stream ends
  • keep reasoning completion before final usage

Commit: github.com/sandrogauci/computer@9bfd5426f1

<!-- gh-comment-id:4872567554 --> @sandrogauci commented on GitHub (Jul 3, 2026): I have a fix ready on this branch: https://github.com/sandrogauci/computer/tree/fix/openai-compatible-stream-usage Compare: https://github.com/open-webui/computer/compare/main...sandrogauci:computer:fix/openai-compatible-stream-usage I tried opening a PR, but GitHub returned: ```text GraphQL: sandrogauci does not have the correct permissions to execute `CreatePullRequest` (createPullRequest) ``` Patch summary: - store the latest streaming `usage` payload in `stream_openai_completions` - emit one final `usage` event after the stream ends - keep reasoning completion before final usage Commit: https://github.com/sandrogauci/computer/commit/9bfd5426f1f66dcc0e2fe3bf63ce401eb85f6781
Author
Owner

@tjbck commented on GitHub (Jul 6, 2026):

Should be addressed with the latest!

<!-- gh-comment-id:4897949777 --> @tjbck commented on GitHub (Jul 6, 2026): Should be addressed with the latest!
Author
Owner

@sandrogauci commented on GitHub (Jul 7, 2026):

excellent - thanks!

<!-- gh-comment-id:4901924056 --> @sandrogauci commented on GitHub (Jul 7, 2026): excellent - thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/computer#47
No description provided.