Skip to content

Commit 92dd149

Browse files
committed
🔧 improve step status tracking logic in findNextPending function
1 parent 7426b19 commit 92dd149

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/extension.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -607,12 +607,13 @@ function parseState(statePath: string): TrackedStep[] {
607607
}
608608

609609
function findNextPending(tracked: TrackedStep[]): TrackedStep | null {
610-
// First, check if any step is in-progress (resume it)
611-
const inProgress = tracked.find(s => s.status === 'in-progress');
612-
if (inProgress) { return inProgress; }
610+
// Sort by step ID so we always scan from Step 1 upward
611+
const sorted = [...tracked].sort((a, b) => a.id - b.id);
613612

614-
// Then find the first pending step
615-
return tracked.find(s => s.status === 'pending') || null;
613+
// Walk through every step in order and return the first one that
614+
// is NOT done and NOT skipped. This catches earlier steps that were
615+
// missed even if later steps are already complete.
616+
return sorted.find(s => s.status !== 'done' && s.status !== 'skipped') || null;
616617
}
617618

618619
function updateStepStatus(statePath: string, stepId: number, status: StepStatus, notes: string): void {

0 commit comments

Comments
 (0)