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
This commit is contained in:
Classic298 2026-09-27 21:10:16 +02:00 • committed by GitHub
parent e26b2edaa4
commit 5d4f9b957e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(