From 5d4f9b957e7164c0e1bb7401176ca8d70a074a79 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sun, 27 Sep 2026 21:10:16 +0200 Subject: [PATCH] fix: foreground sub-agents cannot use personal tool servers like Open Terminal (#31424) With a personal tool server connection such as Open Terminal, the main model could call its tools but a foreground sub-agent it delegated to got none of them. Chats resuming after a tool approval lost those tools the same way. Setting up the tools for the main model emptied the list those later steps read from. It now works on a copy, so sub-agents and resumed chats get the same tools as the parent. Fixes #29893 --- backend/open_webui/utils/middleware.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 6378ad57b1..47231509b5 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -3039,6 +3039,8 @@ async def process_chat_payload(request, form_data, user, metadata, model): for tool_server in direct_tool_servers: if tool_server.get('is_terminal') is True and not terminal_capability: continue + # Copy so the pops below keep metadata intact for sub-agents and approval resumes + tool_server = dict(tool_server) system_prompt = tool_server.pop('system_prompt', None) if system_prompt: form_data['messages'] = add_or_update_system_message(