From e8a3e549bb0380385e554b060e8e7724babe067c Mon Sep 17 00:00:00 2001 From: acamq <179265037+acamq@users.noreply.github.com> Date: Sun, 15 Mar 2026 17:30:57 -0600 Subject: [PATCH] fix(agents): include config agents and migrated plugin agents in customAgentSummaries PR #2424 fixed the critical bug (passing client object instead of agent summaries array), but only included user, project, and raw plugin agents. This adds the two missing sources: - OpenCode native config agents (params.config.agent) - Plugin agents with migrateAgentConfig applied before summary extraction Ensures Sisyphus has complete awareness of all registered agent sources. Closes #2386 Co-authored-by: NS Cola <123285105+davincilll@users.noreply.github.com> --- src/plugin-handlers/agent-config-handler.ts | 35 +++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/plugin-handlers/agent-config-handler.ts b/src/plugin-handlers/agent-config-handler.ts index 4f5ad9eaf..e078b0688 100644 --- a/src/plugin-handlers/agent-config-handler.ts +++ b/src/plugin-handlers/agent-config-handler.ts @@ -87,16 +87,28 @@ export async function applyAgentConfig(params: { const projectAgents = includeClaudeAgents ? loadProjectAgents(params.ctx.directory) : {}; const rawPluginAgents = params.pluginComponents.agents; + const pluginAgents = Object.fromEntries( + Object.entries(rawPluginAgents).map(([key, value]) => [ + key, + value ? migrateAgentConfig(value as Record) : value, + ]), + ); + + const configAgent = params.config.agent as AgentConfigRecord | undefined; + const customAgentSummaries = [ + ...Object.entries(configAgent ?? {}), ...Object.entries(userAgents), ...Object.entries(projectAgents), - ...Object.entries(rawPluginAgents).filter(([, config]) => config !== undefined), - ].map(([name, config]) => ({ - name, - description: typeof (config as Record)?.description === "string" - ? (config as Record).description as string - : "", - })); + ...Object.entries(pluginAgents).filter(([, config]) => config !== undefined), + ] + .filter(([, config]) => config != null) + .map(([name, config]) => ({ + name, + description: typeof (config as Record)?.description === "string" + ? ((config as Record).description as string) + : "", + })); const builtinAgents = await createBuiltinAgents( migratedDisabledAgents, @@ -114,13 +126,6 @@ export async function applyAgentConfig(params: { disableOmoEnv, ); - const pluginAgents = Object.fromEntries( - Object.entries(rawPluginAgents).map(([key, value]) => [ - key, - value ? migrateAgentConfig(value as Record) : value, - ]), - ); - const disabledAgentNames = new Set( (migratedDisabledAgents ?? []).map(a => a.toLowerCase()) ); @@ -138,8 +143,6 @@ export async function applyAgentConfig(params: { const shouldDemotePlan = plannerEnabled && replacePlan; const configuredDefaultAgent = getConfiguredDefaultAgent(params.config); - const configAgent = params.config.agent as AgentConfigRecord | undefined; - if (isSisyphusEnabled && builtinAgents.sisyphus) { if (configuredDefaultAgent) { (params.config as { default_agent?: string }).default_agent =