From 6ee66123f22f96eb273fb4b247855bbe1d7ade89 Mon Sep 17 00:00:00 2001 From: xiaoen <2768753269@qq.com> Date: Wed, 15 Apr 2026 22:24:47 +0800 Subject: [PATCH] refactor(agent): simplify delegate registration gate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the IsToolEnabled("delegate") check — there is no "delegate" entry in ToolsConfig, so the check was always true. The only real gate is len(agents) > 1, which is the intended behavior: delegate is auto-registered in multi-agent setups. Ref: #2148 --- pkg/agent/loop.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index d31d2af45..c48c1041b 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -442,9 +442,10 @@ func registerSharedTools( } // Register delegate tool for multi-agent setups. - // Delegation uses the SubTurn mechanism directly (not SubagentManager), - // so it does not depend on the subagent tool being enabled. - if cfg.Tools.IsToolEnabled("delegate") && len(registry.ListAgentIDs()) > 1 { + // Auto-enabled when multiple agents exist. Delegation uses the SubTurn + // mechanism directly (not SubagentManager) and is independent of the + // subagent tool. + if len(registry.ListAgentIDs()) > 1 { delegateTool := tools.NewDelegateTool() delegateTool.SetSpawner(NewSubTurnSpawner(al)) currentAgentID := agentID