fix(config-handler): preserve disable_omo_env wiring in agent setup
This commit is contained in:
parent
49aa5162bb
commit
b48804e3cb
@ -82,7 +82,7 @@ export async function applyAgentConfig(params: {
|
|||||||
migratedDisabledAgents,
|
migratedDisabledAgents,
|
||||||
params.pluginConfig.agents,
|
params.pluginConfig.agents,
|
||||||
params.ctx.directory,
|
params.ctx.directory,
|
||||||
undefined,
|
currentModel,
|
||||||
params.pluginConfig.categories,
|
params.pluginConfig.categories,
|
||||||
params.pluginConfig.git_master,
|
params.pluginConfig.git_master,
|
||||||
allDiscoveredSkills,
|
allDiscoveredSkills,
|
||||||
|
|||||||
@ -1277,12 +1277,15 @@ describe("per-agent todowrite/todoread deny when task_system enabled", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe("disable_omo_env pass-through", () => {
|
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
|
//#given
|
||||||
;(agents.createBuiltinAgents as any)?.mockRestore?.()
|
const createBuiltinAgentsMock = agents.createBuiltinAgents as unknown as {
|
||||||
;(shared.fetchAvailableModels as any).mockResolvedValue(
|
mockResolvedValue: (value: Record<string, unknown>) => void
|
||||||
new Set(["anthropic/claude-opus-4-6", "google/gemini-3-flash"])
|
mock: { calls: unknown[][] }
|
||||||
)
|
}
|
||||||
|
createBuiltinAgentsMock.mockResolvedValue({
|
||||||
|
sisyphus: { name: "sisyphus", prompt: "without-env", mode: "primary" },
|
||||||
|
})
|
||||||
|
|
||||||
const pluginConfig: OhMyOpenCodeConfig = {
|
const pluginConfig: OhMyOpenCodeConfig = {
|
||||||
experimental: { disable_omo_env: true },
|
experimental: { disable_omo_env: true },
|
||||||
@ -1304,18 +1307,21 @@ describe("disable_omo_env pass-through", () => {
|
|||||||
await handler(config)
|
await handler(config)
|
||||||
|
|
||||||
//#then
|
//#then
|
||||||
const agentResult = config.agent as Record<string, { prompt?: string }>
|
const lastCall =
|
||||||
const sisyphusPrompt = agentResult[getAgentDisplayName("sisyphus")]?.prompt
|
createBuiltinAgentsMock.mock.calls[createBuiltinAgentsMock.mock.calls.length - 1]
|
||||||
expect(sisyphusPrompt).toBeDefined()
|
expect(lastCall).toBeDefined()
|
||||||
expect(sisyphusPrompt).not.toContain("<omo-env>")
|
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
|
//#given
|
||||||
;(agents.createBuiltinAgents as any)?.mockRestore?.()
|
const createBuiltinAgentsMock = agents.createBuiltinAgents as unknown as {
|
||||||
;(shared.fetchAvailableModels as any).mockResolvedValue(
|
mockResolvedValue: (value: Record<string, unknown>) => void
|
||||||
new Set(["anthropic/claude-opus-4-6", "google/gemini-3-flash"])
|
mock: { calls: unknown[][] }
|
||||||
)
|
}
|
||||||
|
createBuiltinAgentsMock.mockResolvedValue({
|
||||||
|
sisyphus: { name: "sisyphus", prompt: "with-env", mode: "primary" },
|
||||||
|
})
|
||||||
|
|
||||||
const pluginConfig: OhMyOpenCodeConfig = {}
|
const pluginConfig: OhMyOpenCodeConfig = {}
|
||||||
const config: Record<string, unknown> = {
|
const config: Record<string, unknown> = {
|
||||||
@ -1335,9 +1341,9 @@ describe("disable_omo_env pass-through", () => {
|
|||||||
await handler(config)
|
await handler(config)
|
||||||
|
|
||||||
//#then
|
//#then
|
||||||
const agentResult = config.agent as Record<string, { prompt?: string }>
|
const lastCall =
|
||||||
const sisyphusPrompt = agentResult[getAgentDisplayName("sisyphus")]?.prompt
|
createBuiltinAgentsMock.mock.calls[createBuiltinAgentsMock.mock.calls.length - 1]
|
||||||
expect(sisyphusPrompt).toBeDefined()
|
expect(lastCall).toBeDefined()
|
||||||
expect(sisyphusPrompt).toContain("<omo-env>")
|
expect(lastCall?.[12]).toBe(false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user