Skip to content

fix: pass agent summaries array instead of client object to createBuiltinAgents (#2386)#2478

Closed
code-yeongyu wants to merge 1 commit intodevfrom
fix/issue-2386-agent-summaries-type
Closed

fix: pass agent summaries array instead of client object to createBuiltinAgents (#2386)#2478
code-yeongyu wants to merge 1 commit intodevfrom
fix/issue-2386-agent-summaries-type

Conversation

@code-yeongyu
Copy link
Copy Markdown
Owner

@code-yeongyu code-yeongyu commented Mar 11, 2026

Summary

  • Load registered Claude Code, plugin, and config agents before builtin agent creation.
  • Pass merged registered agent summaries to createBuiltinAgents() so custom agents are injected into builtin orchestrator prompts.
  • Keep createBuiltinAgents() and parseRegisteredAgentSummaries() behavior unchanged.

Validation

  • bun run typecheck
  • bun test (fails in existing src/plugin-config.test.ts assertions unrelated to this change in this worktree)

Summary by cubic

Pass registered agent summaries to createBuiltinAgents and load them before builtin creation, so custom agents are correctly injected into builtin orchestrator prompts. Fixes missing Claude Code, plugin, and config agents when claude_code.agents is enabled.

  • Bug Fixes
    • Build registeredAgentSummaries from user, project, plugin, and config agents, and pass it to createBuiltinAgents (replaces params.ctx.client).
    • Load registered agents before builtin agent creation.
    • Normalize disabled agent names and migrate plugin agent configs where present.

Written for commit 943dd36. Summary will update on new commits.

@code-yeongyu
Copy link
Copy Markdown
Owner Author

Duplicate of #2424 which already passes CI

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Confidence score: 3/5

  • There is a concrete regression risk in src/plugin-handlers/agent-config-handler.ts: build and plan subagent configs are being passed as visible custom agents, which can pollute the orchestrator prompt behavior.
  • The issue is high-confidence (10/10) and meaningful severity (7/10), so this is more than a minor cleanup concern and could affect user-visible agent selection/prompt quality.
  • Pay close attention to src/plugin-handlers/agent-config-handler.ts - ensure subagent configs are filtered/mapped correctly so only intended custom agents are exposed.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/plugin-handlers/agent-config-handler.ts">

<violation number="1" location="src/plugin-handlers/agent-config-handler.ts:97">
P1: The "build" and "plan" subagent configs will be incorrectly passed as visible custom agents, polluting the orchestrator prompt.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

...pluginAgents,
...configAgent,
})
.filter((entry): entry is [string, Record<string, unknown>] => {
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: The "build" and "plan" subagent configs will be incorrectly passed as visible custom agents, polluting the orchestrator prompt.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/plugin-handlers/agent-config-handler.ts, line 97:

<comment>The "build" and "plan" subagent configs will be incorrectly passed as visible custom agents, polluting the orchestrator prompt.</comment>

<file context>
@@ -77,6 +77,31 @@ export async function applyAgentConfig(params: {
+    ...pluginAgents,
+    ...configAgent,
+  })
+    .filter((entry): entry is [string, Record<string, unknown>] => {
+      const registeredAgent = entry[1];
+      return typeof registeredAgent === "object" && registeredAgent !== null;
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant