fix(sisyphus-agent): fix plan/build agent demotion logic in subagent mode

Previously, the condition '&&plannerEnabled&&replacePlan' caused agents to be
completely removed instead of demoted to subagent mode. The logic incorrectly
prevented agents from being added back as subagents when Sisyphus is enabled
with default config.

Fixed by simplifying to just 'replacePlan' condition - agents are now properly
demoted to subagent mode when replacement is enabled, which is the intended
behavior per the README.

🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2025-12-25 21:10:12 +09:00
parent ebdce7972e
commit 0399c1f4ed

View File

@@ -422,12 +422,12 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
: plannerSisyphusBase; : plannerSisyphusBase;
} }
// Filter out build/plan from config.agent if they will be replaced // Filter out build/plan from config.agent - they'll be re-added as subagents if replaced
const filteredConfigAgents = config.agent ? const filteredConfigAgents = config.agent ?
Object.fromEntries( Object.fromEntries(
Object.entries(config.agent).filter(([key]) => { Object.entries(config.agent).filter(([key]) => {
if (key === "build" && builderEnabled && replaceBuild) return false; if (key === "build" && replaceBuild) return false;
if (key === "plan" && plannerEnabled && replacePlan) return false; if (key === "plan" && replacePlan) return false;
return true; return true;
}) })
) : {}; ) : {};
@@ -438,9 +438,9 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
...userAgents, ...userAgents,
...projectAgents, ...projectAgents,
...filteredConfigAgents, // Filtered config agents (excludes build/plan if replaced) ...filteredConfigAgents, // Filtered config agents (excludes build/plan if replaced)
// Only set to subagent mode if NOT being replaced (for backward compatibility) // Demote build/plan to subagent mode when replaced
...(replaceBuild && !builderEnabled ? { build: { ...config.agent?.build, mode: "subagent" } } : {}), ...(replaceBuild ? { build: { ...config.agent?.build, mode: "subagent" } } : {}),
...(replacePlan && !plannerEnabled ? { plan: { ...config.agent?.plan, mode: "subagent" } } : {}), ...(replacePlan ? { plan: { ...config.agent?.plan, mode: "subagent" } } : {}),
}; };
} else { } else {
config.agent = { config.agent = {