test(config-handler): update tests for disable_omo_env behavior

- Refactor test descriptions for clarity regarding the presence of <omo-env> in generated prompts.
- Ensure that when disable_omo_env is true, <omo-env> is omitted from the sisyphus prompt.
- Confirm that <omo-env> remains in the prompt when disable_omo_env is not specified.
This commit is contained in:
ControlNet 2026-02-20 03:03:57 +11:00
parent 39a3e39b6b
commit 3bcbd12e2a

View File

@ -1277,8 +1277,13 @@ describe("per-agent todowrite/todoread deny when task_system enabled", () => {
}) })
describe("disable_omo_env pass-through", () => { describe("disable_omo_env pass-through", () => {
test("passes disable_omo_env=true to createBuiltinAgents", async () => { test("omits <omo-env> in generated sisyphus prompt when disable_omo_env is true", async () => {
//#given //#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 pluginConfig: OhMyOpenCodeConfig = {
experimental: { disable_omo_env: true }, experimental: { disable_omo_env: true },
} }
@ -1299,17 +1304,19 @@ describe("disable_omo_env pass-through", () => {
await handler(config) await handler(config)
//#then //#then
const createBuiltinAgentsMock = agents.createBuiltinAgents as unknown as { const agentResult = config.agent as Record<string, { prompt?: string }>
mock: { calls: unknown[][] } const sisyphusPrompt = agentResult[getAgentDisplayName("sisyphus")]?.prompt
} expect(sisyphusPrompt).toBeDefined()
const callArgs = expect(sisyphusPrompt).not.toContain("<omo-env>")
createBuiltinAgentsMock.mock.calls[createBuiltinAgentsMock.mock.calls.length - 1]
expect(callArgs).toBeDefined()
expect(callArgs?.[12]).toBe(true)
}) })
test("passes disable_omo_env=false when config field is omitted", async () => { test("keeps <omo-env> in generated sisyphus prompt when disable_omo_env is omitted", async () => {
//#given //#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 pluginConfig: OhMyOpenCodeConfig = {}
const config: Record<string, unknown> = { const config: Record<string, unknown> = {
model: "anthropic/claude-opus-4-6", model: "anthropic/claude-opus-4-6",
@ -1328,12 +1335,9 @@ describe("disable_omo_env pass-through", () => {
await handler(config) await handler(config)
//#then //#then
const createBuiltinAgentsMock = agents.createBuiltinAgents as unknown as { const agentResult = config.agent as Record<string, { prompt?: string }>
mock: { calls: unknown[][] } const sisyphusPrompt = agentResult[getAgentDisplayName("sisyphus")]?.prompt
} expect(sisyphusPrompt).toBeDefined()
const callArgs = expect(sisyphusPrompt).toContain("<omo-env>")
createBuiltinAgentsMock.mock.calls[createBuiltinAgentsMock.mock.calls.length - 1]
expect(callArgs).toBeDefined()
expect(callArgs?.[12]).toBe(false)
}) })
}) })