fix: guard against re-injecting discuss prompt when session already in flight
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
This commit is contained in:
parent
006c17c2c2
commit
19f02f7fdb
1 changed files with 9 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue