Skip to content

fix(agents): pass custom agent summaries instead of client object to createBuiltinAgents#2424

Open
MoerAI wants to merge 1 commit intocode-yeongyu:devfrom
MoerAI:fix/issue-2386-custom-agent-summaries
Open

fix(agents): pass custom agent summaries instead of client object to createBuiltinAgents#2424
MoerAI wants to merge 1 commit intocode-yeongyu:devfrom
MoerAI:fix/issue-2386-custom-agent-summaries

Conversation

@MoerAI
Copy link
Contributor

@MoerAI MoerAI commented Mar 10, 2026

Summary

Fixes #2386

Plugin agents (from OpenCode plugins) and user-installed agents (~/.claude/agents/*.md) are not injected into the Sisyphus system prompt. This is because createBuiltinAgents() receives params.ctx.client (an OpenCode SDK client object) as its 8th parameter (customAgentSummaries) instead of the expected array of agent summaries.

parseRegisteredAgentSummaries() checks Array.isArray(input), gets false for the client object, and silently returns []. Result: Sisyphus has zero awareness of any non-builtin agents.

Root Cause

In agent-config-handler.ts, user/project/plugin agents were loaded after createBuiltinAgents() was called, so the summaries weren't available. The client object was passed as a placeholder that never worked.

Changes

  • src/plugin-handlers/agent-config-handler.ts:
    1. Move user agent, project agent, and plugin agent loading before createBuiltinAgents()
    2. Build a proper customAgentSummaries array with { name, description } from all non-builtin agents
    3. Pass the summaries array as the 8th parameter instead of params.ctx.client
    4. Keep plugin agent migration (migrateAgentConfig) in its original position since it's only needed for the final agent merge

Impact

  • Sisyphus now discovers and can intelligently route to all registered agents (user, project, plugin)
  • task(subagent_type="some-plugin-agent") works without the agent needing to guess the exact name
  • No behavioral change for users who don't have custom agents

Summary by cubic

Fixes agent discovery by loading user, project, and plugin agents before createBuiltinAgents and passing real customAgentSummaries, so Sisyphus includes all non-builtin agents in its system prompt. Enables correct routing to custom agents without changing behavior for users without them.

  • Bug Fixes
    • Load user/project/plugin agents before calling createBuiltinAgents.
    • Build and pass customAgentSummaries: { name, description }[] instead of params.ctx.client.
    • Keep migrateAgentConfig position unchanged for the final merge.

Written for commit 46c3bfc. Summary will update on new commits.

Copy link

@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.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Corrects a type mismatch where a client object was passed instead of an array. Moving agent loading logic earlier is safe and necessary for the fix.

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.

[Bug]: Plugin/user agents not injected into Sisyphus system prompt (customAgentSummaries type mismatch)

1 participant