From 3b17ee9bd0b5fdc3a77bd6835237d4792fb9674f Mon Sep 17 00:00:00 2001 From: sisyphus-dev-ai Date: Thu, 25 Dec 2025 10:34:15 +0000 Subject: [PATCH] fix(sisyphus-agent): prevent duplicate build/plan agents when replacement enabled - Filter out original 'build' and 'plan' agents when Builder-Sisyphus/Planner-Sisyphus are enabled with replacement - Previously both agents could coexist even with replace_build/replace_plan: true - Now only the replacement agent exists when both enabled and replacement flags are true - Maintains backward compatibility for all configuration combinations Fixes #231 --- src/index.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 18d8be1..85b64ae 100644 --- a/src/index.ts +++ b/src/index.ts @@ -426,14 +426,25 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { : plannerSisyphusBase; } + // Filter out build/plan from config.agent if they will be replaced + const filteredConfigAgents = config.agent ? + Object.fromEntries( + Object.entries(config.agent).filter(([key]) => { + if (key === "build" && builderEnabled && replaceBuild) return false; + if (key === "plan" && plannerEnabled && replacePlan) return false; + return true; + }) + ) : {}; + config.agent = { ...agentConfig, ...Object.fromEntries(Object.entries(builtinAgents).filter(([k]) => k !== "Sisyphus")), ...userAgents, ...projectAgents, - ...config.agent, - ...(replaceBuild ? { build: { ...config.agent?.build, mode: "subagent" } } : {}), - ...(replacePlan ? { plan: { ...config.agent?.plan, mode: "subagent" } } : {}), + ...filteredConfigAgents, // Filtered config agents (excludes build/plan if replaced) + // Only set to subagent mode if NOT being replaced (for backward compatibility) + ...(replaceBuild && !builderEnabled ? { build: { ...config.agent?.build, mode: "subagent" } } : {}), + ...(replacePlan && !plannerEnabled ? { plan: { ...config.agent?.plan, mode: "subagent" } } : {}), }; } else { config.agent = {