Bug Description
gsd headless discuss --supervised --json ends the session prematurely after the first ask_user_questions tool call completes. The LLM never gets a chance to:
- Ask additional rounds of questions (it was thinking about "3-5 behavioral unknowns" but only got to ask 1)
- Write the
S##-CONTEXT.md file with the discussion results
No CONTEXT.md file is ever produced, making headless supervised discuss non-functional for its intended purpose.
Root Cause
In src/headless.ts line 262:
const isMultiTurnCommand = options.command === 'auto' || options.command === 'next'
discuss is not classified as a multi-turn command. At line 640:
if (eventObj.type === 'execution_complete' && !completed && !isMultiTurnCommand) {
completed = true
// ...
resolveCompletion()
return
}
After the ask_user_questions tool receives a supervised response and the LLM turn ends, execution_complete fires. Since discuss is not multi-turn, the headless orchestrator immediately sets completed = true and calls resolveCompletion(), killing the session before the LLM can take another turn.
Steps to Reproduce
gsd headless discuss --supervised --json --response-timeout 300000
- Supervised orchestrator receives
extension_ui_request for slice picker, responds
- GSD scans codebase (multiple bash tool calls across multiple turns — working correctly)
- LLM calls
ask_user_questions tool, orchestrator receives extension_ui_request, responds
- Session ends immediately — no
agent_end event, no further tool calls, no CONTEXT.md written
Expected Behavior
After the ask_user_questions tool receives the supervised response:
- The LLM should get another turn to process the answer
- The LLM should be able to call
ask_user_questions again for additional question rounds
- The LLM should write
S##-CONTEXT.md with the discussion results
- The session should end after the discuss workflow completes naturally
Suggested Fix
Add discuss to the multi-turn command classification, or use a different completion detection mechanism for discuss sessions (e.g., detect when the dispatchWorkflow discuss prompt has fully resolved via ctx.waitForIdle()).
const isMultiTurnCommand = options.command === 'auto' || options.command === 'next' || options.command === 'discuss'
Environment
- GSD version: 2.63.0
- OS: Linux
- Node: v22.22.0
Workaround
Currently no viable headless workaround. The discuss command in headless supervised mode cannot produce CONTEXT.md files. Manual creation of CONTEXT.md files is required to satisfy the require_slice_discussion gate.
Bug Description
gsd headless discuss --supervised --jsonends the session prematurely after the firstask_user_questionstool call completes. The LLM never gets a chance to:S##-CONTEXT.mdfile with the discussion resultsNo CONTEXT.md file is ever produced, making headless supervised discuss non-functional for its intended purpose.
Root Cause
In
src/headless.tsline 262:discussis not classified as a multi-turn command. At line 640:After the
ask_user_questionstool receives a supervised response and the LLM turn ends,execution_completefires. Sincediscussis not multi-turn, the headless orchestrator immediately setscompleted = trueand callsresolveCompletion(), killing the session before the LLM can take another turn.Steps to Reproduce
extension_ui_requestfor slice picker, respondsask_user_questionstool, orchestrator receivesextension_ui_request, respondsagent_endevent, no further tool calls, no CONTEXT.md writtenExpected Behavior
After the
ask_user_questionstool receives the supervised response:ask_user_questionsagain for additional question roundsS##-CONTEXT.mdwith the discussion resultsSuggested Fix
Add
discussto the multi-turn command classification, or use a different completion detection mechanism for discuss sessions (e.g., detect when thedispatchWorkflowdiscuss prompt has fully resolved viactx.waitForIdle()).Environment
Workaround
Currently no viable headless workaround. The
discusscommand in headless supervised mode cannot produce CONTEXT.md files. Manual creation of CONTEXT.md files is required to satisfy therequire_slice_discussiongate.