mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 08:21:12 -05:00
[PR #16687] [CLOSED] fix: don't prematurely close regular reasoning blocks after tool calls #95246
Reference in New Issue
Block a user
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?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/16687
Author: @Ithanil
Created: 8/17/2025
Status: ❌ Closed
Base:
dev← Head:fix_reasoning_after_toolcall📝 Commits (1)
15cdddafix prematurely closed reasoning blocks after tool calls📊 Changes
1 file changed (+3 additions, -1 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+3 -1)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
2e36540023a3baf4a323d9b9a401a1689b8da012 introduced handling of tool calls inside reasoning blocks (fixing https://github.com/open-webui/open-webui/issues/16305 ), by prematurely closing reasoning blocks. However, the mechanism would also apply when subsequent reasoning blocks would follow regular tool calls (i.e. outside reasoning blocks), effectively leaving only the first token of the reasoning block inside the reasoning block and rendering the rest as regular text.
Example:

... more reasoning content would follow including the final
</think>tag, all rendered as regular text.The present PR makes sure the premature closure is only activated when there is delta_tool_call.
IMPORTANT: I have NO way to test if https://github.com/open-webui/open-webui/issues/16305 remains fixed! Please verify. What I can confirm is that the issue shown in the screenshot is fixed.
Fixed
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.