From c66ad3485e543b36ce5a8567298f9aa57a8e9775 Mon Sep 17 00:00:00 2001 From: Jeremy McSpadden Date: Tue, 17 Mar 2026 09:20:24 -0500 Subject: [PATCH] fix: add replan-slice artifact verification to break infinite replanning-slice loop (#858) (#865) --- src/resources/extensions/gsd/auto-recovery.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/resources/extensions/gsd/auto-recovery.ts b/src/resources/extensions/gsd/auto-recovery.ts index 9d9372c2f..46f9d6b44 100644 --- a/src/resources/extensions/gsd/auto-recovery.ts +++ b/src/resources/extensions/gsd/auto-recovery.ts @@ -90,6 +90,10 @@ export function resolveExpectedArtifactPath(unitType: string, unitId: string, ba const dir = resolveMilestonePath(base, mid); return dir ? join(dir, buildMilestoneFileName(mid, "SUMMARY")) : null; } + case "replan-slice": { + const dir = resolveSlicePath(base, mid, sid!); + return dir ? join(dir, buildSliceFileName(sid!, "REPLAN")) : null; + } case "rewrite-docs": return null; default: @@ -127,10 +131,9 @@ export function verifyExpectedArtifact(unitType: string, unitId: string, base: s } const absPath = resolveExpectedArtifactPath(unitType, unitId, base); - // Unit types with no verifiable artifact always pass (e.g. replan-slice). - // For all other types, null means the parent directory is missing on disk - // — treat as stale completion state so the key gets evicted (#313). - if (!absPath) return unitType === "replan-slice"; + // For unit types with no verifiable artifact (null path), the parent directory + // is missing on disk — treat as stale completion state so the key gets evicted (#313). + if (!absPath) return false; if (!existsSync(absPath)) return false; // plan-slice must produce a plan with actual task entries, not just a scaffold.