fix(gsd): clear all caches after discuss dispatch so picker sees new CONTEXT files (#981)

guided-flow.ts called only invalidateStateCache() after waitForIdle(),
leaving dirEntryCache stale. resolveSliceFile("CONTEXT") missed files
written during the discuss session, keeping the just-discussed slice
recommended and preventing the allDiscussed exit gate from firing.

Swap to invalidateAllCaches() at both call sites (discuss loop and
queue reorder), matching the pattern used throughout auto.ts.

Fixes #977

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
TÂCHES 2026-03-17 17:25:59 -06:00 committed by GitHub
parent 7868761ca0
commit dfc41e105d

View file

@ -10,7 +10,8 @@ import type { ExtensionAPI, ExtensionContext, ExtensionCommandContext } from "@g
import { showNextAction } from "../shared/next-action-ui.js";
import { loadFile, parseRoadmap } from "./files.js";
import { loadPrompt, inlineTemplate } from "./prompt-loader.js";
import { deriveState, invalidateStateCache } from "./state.js";
import { deriveState } from "./state.js";
import { invalidateAllCaches } from "./cache.js";
import { startAuto } from "./auto.js";
import { readCrashLock, clearLock, formatCrashInfo } from "./crash-recovery.js";
import { listUnitRuntimeRecords, clearUnitRuntimeRecord } from "./unit-runtime.js";
@ -454,7 +455,6 @@ async function handleQueueReorder(
state: Awaited<ReturnType<typeof deriveState>>,
): Promise<void> {
const { showQueueReorder: showReorderUI } = await import("./queue-reorder-ui.js");
const { invalidateStateCache } = await import("./state.js");
const completed = state.registry
.filter(m => m.status === "complete")
@ -472,7 +472,7 @@ async function handleQueueReorder(
// Save the new order
saveQueueOrder(basePath, result.order);
invalidateStateCache();
invalidateAllCaches();
// Remove conflicting depends_on entries from CONTEXT.md files
if (result.depsToRemove.length > 0) {
@ -1018,7 +1018,7 @@ export async function showDiscuss(
// Wait for the discuss session to finish, then loop back to the picker
await ctx.waitForIdle();
invalidateStateCache();
invalidateAllCaches();
}
}