From 35dda256f06d3957f4c555cd6ad2bc58aac7e046 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sun, 27 Sep 2026 21:14:30 +0200 Subject: [PATCH] fix: approve every tool call from a multi-call turn in ask mode (#31315) In "Ask for approval" mode, when the model requested several tools in one turn, only the first call got an approval card. The others stayed on "Executing..." forever, never ran, could not be approved (the server answered "already resolved"), and the model was called again without their results. The stuck state was saved to the chat. Once streaming finishes, every call in the turn is marked as completed (arguments done, nothing run yet). The approval pause only queued siblings that were still in progress, so these were skipped. They are now queued as well, and each one gets its own approval card in turn after the previous one is resolved. Calls that already have a result and rejected calls are untouched, and single-call turns behave as before. Verified against the real approval functions with same-name, mixed-name, reject and ask_user batches, plus the tests-repo unit suite (identical results before and after). Fixes #29293 --- backend/open_webui/utils/middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 47231509b5..be4fa816ec 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -3605,7 +3605,7 @@ async def pause_for_tool_approval(chat_id: str, message_id: str, output: list[di if not has_pending_approval: item['status'] = 'pending' has_pending_approval = True - elif item.get('status') == 'in_progress': + elif item.get('status') in {'in_progress', 'completed'}: item['status'] = 'queued' await Chats.upsert_message_to_chat_by_id_and_message_id(