From dfc41e105de49018b2057e7c8688ac6316fe0e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=82CHES?= Date: Tue, 17 Mar 2026 17:25:59 -0600 Subject: [PATCH] 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) --- src/resources/extensions/gsd/guided-flow.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/resources/extensions/gsd/guided-flow.ts b/src/resources/extensions/gsd/guided-flow.ts index 25d4a59c3..441d4b40b 100644 --- a/src/resources/extensions/gsd/guided-flow.ts +++ b/src/resources/extensions/gsd/guided-flow.ts @@ -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>, ): Promise { 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(); } }