fix(desktop): install the latest available update#27953
Open
Hona wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the Desktop auto-updater flow so that update availability is determined from freshly fetched updater metadata rather than an in-memory “downloaded update” cache, while still tracking the downloaded version for install readiness/logging.
Changes:
- Remove the early return that reported an update as available solely because a version was previously downloaded in-memory.
- Add logging to include the currently cached
downloadedUpdateVersionwhile performing a live update check.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
27
to
34
| export async function checkUpdate() { | ||
| if (!UPDATER_ENABLED) return { updateAvailable: false } | ||
| if (downloadedUpdateVersion) { | ||
| logger.log("returning cached downloaded update", { | ||
| version: downloadedUpdateVersion, | ||
| }) | ||
| return { updateAvailable: true, version: downloadedUpdateVersion } | ||
| } | ||
| logger.log("checking for updates", { | ||
| currentVersion: app.getVersion(), | ||
| downloadedUpdateVersion: downloadedUpdateVersion ?? null, | ||
| channel: autoUpdater.channel, | ||
| allowPrerelease: autoUpdater.allowPrerelease, | ||
| allowDowngrade: autoUpdater.allowDowngrade, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Desktop updates could previously download one version, keep that downloaded version in memory, and later install it even if a newer release had appeared. This was especially easy to hit on beta builds where releases can happen quickly: the startup poll downloads update A, the user waits, update B ships, then clicking install still applies A. After relaunch, the app would correctly say another update is available, which makes the updater feel like it did not actually update to latest.
This changes the updater flow so the install path is tied to a fresh update check instead of our own cached version string. Checking for updates now always asks the provider for current metadata. Installing also performs that check first, downloads/validates the update that provider currently reports, and only then calls quitAndInstall. That means an old toast/action cannot install stale in-memory state; the app should install the latest available update at the moment the user chooses to update.
The implementation deliberately removes the local downloadedUpdateVersion cache rather than adding more state around it. electron-updater already owns the downloaded-file cache and validates matching update files, so keeping a second version cache in our code was the source of the stale install behavior.
Verification: