From 19f02f7fdb80c35afaee94652e794b1852fbb38d Mon Sep 17 00:00:00 2001 From: Lex Christopherson Date: Wed, 11 Mar 2026 00:30:06 -0600 Subject: [PATCH] fix: guard against re-injecting discuss prompt when session already in flight MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When no milestone exists, both /gsd and /gsd auto reach showSmartEntry and call dispatchWorkflow — overwriting pendingAutoStart and restarting the conversation mid-interview every time the user re-ran the command. Add a pendingAutoStart check at the top of the !activeMilestone branch. If a discuss session is already in progress, notify the user instead of re-dispatching. Fixes #6 --- src/resources/extensions/gsd/guided-flow.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/resources/extensions/gsd/guided-flow.ts b/src/resources/extensions/gsd/guided-flow.ts index 38922b2d4..30bf061aa 100644 --- a/src/resources/extensions/gsd/guided-flow.ts +++ b/src/resources/extensions/gsd/guided-flow.ts @@ -486,6 +486,15 @@ export async function showSmartEntry( const state = await deriveState(basePath); if (!state.activeMilestone) { + // Guard: if a discuss session is already in flight, don't re-inject the prompt. + // Both /gsd and /gsd auto reach this branch when no milestone exists yet. + // Without this guard, every subsequent /gsd call overwrites pendingAutoStart + // and fires another dispatchWorkflow, resetting the conversation mid-interview. + if (pendingAutoStart) { + ctx.ui.notify("Discussion already in progress — answer the question above to continue.", "info"); + return; + } + const milestoneIds = findMilestoneIds(basePath); const nextId = `M${String(milestoneIds.length + 1).padStart(3, "0")}`; const isFirst = milestoneIds.length === 0;