From 6b6fc28e85636bc4d12b07fe589a4bd544142a3a Mon Sep 17 00:00:00 2001 From: ygd58 Date: Tue, 28 Apr 2026 07:23:07 +0200 Subject: [PATCH] fix(delegate): clear acp_command when override_provider is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When delegation.provider is configured (e.g. minimax-cn), subagents inherited the parent's acp_command unconditionally. This caused run_agent.py to initialize CopilotACPClient, which bypassed the override credentials entirely and used its own default model (provider=copilot-acp model=qwen3.5-397b-a17b) instead of the configured delegation.provider and delegation.model. Fix: when override_provider is set but override_acp_command is not, clear effective_acp_command and effective_acp_args so the child agent uses direct API calls with the configured provider credentials. The existing override_acp_command path is unchanged — explicit ACP transport overrides still force provider=copilot-acp as before. Fixes #16816 --- tools/delegate_tool.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/delegate_tool.py b/tools/delegate_tool.py index bceb9833c7..ff1306f0d0 100644 --- a/tools/delegate_tool.py +++ b/tools/delegate_tool.py @@ -994,6 +994,14 @@ def _build_child_agent( else (getattr(parent_agent, "acp_args", []) or []) ) + # When override_provider is set (e.g. delegation.provider: minimax-cn), + # the subagent must use direct API calls — not the parent's ACP transport. + # Inheriting acp_command unconditionally causes run_agent.py to initialize + # CopilotACPClient, bypassing override credentials entirely (issue #16816). + if override_provider and not override_acp_command: + effective_acp_command = None + effective_acp_args = [] + if override_acp_command: # If explicitly forcing an ACP transport override, the provider MUST be copilot-acp # so run_agent.py initializes the CopilotACPClient.