Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Related but different: #31487 (quitting from the menu discards a downloaded update, so the same version is offered again) and #32554 (an update that was already applied is reinstalled on relaunch). Here the install succeeds, but the build it installs had already been replaced by a newer one when I clicked.
Area
apps/desktop
Steps to reproduce
- On the nightly channel, keep the desktop app open. It checks for updates 15 s after launch and then every 4 hours (
AUTO_UPDATE_POLL_INTERVAL), and shows an update offer when it finds one. - A new nightly is published after the last check but before the next one. Nightlies currently come out about every 6.5 hours, so this happens often.
- Click the sidebar update pill to download, then restart and install.
- After the relaunch, the startup check offers the newer nightly, so you download and restart a second time.
Expected behavior
Starting an update installs the newest build available at that moment: one click, one restart, and you're up to date.
Actual behavior
The app downloads and installs whatever version the last background check found, and that check can be up to 4 hours old. If a newer nightly came out since then, the app restarts into an outdated build and offers another update within seconds of relaunching.
From the source (main @ 6b7027b):
apps/desktop/src/updates/DesktopUpdates.tsturns automatic downloads off (setAutoDownload(false)) and checks only 15 s after launch and then everyAUTO_UPDATE_POLL_INTERVAL = "4 hours".- The pill's download action (
SidebarUpdatePill.tsx:downloadLocalUpdatecallsbridge.downloadUpdate()) doesn't check first.downloadAvailableUpdatecallselectronUpdater.downloadUpdatedirectly, which downloads whatever electron-updater's lastcheckForUpdatesresult held. installDownloadedUpdatedoesn't check either. A build downloaded hours ago gets installed as-is, unless a 4-hour poll replaced it in the meantime.
With checks every 4 hours and nightlies about every 6.5 hours, the last check is on average about 2 hours old when you click. A click at a random moment downloads an outdated build roughly a third of the time.
The remote update flow already avoids this: in the logs below, a remote-update check runs right before its download.
Impact
Minor bug or occasional failure
Version or commit
0.1.10-nightly.20261116.4761 (also seen on 0.1.10-nightly.20261113.4656)
Environment
Windows 11 Pro, T3 Code (Nightly) desktop app, nightly channel. Seen on Windows; the code path is the same on every platform.
Logs or stack traces
# desktop.trace.ndjson, summarised. Times in UTC; publish times from GitHub releases.
# Case 1: two downloads and two restarts in 5 minutes
2026-11-15 19:59:11 checkForUpdates (poll) update available 0.1.10-nightly.20261115.4749
2026-11-15 23:59:11 checkForUpdates (poll) 4749 still the newest; offer unchanged
2026-11-16 01:26:07 v0.1.10-nightly.20261116.4761 published
2026-11-16 02:59:41 downloadAvailableUpdate downloading update # no check first
2026-11-16 03:02:21 applyUpdateDownloaded update downloaded 4749 # already outdated
2026-11-16 03:02:26 install -> before-quit -> relaunch
2026-11-16 03:03:05 checkForUpdates (startup) update available 0.1.10-nightly.20261116.4761
2026-11-16 03:04:13 downloadAvailableUpdate downloading update
2026-11-16 03:06:57 applyUpdateDownloaded update downloaded 4761
2026-11-16 03:07:02 install -> before-quit -> relaunch # second restart
# Case 2
2026-11-14 03:48:27 v0.1.10-nightly.20261114.4669 published
2026-11-14 03:54:44 downloadAvailableUpdate downloading update # no check first
2026-11-14 03:57:52 applyUpdateDownloaded update downloaded 0.1.10-nightly.20261113.4656
2026-11-14 03:57:57 install -> before-quit -> relaunch
2026-11-14 03:58:43 checkForUpdates (startup) update available 0.1.10-nightly.20261114.4669
2026-11-14 04:07:28 downloadAvailableUpdate downloading update
2026-11-14 04:09:49 install -> before-quit -> relaunch
# For comparison: the remote update flow checks right before it downloads
2026-11-15 00:08:29 checkForUpdates (remote-update)
2026-11-15 00:08:31 update available 0.1.10-nightly.20261114.4709, downloading updateWorkaround
Run a manual update check right before you download. Or, after the update relaunches, wait about 15 s for the startup check and update again.
Suggested fix
- In
downloadAvailableUpdate, runcheckForUpdatesunder the same reservation (the"held"mode channel changes already use) before callingelectronUpdater.downloadUpdate, and download whatever is offered after that check. If the check fails (for example, offline), fall back to downloading the known offer. - Do the same before
installDownloadedUpdatecallsquitAndInstall. If a newer build turns up, download that instead of restarting into the outdated one, or tell the user and let them choose. - Checking for updates more often would make this rarer, but checking when the user starts an update fixes it however often the background check runs.
Activity