diff --git a/packages/coding-agent/src/prompts/system/system-prompt.md b/packages/coding-agent/src/prompts/system/system-prompt.md index 00b9c9bb3..ad19b6d69 100644 --- a/packages/coding-agent/src/prompts/system/system-prompt.md +++ b/packages/coding-agent/src/prompts/system/system-prompt.md @@ -214,9 +214,8 @@ EXECUTION WORKFLOW - **Native desktop UI** → drive it with `{{toolRefs.computer}}`; ground every claim in fresh screenshot or accessibility evidence. {{/has}} - **TUI/CLI** → launch the actual program and verify terminal interaction, output, or state. -{{#ifAny (includes tools "browser") (includes tools "computer")}} -{{else}} - - If no suitable runtime tool is available, verify with a behavioral test or smoke test and explicitly report when visual verification cannot be performed. +{{#ifAny (not (includes tools "browser")) (not (includes tools "computer"))}} + - If no suitable runtime tool is available for the surface being changed, verify with a behavioral test or smoke test and explicitly report when visual verification cannot be performed. {{/ifAny}} - **Bug fix** → reproduce the bug, apply the fix, confirm the reproduction no longer triggers. - **Permanent feature / API change** → existing tests that cover the changed contract. Add a test only when the change introduces a new observable contract not already covered, or the user asked for one. diff --git a/packages/coding-agent/test/plan-mode/reentry-prompt.test.ts b/packages/coding-agent/test/plan-mode/reentry-prompt.test.ts index ff8e2966d..d7732aa1c 100644 --- a/packages/coding-agent/test/plan-mode/reentry-prompt.test.ts +++ b/packages/coding-agent/test/plan-mode/reentry-prompt.test.ts @@ -12,34 +12,42 @@ const BASE = { askAvailable: true, taskAvailable: true, scoutAvailable: true, + reentry: false, + planExists: true, } as const; -function render(overrides: Partial>): string { +type Overrides = Partial>; + +function render(overrides: Overrides = {}): string { return prompt.render(planModeActivePrompt, { ...BASE, ...overrides }); } describe("plan-mode re-entry prompt", () => { it("only emits the Re-entry section when re-entering", () => { - expect(render({ reentry: false, planExists: true })).not.toContain("## Re-entry"); - expect(render({ reentry: true, planExists: true })).toContain("## Re-entry"); + expect(render({ reentry: false })).not.toContain("## Re-entry"); + expect(render({ reentry: true })).toContain("## Re-entry"); }); }); describe("plan-mode-active tool availability", () => { it("omits ask-tool directives when ask is unavailable", () => { - const withoutAsk = render({ askAvailable: false }); + const withoutAsk = render({ askAvailable: false, iterative: true }); expect(withoutAsk).not.toContain("`ask` with 2–4 mutually exclusive options"); expect(withoutAsk).not.toContain("use `ask` for preferences and tradeoffs"); expect(withoutAsk).not.toContain("Using `ask` to gather requirements"); - const withAsk = render({ askAvailable: true }); + const withAsk = render({ askAvailable: true, iterative: true }); expect(withAsk).toContain("`ask` with 2–4 mutually exclusive options"); + expect(withAsk).toContain("use `ask` for preferences and tradeoffs"); }); it("provides a prose fallback for preference collection when ask is unavailable", () => { - const withoutAsk = render({ askAvailable: false }); - expect(withoutAsk).toContain("present the candidates with a recommendation in prose"); - expect(withoutAsk).toContain("surface any remaining preference questions with a recommendation in prose"); + const iterativeWithoutAsk = render({ askAvailable: false, iterative: true }); + expect(iterativeWithoutAsk).toContain("present the candidates with a recommendation in prose"); + expect(iterativeWithoutAsk).not.toContain("`ask` for preferences and tradeoffs only"); + + const parallelWithoutAsk = render({ askAvailable: false, iterative: false }); + expect(parallelWithoutAsk).toContain("surface any remaining preference questions with a recommendation in prose"); }); it("omits scout-via-task dispatch when the task tool is unavailable", () => { diff --git a/packages/coding-agent/test/system-prompt-inventory.test.ts b/packages/coding-agent/test/system-prompt-inventory.test.ts index 8109c13fb..481c6966a 100644 --- a/packages/coding-agent/test/system-prompt-inventory.test.ts +++ b/packages/coding-agent/test/system-prompt-inventory.test.ts @@ -724,6 +724,9 @@ describe("system prompt tool inventory", () => { ).systemPrompt.join("\n\n"); expect(withBrowser).toContain("drive it in `browser`"); + // A browser-only session still needs the smoke-test fallback for + // native-desktop surfaces (no computer tool). + expect(withBrowser).toContain("behavioral test or smoke test"); }); it("omits todo workflow guidance when the todo tool is absent", async () => {