Skip to content

fix: custom agent is invisible#2392

Open
davincilll wants to merge 4 commits intocode-yeongyu:devfrom
davincilll:fix-1623
Open

fix: custom agent is invisible#2392
davincilll wants to merge 4 commits intocode-yeongyu:devfrom
davincilll:fix-1623

Conversation

@davincilll
Copy link

@davincilll davincilll commented Mar 8, 2026

Summary

  • Fixes the 8th parameter of createBuiltinAgents which was incorrectly passing ctx.client (client object) instead of the custom agent summaries (array format)
  • This bug caused custom agents registered in OpenCode to be invisible to orchestrator agents (Sisyphus/Atlas/Hephaestus)

Changes

In src/plugin-handlers/agent-config-handler.ts:

  • Convert params.config.agent to the correct customAgentSummaries array format before passing to createBuiltinAgents
  • The 8th parameter expects { name: string, description: string }[] but was receiving a client object
// Before (broken):
createBuiltinAgents(
  ...
  params.ctx.client,  // ❌ client object
  ...
)

// After (fixed):
const customAgentSummaries = Object.entries(params.pluginConfig.agents ?? {}).map(
  ([name, config]) => ({
    name,
    description: (config as { description?: string }).description ?? "",
  })
);
createBuiltinAgents(
  ...
  customAgentSummaries,  // ✅ array format
  ...
)

Testing

Define a custom agent in opencode.json or .opencode/agents/
Start OpenCode with oh-my-opencode plugin
Ask "What subagents do you support?" - custom agent should now appear in the response
The custom agent should now be visible in the orchestrator's delegation table

Related Issues

#1623

Related PR

#1652

…client

The 8th parameter of createBuiltinAgents expects custom agent summaries
(array format), but ctx.client (client object) was passed instead.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

@davincilll
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

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.

1 issue found across 1 file

Confidence score: 3/5

  • There is a concrete runtime risk in src/plugin-handlers/agent-config-handler.ts: accessing .description/.desc without a null/undefined guard can throw a TypeError when iterating params.config.agent entries.
  • Given the high severity/confidence signal (7/10, 9/10), this is user-impacting enough to put the PR in a moderate-risk bucket until a defensive check is added.
  • Pay close attention to src/plugin-handlers/agent-config-handler.ts - missing null-safe handling for agent config entries can crash the handler on malformed or partial input.
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:81">
P1: Missing null/undefined check on agent configuration before accessing `.description` may cause TypeError crash. When iterating over `params.config.agent`, if any agent entry has a null/undefined value, accessing `.description` throws `TypeError: Cannot read properties of null/undefined (reading 'description')` crashing the plugin handler.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

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

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
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.

1 issue found across 1 file (changes from recent commits).

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:86">
P0: Custom agent: **Opencode Compatibility**

The replacement introduces a syntax error due to duplicate closing brackets. The trailing `})` and `);` from the original code were not removed when adding `}));` to the map function.</violation>
</file>

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

@acamq
Copy link
Collaborator

acamq commented Mar 9, 2026

Thank you for your contributions! Please fix the authorship of the commit and resolve cubic comments, and I'll review.

@davincilll davincilll changed the title fix: custom agent cant invisible fix: custom agent is invisible Mar 9, 2026
@davincilll
Copy link
Author

recheck

- Removed unnecessary closing bracket and extra whitespace in the agent config handler
- Cleaned up the code formatting around createBuiltinAgents invocation
@acamq
Copy link
Collaborator

acamq commented Mar 9, 2026

@cubic-dev-ai

@cubic-dev-ai
Copy link

cubic-dev-ai bot commented Mar 9, 2026

@cubic-dev-ai

@acamq I have started the AI code review. It will take a few minutes to complete.

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.

1 issue found across 1 file

Confidence score: 2/5

  • There is a high-confidence, high-severity gap in src/plugin-handlers/agent-config-handler.ts: customAgentSummaries is populated with only OpenCode native config agents, so orchestrators may miss Claude Code and plugin agents.
  • Because this affects agent visibility/selection behavior (not just internal cleanup), it creates a concrete regression risk for user-facing orchestration flows.
  • Pay close attention to src/plugin-handlers/agent-config-handler.ts - customAgentSummaries likely needs to be built after all agent sources are loaded to avoid incomplete agent coverage.
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:81">
P1: `customAgentSummaries` only includes OpenCode native config agents, leaving orchestrators blind to Claude Code and plugin agents. The fix is incomplete - `customAgentSummaries` should be populated AFTER loading all agent sources (Claude Code via `loadUserAgents()`/`loadProjectAgents()` and plugin agents via `params.pluginComponents.agents`).</violation>
</file>

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

…oading

- Merge user, project, plugin, and config agents for unified summary generation
- Apply migration function to plugin agent configurations
- Add logs for custom agent summaries and parameters for debugging
- Remove redundant duplicate agent loading code block
- Improve maintainability by centralizing agent data assembly logic
@acamq
Copy link
Collaborator

acamq commented Mar 9, 2026

@cubic-dev-ai

@cubic-dev-ai
Copy link

cubic-dev-ai bot commented Mar 9, 2026

@cubic-dev-ai

@acamq I have started the AI code review. It will take a few minutes to complete.

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: Fixes a parameter mismatch by passing correctly formatted agent summaries instead of the client object to createBuiltinAgents. Code rearrangement is sound and safe.

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.

2 participants