From 2d3f5c28d59de2b442efb70a66f0fae9ad7b18be Mon Sep 17 00:00:00 2001 From: g1nation Date: Wed, 6 May 2026 13:36:21 +0900 Subject: [PATCH] fix: agent selection bypasses multi-agent workflow to ensure selected agent system prompt is applied --- src/agent.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/agent.ts b/src/agent.ts index c2d8e9c..c190604 100644 --- a/src/agent.ts +++ b/src/agent.ts @@ -230,7 +230,10 @@ export class AgentExecutor { const runId = options.runId ?? (loopDepth === 0 ? ++this.runSerial : this.activeRunId); // Decide whether to use Multi-Agent Workflow as an internal execution strategy. - if (loopDepth === 0 && this.shouldUseMultiAgentWorkflow(prompt || '', multiAgentEnabled)) { + // [Critical Fix] 사용자가 에이전트를 명시적으로 선택한 경우, 해당 에이전트의 system prompt를 + // 최우선으로 적용해야 하므로 멀티에이전트 워크플로우 분기를 우회합니다. + const hasExplicitAgentSelection = !!options.agentSkillContext; + if (loopDepth === 0 && !hasExplicitAgentSelection && this.shouldUseMultiAgentWorkflow(prompt || '', multiAgentEnabled)) { return this.executeMultiAgentWorkflow(prompt!, modelName, options); }