fix: custom agent is invisible#2392
Conversation
…client The 8th parameter of createBuiltinAgents expects custom agent summaries (array format), but ctx.client (client object) was passed instead.
|
All contributors have signed the CLA. Thank you! ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
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/.descwithout a null/undefined guard can throw a TypeError when iteratingparams.config.agententries. - 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-aiwith guidance or docs links (includingllms.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>
There was a problem hiding this comment.
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.
|
Thank you for your contributions! Please fix the authorship of the commit and resolve cubic comments, and I'll review. |
|
recheck |
- Removed unnecessary closing bracket and extra whitespace in the agent config handler - Cleaned up the code formatting around createBuiltinAgents invocation
|
@acamq I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
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:customAgentSummariesis 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-customAgentSummarieslikely 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 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
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.
|
Closing in favor of #2585, which applies this PR's key insight (including |
Summary
createBuiltinAgentswhich was incorrectly passingctx.client(client object) instead of the custom agent summaries (array format)Changes
In
src/plugin-handlers/agent-config-handler.ts:params.config.agentto the correctcustomAgentSummariesarray format before passing tocreateBuiltinAgents{ name: string, description: string }[]but was receiving a client objectTesting
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