From b42f64fbe3ef2acb4d92a0a55e44009d4af5bed4 Mon Sep 17 00:00:00 2001 From: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com> Date: Wed, 25 Mar 2026 16:55:29 -0700 Subject: [PATCH] Fix update attempt refreshing pill without actually updating (#2168) * Fix update attempt refreshing pill without actually updating The attemptUpdate() subscriber watched for .updateAvailable state to auto-confirm, but showUpdateFound used setStateAfterMinimumCheckDelay which delays the transition by up to 2 seconds. During that window, dismissUpdateInstallation (from a background probe race) could cancel the pending transition, reverting state to idle without ever confirming. The subscriber then tore down on the transient idle, silently abandoning the update. Fix: move auto-confirm to the Sparkle driver level via an autoInstallOnNextUpdate flag. When set, showUpdateFound immediately calls reply(.install) bypassing the delay entirely. The subscriber is kept as a fallback but no longer tears down on transient idle while the flag is active. Closes https://github.com/manaflow-ai/cmux/issues/2166 * Revert "Fix update attempt refreshing pill without actually updating" This reverts commit 1cd842dd924bf114b096f222851c47d2e36ad4d9. * Fix update attempt refreshing pill without actually updating The attemptUpdate() subscriber tore down monitoring whenever it saw .idle after observing progress. During check startup (retry loop, background probe race), state can transiently return to .idle before Sparkle's interactive check begins. The subscriber interpreted this as "check completed" and stopped monitoring, so the auto-confirm for .updateAvailable never fired. Fix: add !state.isIdle to the teardown guard so monitoring only stops on terminal failures (.notFound, .error), not transient idle. Closes https://github.com/manaflow-ai/cmux/issues/2166 --------- Co-authored-by: Lawrence Chen --- Sources/Update/UpdateController.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/Update/UpdateController.swift b/Sources/Update/UpdateController.swift index c5fd4ad0..4fb5b31d 100644 --- a/Sources/Update/UpdateController.swift +++ b/Sources/Update/UpdateController.swift @@ -193,7 +193,10 @@ class UpdateController { return } - guard self.didObserveAttemptUpdateProgress, !state.isInstallable else { + // Only stop on terminal failure states (.notFound, .error). + // Don't stop on .idle — the check may still be starting up + // (e.g. retry loop, background probe finishing). + guard self.didObserveAttemptUpdateProgress, !state.isInstallable, !state.isIdle else { return } self.stopAttemptUpdateMonitoring()