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:
12
src/index.ts
12
src/index.ts
@@ -422,12 +422,12 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
: 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 ?
|
||||
Object.fromEntries(
|
||||
Object.entries(config.agent).filter(([key]) => {
|
||||
if (key === "build" && builderEnabled && replaceBuild) return false;
|
||||
if (key === "plan" && plannerEnabled && replacePlan) return false;
|
||||
if (key === "build" && replaceBuild) return false;
|
||||
if (key === "plan" && replacePlan) return false;
|
||||
return true;
|
||||
})
|
||||
) : {};
|
||||
@@ -438,9 +438,9 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
...userAgents,
|
||||
...projectAgents,
|
||||
...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" } } : {}),
|
||||
// Demote build/plan to subagent mode when replaced
|
||||
...(replaceBuild ? { build: { ...config.agent?.build, mode: "subagent" } } : {}),
|
||||
...(replacePlan ? { plan: { ...config.agent?.plan, mode: "subagent" } } : {}),
|
||||
};
|
||||
} else {
|
||||
config.agent = {
|
||||
|
||||
Reference in New Issue
Block a user