fix(auto): refresh progress widget from disk every 5s during unit execution (#549) (#552)

The progress bar in the auto-mode widget was snapshot-based — only
updated at dispatch time via updateSliceProgressCache(). During
long-running units (especially after the worktree architecture in
PR #506), the bar appeared frozen even as tasks completed on disk.

Add a 5-second interval inside the widget that re-reads the roadmap
and plan files from disk, so slice/task progress reflects reality
without waiting for the next unit dispatch.

Closes #549
This commit is contained in:
Flux Labs 2026-03-15 19:12:48 -05:00 committed by GitHub
parent 0c4b1614cb
commit 3101469b4d

View file

@ -265,6 +265,16 @@ export function updateProgressWidget(
tui.requestRender();
}, 800);
// Refresh progress cache from disk every 5s so the widget reflects
// task/slice completion mid-unit. Without this, the progress bar only
// updates at dispatch time, appearing frozen during long-running units.
const progressRefreshTimer = mid ? setInterval(() => {
try {
updateSliceProgressCache(accessors.getBasePath(), mid.id, slice?.id);
cachedLines = undefined;
} catch { /* non-fatal */ }
}, 5_000) : null;
return {
render(width: number): string[] {
if (cachedLines && cachedWidth === width) return cachedLines;
@ -416,6 +426,7 @@ export function updateProgressWidget(
},
dispose() {
clearInterval(pulseTimer);
if (progressRefreshTimer) clearInterval(progressRefreshTimer);
},
};
});