Skip to content

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

Merged
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
MoerAI:fix/issue-2386-custom-agent-summaries
Mar 11, 2026
Merged

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

Conversation

@MoerAI
Copy link
Copy Markdown
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
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.

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.

@code-yeongyu code-yeongyu merged commit 994b9a7 into code-yeongyu:dev Mar 11, 2026
8 checks passed
acamq added a commit to acamq/oh-my-opencode that referenced this pull request Mar 15, 2026
…omAgentSummaries

PR code-yeongyu#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 code-yeongyu#2386

Co-authored-by: NS Cola <[email protected]>
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)

2 participants