From fd3ec8707cde372b76689eadb4eb09af2c28216e Mon Sep 17 00:00:00 2001 From: AgentSeal Date: Thu, 9 Jul 2026 22:27:44 +0200 Subject: [PATCH] fix(menubar): manual cadence never respawns from stuck-refresh cleanup Stale-force or stale-loading recovery could set shouldForceRefresh even with a nil interval, so Manual mode (and its wake path) still spawned after a stuck fetch. Cleanup now clears state without respawning unless the cadence allows auto-spawns; the next user interaction fetches. Refs #647 --- mac/Sources/CodeBurnMenubar/CodeBurnApp.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift b/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift index d9fa89eb..d6a34d68 100644 --- a/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift +++ b/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift @@ -573,9 +573,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate { // and never auto-spawning in Manual (#647). let interval = currentRefreshInterval() let intervalElapsed = interval.map { sinceLast >= $0 } ?? false + // Stuck-refresh cleanup may retrigger a spawn only when the cadence + // allows auto-spawns at all: in Manual mode the stale state is + // cleared and the next user interaction fetches fresh. + let recoveryRespawnAllowed = interval != nil let shouldForceRefresh = forcePayload || - clearedStaleForceRefresh || - clearedStaleLoading || + ((clearedStaleForceRefresh || clearedStaleLoading) && recoveryRespawnAllowed) || intervalElapsed if shouldForceRefresh {