From 6f6ef16ee937551cbd8d6f67ff479d4870901194 Mon Sep 17 00:00:00 2001 From: Flux Labs Date: Sun, 15 Mar 2026 19:19:09 -0500 Subject: [PATCH] fix(undo): use invalidateAllCaches to prevent stale state after undo (#556) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After deleting summary files and modifying PLAN files, only invalidateStateCache() was called. Path and parse caches remained stale, causing deriveState() to return incorrect results — showing undone tasks as still complete. --- src/resources/extensions/gsd/undo.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/resources/extensions/gsd/undo.ts b/src/resources/extensions/gsd/undo.ts index 41b909e37..dcf4b1f99 100644 --- a/src/resources/extensions/gsd/undo.ts +++ b/src/resources/extensions/gsd/undo.ts @@ -6,7 +6,8 @@ import type { ExtensionCommandContext, ExtensionAPI } from "@gsd/pi-coding-agent import { existsSync, readFileSync, writeFileSync, unlinkSync, readdirSync } from "node:fs"; import { join } from "node:path"; import { execFileSync } from "node:child_process"; -import { deriveState, invalidateStateCache } from "./state.js"; +import { deriveState } from "./state.js"; +import { invalidateAllCaches } from "./cache.js"; import { gsdRoot, resolveTasksDir, resolveSlicePath, buildTaskFileName } from "./paths.js"; import { sendDesktopNotification } from "./notifications.js"; @@ -118,7 +119,7 @@ export async function handleUndo(args: string, ctx: ExtensionCommandContext, _pi } // 6. Re-derive state - invalidateStateCache(); + invalidateAllCaches(); await deriveState(basePath); // Build result message