From 21a14e32fcec2fb555b41ad60d4788ea2cba3f99 Mon Sep 17 00:00:00 2001 From: Tibsfox Date: Sun, 5 Apr 2026 11:14:24 -0700 Subject: [PATCH 1/2] fix(headless): treat discuss and plan as multi-turn commands --- src/headless.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/headless.ts b/src/headless.ts index 503ca9afd..cd0d86124 100644 --- a/src/headless.ts +++ b/src/headless.ts @@ -259,7 +259,9 @@ async function runHeadlessOnce(options: HeadlessOptions, restartCount: number): // per-unit timeout via auto-supervisor. Disable the overall timeout unless the // user explicitly set --timeout. const isAutoMode = options.command === 'auto' - const isMultiTurnCommand = options.command === 'auto' || options.command === 'next' + // discuss and plan are multi-turn: they involve multiple question rounds, + // codebase scanning, and artifact writing before the workflow completes (#3547). + const isMultiTurnCommand = options.command === 'auto' || options.command === 'next' || options.command === 'discuss' || options.command === 'plan' if (isAutoMode && options.timeout === 300_000) { options.timeout = 0 } From 3213cd8c8090b4476b6557b3db6f2d76cdaef2c1 Mon Sep 17 00:00:00 2001 From: Tibsfox Date: Sun, 5 Apr 2026 11:56:44 -0700 Subject: [PATCH 2/2] test(headless): add multi-turn command classification test --- src/tests/headless-multi-turn.test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/tests/headless-multi-turn.test.ts diff --git a/src/tests/headless-multi-turn.test.ts b/src/tests/headless-multi-turn.test.ts new file mode 100644 index 000000000..19cb1b9bb --- /dev/null +++ b/src/tests/headless-multi-turn.test.ts @@ -0,0 +1,19 @@ +/** + * Regression test for #3547: discuss and plan must be classified as + * multi-turn commands in headless mode. + */ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { join, dirname } from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +test("headless.ts classifies discuss as multi-turn (#3547)", () => { + const src = readFileSync(join(__dirname, "..", "headless.ts"), "utf-8"); + const multiTurnLine = src.match(/isMultiTurnCommand\s*=\s*[^;]+/); + assert.ok(multiTurnLine, "isMultiTurnCommand must be defined"); + assert.ok(multiTurnLine![0].includes("discuss"), "discuss must be in multi-turn list"); + assert.ok(multiTurnLine![0].includes("plan"), "plan must be in multi-turn list"); +});