fix(call_omo_agent): allow custom agents from user config#3318
fix(call_omo_agent): allow custom agents from user config#3318Hybirdss wants to merge 3 commits intocode-yeongyu:devfrom
Conversation
The ALLOWED_AGENTS array hardcoded 7 agents, rejecting any custom agent defined in oh-my-openagent.jsonc. Replace the static list with a dynamic union of AGENT_MODEL_REQUIREMENTS keys (built-in) and agentOverrides keys (user-configured). Fixes code-yeongyu#3229.
Without .catchall(), Zod strips unknown keys during config parsing, so custom agent names never reach call_omo_agent at runtime. Also surface user-provided description in the tool prompt.
|
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24cd86decb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const customAgentKeys = agentOverrides ? Object.keys(agentOverrides) : [] | ||
| const allowedAgents = [...new Set([...BUILTIN_AGENTS, ...customAgentKeys])] |
There was a problem hiding this comment.
Preserve custom agent casing before launching subagents
Now that allowedAgents includes raw agentOverrides keys, mixed-case names (for example OpenCode-Builder or any user-defined CamelCase key) pass validation, but execution still lowercases subagent_type before dispatch. That can turn a valid registered agent into an unknown one, which in sync mode returns agent-not-found and in background mode can trigger the background spawner’s fallback to general, so the task runs under the wrong agent.
Useful? React with 👍 / 👎.
| * Built-in agents derived from AGENT_MODEL_REQUIREMENTS. | ||
| * Custom agents from user config are merged at runtime in createCallOmoAgent(). | ||
| */ | ||
| export const BUILTIN_AGENTS = Object.keys(AGENT_MODEL_REQUIREMENTS) |
There was a problem hiding this comment.
Restrict builtin allowlist to actually registered agents
Deriving BUILTIN_AGENTS from AGENT_MODEL_REQUIREMENTS over-approximates callable agents and can admit names that are not registered in the active config (for example, prometheus is only added by applyAgentConfig when planner_enabled is true). In those cases call_omo_agent now validates the name but fails later at prompt time (or falls back to general in background execution), which is a behavior regression from the previous explicit allowlist.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
2 issues found across 6 files
Confidence score: 3/5
- There is a concrete user-impacting risk in
src/tools/call-omo-agent/tools.ts: lowercasing the matched agent name can cause mixed-case custom agents to be accepted initially but then fail when sent to the prompt/background API. src/tools/call-omo-agent/constants.tsintroduces a moderate consistency issue—the accepted agent list expanded, but the tool description still documents onlyexplore/librarian, which can mislead usage and testing.- Given the high confidence on the
tools.tsbehavior (7/10 severity, 9/10 confidence), this carries some regression risk and is worth fixing before merge if possible. - Pay close attention to
src/tools/call-omo-agent/tools.ts,src/tools/call-omo-agent/constants.ts- agent identifier casing and tool-description validity can drift and break expected agent calls.
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/tools/call-omo-agent/tools.ts">
<violation number="1" location="src/tools/call-omo-agent/tools.ts:114">
P1: Preserve the matched agent name instead of lowercasing it; mixed-case custom agents will be accepted here and then fail when the prompt/background API receives the wrong agent identifier.</violation>
</file>
<file name="src/tools/call-omo-agent/constants.ts">
<violation number="1" location="src/tools/call-omo-agent/constants.ts:7">
P2: This expands the accepted agent set, but the tool description still says only `explore`/`librarian` are valid.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Address Cubic/Codex review feedback: - Use find() instead of lowercase normalization so mixed-case custom agents (e.g. OpenCode-Builder) keep their registered casing - Update tool description to reflect dynamic agent list instead of hardcoded "explore or librarian only"
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cc7280c90
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const customAgentKeys = agentOverrides ? Object.keys(agentOverrides) : [] | ||
| const allowedAgents = [...new Set([...BUILTIN_AGENTS, ...customAgentKeys])] |
There was a problem hiding this comment.
Validate allowed agents against registered runtime agents
createCallOmoAgent now treats every key in agentOverrides as callable, but pluginConfig.agents is an override map, not a registration source, so keys can exist without a corresponding runtime agent (for example override-only names or plan when planner registration is disabled in applyAgentConfig). In those cases this validation passes and execution fails later (agent not found in sync mode) or falls back to general in background mode, so tasks can run under the wrong agent instead of failing fast.
Useful? React with 👍 / 👎.
Summary
call_omo_agentrejects custom agents registered inoh-my-openagent.jsoncbecauseALLOWED_AGENTSis hardcoded to 7 built-in namesAgentOverridesSchemastrips custom keys during Zod parsing (no.catchall())Changes
ALLOWED_AGENTSarray with dynamic union ofAGENT_MODEL_REQUIREMENTSkeys + useragentOverrideskeys (constants.ts,tools.ts).catchall(AgentOverrideConfigSchema.optional())toAgentOverridesSchemaso custom agent names survive config parsing (agent-overrides.ts)descriptionfield in tool prompt instead of generic templateTesting
Related Issues
Closes #3229
Summary by cubic
Enable custom agents from
oh-my-openagent.jsoncincall_omo_agent, fixing rejection of valid user-defined agents. Preserves agent casing and surfaces custom descriptions in the tool prompt (fixes #3229).AGENT_MODEL_REQUIREMENTS+ useragentOverrides(replacesALLOWED_AGENTS); update prompt to list these agents and include customdescription..catchall(...)toAgentOverridesSchemaso custom agent keys survive while validating entries.Written for commit 5cc7280. Summary will update on new commits.