Skip to content

fix(desktop): install the latest available update#27953

Open
Hona wants to merge 5 commits into
devfrom
fix/desktop-updater-recheck-latest
Open

fix(desktop): install the latest available update#27953
Hona wants to merge 5 commits into
devfrom
fix/desktop-updater-recheck-latest

Conversation

@Hona
Copy link
Copy Markdown
Member

@Hona Hona commented May 17, 2026

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:

  • bun typecheck in packages/desktop
  • push hook: bun turbo typecheck

@Hona Hona requested a review from adamdotdevin as a code owner May 17, 2026 00:14
Copilot AI review requested due to automatic review settings May 17, 2026 00:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 downloadedUpdateVersion while 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,
@Hona Hona changed the title fix(desktop): recheck latest update before download fix(desktop): install the latest available update May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants