fix(gsd): add structuredQuestionsAvailable conditional to slice discuss

The slice discuss template hardcoded ask_user_questions references with
no fallback for providers that don't have the tool. The milestone
discuss template was already fixed with a conditional.

Now buildDiscussSlicePrompt accepts and passes structuredQuestionsAvailable,
and the prompt template uses the same conditional pattern as the milestone
discuss template.

Closes #3604

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tibsfox 2026-04-06 19:09:41 -07:00
parent b4c6229360
commit dd527ce08e
2 changed files with 10 additions and 7 deletions

View file

@ -480,7 +480,7 @@ async function buildDiscussSlicePrompt(
sid: string,
sTitle: string,
base: string,
options?: { rediscuss?: boolean },
options?: { rediscuss?: boolean; structuredQuestionsAvailable?: string },
): Promise<string> {
const inlined: string[] = [];
@ -560,6 +560,7 @@ async function buildDiscussSlicePrompt(
contextPath: sliceContextPath,
projectRoot: base,
inlinedTemplates,
structuredQuestionsAvailable: options?.structuredQuestionsAvailable ?? "false",
commitInstruction: buildDocsCommitInstruction(`docs(${mid}/${sid}): slice context from discuss`),
});
}
@ -801,7 +802,8 @@ export async function showDiscuss(
if (confirm !== "rediscuss") continue;
}
const prompt = await buildDiscussSlicePrompt(mid, chosen.id, chosen.title, basePath, { rediscuss: isRediscuss });
const sqAvail = pi.getActiveTools().includes("ask_user_questions") ? "true" : "false";
const prompt = await buildDiscussSlicePrompt(mid, chosen.id, chosen.title, basePath, { rediscuss: isRediscuss, structuredQuestionsAvailable: sqAvail });
await dispatchWorkflow(pi, prompt, "gsd-discuss", ctx, "discuss-slice");
// Wait for the discuss session to finish, then loop back to the picker
@ -1514,7 +1516,8 @@ export async function showSmartEntry(
}),
}), "gsd-run", ctx, "plan-slice");
} else if (choice === "discuss") {
await dispatchWorkflow(pi, await buildDiscussSlicePrompt(milestoneId, sliceId, sliceTitle, basePath, { rediscuss: hasContext }), "gsd-run", ctx, "discuss-slice");
const sqAvail = pi.getActiveTools().includes("ask_user_questions") ? "true" : "false";
await dispatchWorkflow(pi, await buildDiscussSlicePrompt(milestoneId, sliceId, sliceTitle, basePath, { rediscuss: hasContext, structuredQuestionsAvailable: sqAvail }), "gsd-run", ctx, "discuss-slice");
} else if (choice === "research") {
const researchTemplates = inlineTemplate("research", "Research");
await dispatchWorkflow(pi, loadPrompt("guided-research-slice", {

View file

@ -22,7 +22,9 @@ Do **not** go deep — just enough that your questions reflect what's actually t
### Question rounds
Ask **13 questions per round** using `ask_user_questions`. **Call `ask_user_questions` exactly once per turn — never make multiple calls with the same or overlapping questions. Wait for the user's response before asking the next round.** Keep each question focused on one of:
**If `{{structuredQuestionsAvailable}}` is `true`:** Ask **13 questions per round** using `ask_user_questions`. **Call `ask_user_questions` exactly once per turn — never make multiple calls with the same or overlapping questions. Wait for the user's response before asking the next round.**
**If `{{structuredQuestionsAvailable}}` is `false`:** Ask **13 questions per round** in plain text. Number them and wait for the user's response before asking the next round.
Keep each question focused on one of:
- **UX and user-facing behaviour** — what does the user see, click, trigger, or experience?
- **Edge cases and failure states** — what happens when things go wrong or are in unusual states?
- **Scope boundaries** — what is explicitly in vs out for this slice? What deferred to later?
@ -36,9 +38,7 @@ After each round of answers, decide whether you already have enough signal to wr
- If not, investigate any new unknowns and continue to the next round immediately. Do **not** ask a meta "ready to wrap up?" question after every round.
- Ask a single wrap-up question only when you genuinely believe the slice is well understood or the user signals they want to stop.
- When you do ask it, use `ask_user_questions` with:
- "Write the context file" *(recommended when the slice is well understood)*
- "One more pass"
- When you do ask it, offer two choices: "Write the context file" *(recommended when the slice is well understood)* or "One more pass". Use `ask_user_questions` if available, otherwise ask in plain text.
---