fix(config-handler): preserve disable_omo_env wiring in agent setup

This commit is contained in:
YeonGyu-Kim
2026-02-21 02:54:23 +09:00
parent 49aa5162bb
commit b48804e3cb
2 changed files with 25 additions and 19 deletions

View File

@@ -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,

View File

@@ -1277,12 +1277,15 @@ describe("per-agent todowrite/todoread deny when task_system enabled", () => {
})
describe("disable_omo_env pass-through", () => {
test("omits <omo-env> 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<string, unknown>) => 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<string, { prompt?: string }>
const sisyphusPrompt = agentResult[getAgentDisplayName("sisyphus")]?.prompt
expect(sisyphusPrompt).toBeDefined()
expect(sisyphusPrompt).not.toContain("<omo-env>")
const lastCall =
createBuiltinAgentsMock.mock.calls[createBuiltinAgentsMock.mock.calls.length - 1]
expect(lastCall).toBeDefined()
expect(lastCall?.[12]).toBe(true)
})
test("keeps <omo-env> 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<string, unknown>) => void
mock: { calls: unknown[][] }
}
createBuiltinAgentsMock.mockResolvedValue({
sisyphus: { name: "sisyphus", prompt: "with-env", mode: "primary" },
})
const pluginConfig: OhMyOpenCodeConfig = {}
const config: Record<string, unknown> = {
@@ -1335,9 +1341,9 @@ describe("disable_omo_env pass-through", () => {
await handler(config)
//#then
const agentResult = config.agent as Record<string, { prompt?: string }>
const sisyphusPrompt = agentResult[getAgentDisplayName("sisyphus")]?.prompt
expect(sisyphusPrompt).toBeDefined()
expect(sisyphusPrompt).toContain("<omo-env>")
const lastCall =
createBuiltinAgentsMock.mock.calls[createBuiltinAgentsMock.mock.calls.length - 1]
expect(lastCall).toBeDefined()
expect(lastCall?.[12]).toBe(false)
})
})