From e759af8e2a6ef40dea9c800935d39fcae65b84cb Mon Sep 17 00:00:00 2001 From: Lex Christopherson Date: Sun, 15 Mar 2026 15:20:45 -0600 Subject: [PATCH] fix(auto): reset _dispatching flag + improve discuss depth verification UX - auto.ts: wrap dispatchNextUnit body in try/finally to always reset _dispatching to false. Without this, the reentrancy guard permanently blocked all subsequent dispatches after the first one, causing the dispatch gap watchdog to fire and auto-mode to stall. - discuss.md: render depth summary as chat text (where markdown renders) then use ask_user_questions for the short confirmation only. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/resources/extensions/gsd/auto.ts | 5 ++++- src/resources/extensions/gsd/prompts/discuss.md | 14 ++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/resources/extensions/gsd/auto.ts b/src/resources/extensions/gsd/auto.ts index ece8f8cab..4bd601695 100644 --- a/src/resources/extensions/gsd/auto.ts +++ b/src/resources/extensions/gsd/auto.ts @@ -1520,7 +1520,7 @@ async function dispatchNextUnit( return; // Another dispatch is in progress — bail silently } _dispatching = true; - + try { // Recursion depth guard: when many units are skipped in sequence (e.g., after // crash recovery with 10+ completed units), recursive dispatchNextUnit calls // can freeze the TUI or overflow the stack. Yield generously after MAX_SKIP_DEPTH. @@ -2425,6 +2425,9 @@ async function dispatchNextUnit( ); await pauseAuto(ctx, pi); } + } finally { + _dispatching = false; + } } // ─── Skill Discovery ────────────────────────────────────────────────────────── diff --git a/src/resources/extensions/gsd/prompts/discuss.md b/src/resources/extensions/gsd/prompts/discuss.md index e6f4ff3c4..d66ca2932 100644 --- a/src/resources/extensions/gsd/prompts/discuss.md +++ b/src/resources/extensions/gsd/prompts/discuss.md @@ -91,13 +91,19 @@ Do not count the reflection step as a question round. Rounds start after reflect ## Depth Verification -Before moving to the wrap-up gate, present a structured depth summary to the user via `ask_user_questions`. This is a checkpoint — show what you captured across the depth checklist dimensions, using the user's own terminology and framing. +Before moving to the wrap-up gate, present a structured depth summary as a checkpoint. -The question should summarize: what you understood them to be building, what shaped your understanding most (their emphasis, constraints, concerns), and any areas where you're least confident in your understanding. Frame it as: "Before we move to planning, here's what I captured — did I get the depth right?" +**Print the summary as normal chat text first** — this is where the formatting renders properly. Structure the summary across the depth checklist dimensions using the user's own terminology and framing. Cover: what you understood them to be building, what shaped your understanding most (their emphasis, constraints, concerns), and any areas where you're least confident in your understanding. -**Convention:** The question ID must contain `depth_verification` (e.g., `depth_verification_summary`). This naming convention enables downstream mechanical detection of this step. +**Then** use `ask_user_questions` with a short confirmation question — NOT the summary itself. The question field is designed for single sentences, not multi-paragraph summaries. -Offer two options: "Yes, you got it (Recommended)" and "Not quite — let me clarify." If they clarify, absorb the correction and re-verify. +**Convention:** The question ID must contain `depth_verification` (e.g., `depth_verification_confirm`). This naming convention enables downstream mechanical detection of this step. + +Example flow: +1. Print in chat: the full depth summary with markdown formatting (headers, bold, bullets) +2. Call `ask_user_questions` with: header "Depth Check", question "Did I capture the depth right?", options "Yes, you got it (Recommended)" and "Not quite — let me clarify" + +If they clarify, absorb the correction and re-verify. ## Wrap-up Gate