From 3399852f6d0a9967a532802cfd6b574ade801d23 Mon Sep 17 00:00:00 2001 From: Lex Christopherson Date: Mon, 16 Mar 2026 12:26:06 -0600 Subject: [PATCH] fix: clamp task counter to prevent "task 5/4" display after loop recovery When auto-mode loop recovery marks tasks as [x] in the plan file and auto is restarted, the done count can equal total. The display always showed done+1 (assuming "currently working on next task"), causing values like "task 5/4". Clamp to total so it never exceeds the max. Closes #662 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/resources/extensions/gsd/auto-dashboard.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/resources/extensions/gsd/auto-dashboard.ts b/src/resources/extensions/gsd/auto-dashboard.ts index 18ad2aa35..616e64229 100644 --- a/src/resources/extensions/gsd/auto-dashboard.ts +++ b/src/resources/extensions/gsd/auto-dashboard.ts @@ -340,7 +340,8 @@ export function updateProgressWidget( let meta = theme.fg("dim", `${done}/${total} slices`); if (activeSliceTasks && activeSliceTasks.total > 0) { - meta += theme.fg("dim", ` · task ${activeSliceTasks.done + 1}/${activeSliceTasks.total}`); + const taskNum = Math.min(activeSliceTasks.done + 1, activeSliceTasks.total); + meta += theme.fg("dim", ` · task ${taskNum}/${activeSliceTasks.total}`); } lines.push(truncateToWidth(`${pad}${bar} ${meta}`, width));