fix: call ensureDbOpen() before slice queries in /gsd discuss (#2640)
showDiscuss() is a command handler, not a tool handler, so it lacks the automatic ensureDbOpen() call that tool handlers get. On cold-start sessions where no GSD tool has been called yet, isDbAvailable() returns false, normSlices falls to [], and the function exits with a misleading "All slices are complete — nothing to discuss." notification. Add ensureDbOpen() before both isDbAvailable() call sites in guided-flow.ts: 1. showDiscuss() — the primary bug (false "all complete" exit) 2. buildDiscussSlicePrompt() — secondary (incomplete context when inlining completed-slice summaries) Closes #2560
This commit is contained in:
parent
4117e299e7
commit
8358f262e9
1 changed files with 11 additions and 0 deletions
|
|
@ -450,7 +450,10 @@ async function buildDiscussSlicePrompt(
|
|||
}
|
||||
|
||||
// Completed slice summaries — what was already built that this slice builds on
|
||||
// Ensure DB is open so getMilestoneSlices returns real data (#2560).
|
||||
{
|
||||
const { ensureDbOpen } = await import("./bootstrap/dynamic-tools.js");
|
||||
await ensureDbOpen();
|
||||
type NormSlice = { id: string; done: boolean };
|
||||
let normSlices: NormSlice[] = [];
|
||||
if (isDbAvailable()) {
|
||||
|
|
@ -588,6 +591,14 @@ export async function showDiscuss(
|
|||
return;
|
||||
}
|
||||
|
||||
// Ensure DB is open before querying slices (#2560).
|
||||
// showDiscuss() is a command handler — unlike tool handlers, it has no
|
||||
// automatic ensureDbOpen() call. Without this, isDbAvailable() returns
|
||||
// false on cold-start sessions and normSlices falls to [] → false
|
||||
// "All slices complete" exit.
|
||||
const { ensureDbOpen } = await import("./bootstrap/dynamic-tools.js");
|
||||
await ensureDbOpen();
|
||||
|
||||
// Guard: no roadmap yet (unless DB has slices)
|
||||
const roadmapFile = resolveMilestoneFile(basePath, mid, "ROADMAP");
|
||||
const roadmapContent = roadmapFile ? await loadFile(roadmapFile) : null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue