mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #21940] [CLOSED] fix: add synthetic tool responses for orphaned tool calls #49400
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/21940
Author: @maxkuminov
Created: 2/27/2026
Status: ❌ Closed
Base:
main← Head:fix/orphaned-tool-calls📝 Commits (1)
959ff2bfix: add synthetic tool responses for orphaned tool calls📊 Changes
2 files changed (+123 additions, -0 deletions)
View changed files
➕
backend/open_webui/test/test_convert_output.py(+106 -0)📝
backend/open_webui/utils/misc.py(+17 -0)📄 Description
Summary
function_call_output,convert_output_to_messages()emits an assistant message withtool_callsand no followingtoolrole message. All providers (OpenAI, Azure, Google) reject this as invalid, returning "Provider returned error" for every subsequent message in that chat — permanently breaking the conversation.flush_pending()call, this PR checks if the last message is an assistant withtool_callsand appends synthetictoolrole messages so the conversation remains valid.Test plan
All tests in
backend/open_webui/test/test_convert_output.py.Fixes #14577, #12135, #18121, #9435
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.