fix(config-handler): preserve disable_omo_env wiring in agent setup
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user