diff --git a/src/plugin-handlers/agent-config-handler.ts b/src/plugin-handlers/agent-config-handler.ts index 067ee83f5..c5d59e149 100644 --- a/src/plugin-handlers/agent-config-handler.ts +++ b/src/plugin-handlers/agent-config-handler.ts @@ -82,7 +82,7 @@ export async function applyAgentConfig(params: { migratedDisabledAgents, params.pluginConfig.agents, params.ctx.directory, - undefined, + currentModel, params.pluginConfig.categories, params.pluginConfig.git_master, allDiscoveredSkills, diff --git a/src/plugin-handlers/config-handler.test.ts b/src/plugin-handlers/config-handler.test.ts index a3a81f923..e405ee825 100644 --- a/src/plugin-handlers/config-handler.test.ts +++ b/src/plugin-handlers/config-handler.test.ts @@ -1277,12 +1277,15 @@ describe("per-agent todowrite/todoread deny when task_system enabled", () => { }) describe("disable_omo_env pass-through", () => { - test("omits in generated sisyphus prompt when disable_omo_env is true", async () => { + test("passes disable_omo_env=true to createBuiltinAgents", async () => { //#given - ;(agents.createBuiltinAgents as any)?.mockRestore?.() - ;(shared.fetchAvailableModels as any).mockResolvedValue( - new Set(["anthropic/claude-opus-4-6", "google/gemini-3-flash"]) - ) + const createBuiltinAgentsMock = agents.createBuiltinAgents as unknown as { + mockResolvedValue: (value: Record) => void + mock: { calls: unknown[][] } + } + createBuiltinAgentsMock.mockResolvedValue({ + sisyphus: { name: "sisyphus", prompt: "without-env", mode: "primary" }, + }) const pluginConfig: OhMyOpenCodeConfig = { experimental: { disable_omo_env: true }, @@ -1304,18 +1307,21 @@ describe("disable_omo_env pass-through", () => { await handler(config) //#then - const agentResult = config.agent as Record - const sisyphusPrompt = agentResult[getAgentDisplayName("sisyphus")]?.prompt - expect(sisyphusPrompt).toBeDefined() - expect(sisyphusPrompt).not.toContain("") + const lastCall = + createBuiltinAgentsMock.mock.calls[createBuiltinAgentsMock.mock.calls.length - 1] + expect(lastCall).toBeDefined() + expect(lastCall?.[12]).toBe(true) }) - test("keeps in generated sisyphus prompt when disable_omo_env is omitted", async () => { + test("passes disable_omo_env=false to createBuiltinAgents when omitted", async () => { //#given - ;(agents.createBuiltinAgents as any)?.mockRestore?.() - ;(shared.fetchAvailableModels as any).mockResolvedValue( - new Set(["anthropic/claude-opus-4-6", "google/gemini-3-flash"]) - ) + const createBuiltinAgentsMock = agents.createBuiltinAgents as unknown as { + mockResolvedValue: (value: Record) => void + mock: { calls: unknown[][] } + } + createBuiltinAgentsMock.mockResolvedValue({ + sisyphus: { name: "sisyphus", prompt: "with-env", mode: "primary" }, + }) const pluginConfig: OhMyOpenCodeConfig = {} const config: Record = { @@ -1335,9 +1341,9 @@ describe("disable_omo_env pass-through", () => { await handler(config) //#then - const agentResult = config.agent as Record - const sisyphusPrompt = agentResult[getAgentDisplayName("sisyphus")]?.prompt - expect(sisyphusPrompt).toBeDefined() - expect(sisyphusPrompt).toContain("") + const lastCall = + createBuiltinAgentsMock.mock.calls[createBuiltinAgentsMock.mock.calls.length - 1] + expect(lastCall).toBeDefined() + expect(lastCall?.[12]).toBe(false) }) })