Skip to content

fix(call_omo_agent): allow custom agents from user config#3318

Open
Hybirdss wants to merge 3 commits intocode-yeongyu:devfrom
Hybirdss:fix/issue-3229-allow-custom-agents-in-call-omo-agent
Open

fix(call_omo_agent): allow custom agents from user config#3318
Hybirdss wants to merge 3 commits intocode-yeongyu:devfrom
Hybirdss:fix/issue-3229-allow-custom-agents-in-call-omo-agent

Conversation

@Hybirdss
Copy link
Copy Markdown

@Hybirdss Hybirdss commented Apr 10, 2026

Summary

  • call_omo_agent rejects custom agents registered in oh-my-openagent.jsonc because ALLOWED_AGENTS is hardcoded to 7 built-in names
  • AgentOverridesSchema strips custom keys during Zod parsing (no .catchall())

Changes

  • Replace static ALLOWED_AGENTS array with dynamic union of AGENT_MODEL_REQUIREMENTS keys + user agentOverrides keys (constants.ts, tools.ts)
  • Add .catchall(AgentOverrideConfigSchema.optional()) to AgentOverridesSchema so custom agent names survive config parsing (agent-overrides.ts)
  • Surface user-provided description field in tool prompt instead of generic template
  • Add 4 tests: custom agent acceptance, rejection of unknown agents, schema preservation, schema validation

Testing

bun test src/tools/call-omo-agent/tools.test.ts    # 12 pass
bun test src/config/schema/agent-overrides.test.ts  # 2 pass

Related Issues

Closes #3229


Summary by cubic

Enable custom agents from oh-my-openagent.jsonc in call_omo_agent, fixing rejection of valid user-defined agents. Preserves agent casing and surfaces custom descriptions in the tool prompt (fixes #3229).

  • Bug Fixes
    • Build allowed agent list dynamically from AGENT_MODEL_REQUIREMENTS + user agentOverrides (replaces ALLOWED_AGENTS); update prompt to list these agents and include custom description.
    • Add .catchall(...) to AgentOverridesSchema so custom agent keys survive while validating entries.
    • Case-insensitive matching with registered casing preserved; unknown agents return a clear error; remove hardcoded "explore/librarian only" from input description.
    • Added tests for custom agent acceptance, unknown agent rejection, and schema preservation/validation.

Written for commit 5cc7280. Summary will update on new commits.

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.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

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

@Hybirdss
Copy link
Copy Markdown
Author

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

github-actions bot added a commit that referenced this pull request Apr 10, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +86 to +87
const customAgentKeys = agentOverrides ? Object.keys(agentOverrides) : []
const allowedAgents = [...new Set([...BUILTIN_AGENTS, ...customAgentKeys])]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

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.ts introduces a moderate consistency issue—the accepted agent list expanded, but the tool description still documents only explore/librarian, which can mislead usage and testing.
  • Given the high confidence on the tools.ts behavior (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"
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.

0 issues found across 2 files (changes from recent commits).

Auto-approved: Correctly enables custom agents by allowing catch-all in Zod schema and dynamically building the allowed list from config, with comprehensive tests included.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +86 to +87
const customAgentKeys = agentOverrides ? Object.keys(agentOverrides) : []
const allowedAgents = [...new Set([...BUILTIN_AGENTS, ...customAgentKeys])]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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: call_omo_agent ALLOWED_AGENTS hardcodes 7 agents, blocks custom agents registered in jsonc

1 participant