From 96ced0357b2d0b1fa36b7e4531c805e75dd0b5a1 Mon Sep 17 00:00:00 2001 From: Flux Labs Date: Sat, 14 Mar 2026 21:48:43 -0500 Subject: [PATCH] fix: clear cachedReaddir before dispatch and artifact verification (#431) (#432) The directory listing cache in paths.ts has no TTL and was never cleared in production, causing dispatchNextUnit to re-dispatch the same unit when files written by the previous unit weren't visible to deriveState. Add clearPathCache() calls at the top of dispatchNextUnit (before deriveState) and verifyExpectedArtifact so each dispatch cycle and artifact check sees fresh disk state. Closes #431 --- src/resources/extensions/gsd/auto.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/resources/extensions/gsd/auto.ts b/src/resources/extensions/gsd/auto.ts index 49796d01a..405944d7c 100644 --- a/src/resources/extensions/gsd/auto.ts +++ b/src/resources/extensions/gsd/auto.ts @@ -1380,6 +1380,9 @@ async function dispatchNextUnit( return; } + // Clear stale directory listing cache so deriveState sees fresh disk state (#431) + clearPathCache(); + let state = await deriveState(basePath); let mid = state.activeMilestone?.id; let midTitle = state.activeMilestone?.title; @@ -3555,6 +3558,9 @@ export function resolveExpectedArtifactPath(unitType: string, unitId: string, ba * skipped writing the UAT file (see #176). */ export function verifyExpectedArtifact(unitType: string, unitId: string, base: string): boolean { + // Clear stale directory listing cache so artifact checks see fresh disk state (#431) + clearPathCache(); + // fix-merge has no file artifact — verify by checking git state if (unitType === "fix-merge") { const unmerged = runGit(base, ["diff", "--name-only", "--diff-filter=U"], { allowFailure: true });