diff --git a/src/plugin-handlers/config-handler.test.ts b/src/plugin-handlers/config-handler.test.ts index 69866362c..3a1a00ca9 100644 --- a/src/plugin-handlers/config-handler.test.ts +++ b/src/plugin-handlers/config-handler.test.ts @@ -395,6 +395,43 @@ describe("Prometheus direct override priority over category", () => { expect(agents.prometheus).toBeDefined() expect(agents.prometheus.temperature).toBe(0.1) }) + + test("prometheus prompt_append is appended to base prompt", async () => { + // #given - prometheus override with prompt_append + const customInstructions = "## Custom Project Rules\nUse max 2 commits." + const pluginConfig: OhMyOpenCodeConfig = { + sisyphus_agent: { + planner_enabled: true, + }, + agents: { + prometheus: { + prompt_append: customInstructions, + }, + }, + } + const config: Record = { + model: "anthropic/claude-opus-4-5", + agent: {}, + } + const handler = createConfigHandler({ + ctx: { directory: "/tmp" }, + pluginConfig, + modelCacheState: { + anthropicContext1MEnabled: false, + modelContextLimitsCache: new Map(), + }, + }) + + // #when + await handler(config) + + // #then - prompt_append is appended to base prompt, not overwriting it + const agents = config.agent as Record + expect(agents.prometheus).toBeDefined() + expect(agents.prometheus.prompt).toContain("Prometheus") + expect(agents.prometheus.prompt).toContain(customInstructions) + expect(agents.prometheus.prompt!.endsWith(customInstructions)).toBe(true) + }) }) describe("Deadlock prevention - fetchAvailableModels must not receive client", () => { diff --git a/src/plugin-handlers/config-handler.ts b/src/plugin-handlers/config-handler.ts index 471ce1d81..e62a40b5c 100644 --- a/src/plugin-handlers/config-handler.ts +++ b/src/plugin-handlers/config-handler.ts @@ -298,9 +298,19 @@ export function createConfigHandler(deps: ConfigHandlerDeps) { : {}), }; - agentConfig["prometheus"] = prometheusOverride - ? { ...prometheusBase, ...prometheusOverride } - : prometheusBase; + // Properly handle prompt_append for Prometheus + // Extract prompt_append and append it to prompt instead of shallow spread + // Fixes: https://github.com/code-yeongyu/oh-my-opencode/issues/723 + if (prometheusOverride) { + const { prompt_append, ...restOverride } = prometheusOverride as Record & { prompt_append?: string }; + const merged = { ...prometheusBase, ...restOverride }; + if (prompt_append && merged.prompt) { + merged.prompt = merged.prompt + "\n" + prompt_append; + } + agentConfig["prometheus"] = merged; + } else { + agentConfig["prometheus"] = prometheusBase; + } } const filteredConfigAgents = configAgent