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
This commit is contained in:
Flux Labs 2026-03-14 21:48:43 -05:00 committed by GitHub
parent cad9971f9f
commit 96ced0357b

View file

@ -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 });