From 9ba676330a0a45a9ee346bbfe6026e9f90f71956 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Fri, 1 May 2026 18:55:47 +0900 Subject: [PATCH] fix(call-omo-agent): validate missing subagent type Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/tools/call-omo-agent/tools.test.ts | 13 +++++++++++++ src/tools/call-omo-agent/tools.ts | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/tools/call-omo-agent/tools.test.ts b/src/tools/call-omo-agent/tools.test.ts index 17491cb82..eca670399 100644 --- a/src/tools/call-omo-agent/tools.test.ts +++ b/src/tools/call-omo-agent/tools.test.ts @@ -136,6 +136,19 @@ describe("createCallOmoAgent", () => { }) describe("dynamic custom agent resolution", () => { + test("should reject missing subagent_type without throwing", async () => { + const mockCtx = createMockCtx(DEFAULT_AGENTS) + const toolDef = createCallOmoAgent(mockCtx, mockBackgroundManager, []) + const executeFunc = toolDef.execute as Function + + const result = await executeFunc( + { description: "Test", prompt: "Fix bug", run_in_background: true }, + toolCtx + ) + + expect(result).toContain("subagent_type is required") + }) + test("should accept a custom agent returned by client.app.agents()", async () => { const agents = [...DEFAULT_AGENTS, { name: "bug-fixer", mode: "subagent" }] const mockCtx = createMockCtx(agents) diff --git a/src/tools/call-omo-agent/tools.ts b/src/tools/call-omo-agent/tools.ts index 51ea8730c..6e315cd86 100644 --- a/src/tools/call-omo-agent/tools.ts +++ b/src/tools/call-omo-agent/tools.ts @@ -140,6 +140,10 @@ export function createCallOmoAgent( `[call_omo_agent] Starting with agent: ${args.subagent_type}, background: ${args.run_in_background}`, ); + if (typeof args.subagent_type !== "string" || args.subagent_type.trim() === "") { + return "Error: subagent_type is required." + } + const callableAgents = await resolveCallableAgents(ctx.client); // Strip ZWSP and case-insensitive agent validation - allows "Explore", "EXPLORE", "explore" etc.