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 <lawrencecchen@users.noreply.github.com>
This commit is contained in:
Lawrence Chen 2026-03-25 16:55:29 -07:00 committed by GitHub
parent cbf08459d6
commit b42f64fbe3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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