From 99fdaa6ad87613efe13a799bbc417eba796486bb Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Wed, 18 Mar 2026 15:54:34 -0400 Subject: [PATCH] fix: increase headless new-milestone timeout and limit investigation scope (#1230) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two issues with headless new-milestone: 1. Default 300s timeout is too short — codebase investigation + artifact writing for a new milestone regularly exceeds 5 minutes. Bumped to 600s (10 min) when the default hasn't been explicitly overridden. 2. The discuss-headless prompt's 'Investigate' step had no guidance on how much time to spend scouting. LLMs would exhaustively explore the codebase (50+ tool calls) before writing any artifacts, running out of time. Added 'brief' qualifier and 5-6 tool call budget with a note that the research phase does deeper investigation later. The commit_docs: false preference is already respected — the prompt correctly says 'Do not commit' when commit_docs is false, and ensureGitignore idempotently skips when .gsd/ is already in .gitignore. Fixes #1227 --- src/headless.ts | 5 +++++ src/resources/extensions/gsd/prompts/discuss-headless.md | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/headless.ts b/src/headless.ts index 15fd1bbab..b14922271 100644 --- a/src/headless.ts +++ b/src/headless.ts @@ -178,6 +178,11 @@ async function runHeadlessOnce(options: HeadlessOptions, restartCount: number): const startTime = Date.now() const isNewMilestone = options.command === 'new-milestone' + // new-milestone involves codebase investigation + artifact writing — needs more time + if (isNewMilestone && options.timeout === 300_000) { + options.timeout = 600_000 // 10 minutes + } + // Supervised mode cannot share stdin with --context - if (options.supervised && options.context === '-') { process.stderr.write('[headless] Error: --supervised cannot be used with --context - (both require stdin)\n') diff --git a/src/resources/extensions/gsd/prompts/discuss-headless.md b/src/resources/extensions/gsd/prompts/discuss-headless.md index 4a1244704..b6b814064 100644 --- a/src/resources/extensions/gsd/prompts/discuss-headless.md +++ b/src/resources/extensions/gsd/prompts/discuss-headless.md @@ -16,13 +16,15 @@ Summarize your understanding of the specification concretely: - Scope estimate (how many milestones × slices) - Any ambiguities or gaps you notice -### Step 2: Investigate +### Step 2: Investigate (brief) -Scout the codebase to understand what already exists: +Quickly scout the codebase to understand what already exists — spend no more than 5-6 tool calls here: - `ls` the project root and key directories - Search for relevant existing code, patterns, dependencies - Check library docs if needed (`resolve_library` / `get_library_docs`) +Then move on to writing artifacts. Do not explore exhaustively — the research phase will do deeper investigation later. + ### Step 3: Make Decisions For any ambiguities or gaps in the specification: