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) <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson 2026-03-16 12:26:06 -06:00
parent 2966be30cb
commit 3399852f6d

View file

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