From 3bcbd12e2ad08f1a77a92993c928f158fe88419b Mon Sep 17 00:00:00 2001 From: ControlNet Date: Fri, 20 Feb 2026 03:03:57 +1100 Subject: [PATCH] test(config-handler): update tests for disable_omo_env behavior - Refactor test descriptions for clarity regarding the presence of in generated prompts. - Ensure that when disable_omo_env is true, is omitted from the sisyphus prompt. - Confirm that remains in the prompt when disable_omo_env is not specified. --- src/plugin-handlers/config-handler.test.ts | 36 ++++++++++++---------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/plugin-handlers/config-handler.test.ts b/src/plugin-handlers/config-handler.test.ts index a52068cd..a3a81f92 100644 --- a/src/plugin-handlers/config-handler.test.ts +++ b/src/plugin-handlers/config-handler.test.ts @@ -1277,8 +1277,13 @@ describe("per-agent todowrite/todoread deny when task_system enabled", () => { }) describe("disable_omo_env pass-through", () => { - test("passes disable_omo_env=true to createBuiltinAgents", async () => { + test("omits in generated sisyphus prompt when disable_omo_env is true", async () => { //#given + ;(agents.createBuiltinAgents as any)?.mockRestore?.() + ;(shared.fetchAvailableModels as any).mockResolvedValue( + new Set(["anthropic/claude-opus-4-6", "google/gemini-3-flash"]) + ) + const pluginConfig: OhMyOpenCodeConfig = { experimental: { disable_omo_env: true }, } @@ -1299,17 +1304,19 @@ describe("disable_omo_env pass-through", () => { await handler(config) //#then - const createBuiltinAgentsMock = agents.createBuiltinAgents as unknown as { - mock: { calls: unknown[][] } - } - const callArgs = - createBuiltinAgentsMock.mock.calls[createBuiltinAgentsMock.mock.calls.length - 1] - expect(callArgs).toBeDefined() - expect(callArgs?.[12]).toBe(true) + const agentResult = config.agent as Record + const sisyphusPrompt = agentResult[getAgentDisplayName("sisyphus")]?.prompt + expect(sisyphusPrompt).toBeDefined() + expect(sisyphusPrompt).not.toContain("") }) - test("passes disable_omo_env=false when config field is omitted", async () => { + test("keeps in generated sisyphus prompt when disable_omo_env is 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 pluginConfig: OhMyOpenCodeConfig = {} const config: Record = { model: "anthropic/claude-opus-4-6", @@ -1328,12 +1335,9 @@ describe("disable_omo_env pass-through", () => { await handler(config) //#then - const createBuiltinAgentsMock = agents.createBuiltinAgents as unknown as { - mock: { calls: unknown[][] } - } - const callArgs = - createBuiltinAgentsMock.mock.calls[createBuiltinAgentsMock.mock.calls.length - 1] - expect(callArgs).toBeDefined() - expect(callArgs?.[12]).toBe(false) + const agentResult = config.agent as Record + const sisyphusPrompt = agentResult[getAgentDisplayName("sisyphus")]?.prompt + expect(sisyphusPrompt).toBeDefined() + expect(sisyphusPrompt).toContain("") }) })