Repository navigation
feat(desktop): offer the OpenCode 2 upgrade - #64153
Merged
Merged
Conversation
Copy the TUI's /update flow into the desktop app. Once OpenCode 1 is up to date, the app offers OpenCode 2.0 in a dialog with the TUI's words and its Dismiss and Upgrade choices. Dismiss hides the offer for 7 days. Upgrade downloads OpenCode 2 through a second updater that reads the OpenCode 2 feed, and Restart installs it over OpenCode 1.
Replace the two-step offer. OpenCode 2 now downloads in the background once OpenCode 1 is up to date, the way an OpenCode 1 update does. The offer opens only when the download is done, and only right after the app starts. Restart to upgrade installs at once, Upgrade on quit installs when the app quits, and Later hides the offer for 7 days.
The v1 pipeline builds the desktop app for release only, so the beta feed could never be reached.
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Five rows name what OpenCode 2 adds. The config row is gone.
The OpenCode 2 updater downloads into its own cache folder, is built on the first OpenCode 2 check, never allows a downgrade and only offers a version with major 2 or higher. An OpenCode 1 release cancels an OpenCode 2 download and waits for it to end before its own download starts. Restart to upgrade and Upgrade on quit now have installing and scheduling states, run once, and report an installer that could not start. On macOS both wait until Squirrel has staged OpenCode 2 before the servers stop or the choice is confirmed. Packages that install behind a password prompt offer a restart only. The launch window for the offer is measured once in the main process, and a check the user asked for waits for an OpenCode 2 download in flight.
Deferred promises hold a download, a feed answer, a stop or an arming open, so each race is replayed in a fixed order: an OpenCode 1 release found while OpenCode 2 downloads, upgrade on quit chosen while a check is in flight, restart called twice, restart with a failing stage, stop or installer, the version guard, and the launch window measured once for the whole app.
With Upgrade on quit armed on Windows or Linux, the quit waits once until the servers have stopped, because the installer starts the moment the app has quit. Every other quit, and macOS, is unchanged.
On macOS, Check for Updates with every window closed found no window to send the command to. It now restores a window, which asks the updater as it starts and opens the offer itself.
Focus no longer starts on a button that installs, so a key press meant for the prompt cannot restart the app. The card shows the installing and scheduling states with its buttons disabled, hides Upgrade on quit where the package cannot do it, wraps its footer for long translations and drops the image in a narrow window. The main process now decides whether a window opens the offer by itself, so a window that opens, reloads or changes layout later does not. The offer gives way to release notes for an OpenCode 1 update and to any dialog already open, and is checked again after the image has decoded. The failure toast can open the install instructions, and offers a restart when the servers were already stopped.
Check now reads Downloading while OpenCode 2 downloads, and the check waits for that download before it answers. The offer then opens over Settings instead of replacing it.
The legacy titlebar has no update pill, so after the launch window nothing led to the offer. The update toast of that layout now also leads to it, with strings that already exist.
3 of 6 tasks
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.
Issue for this PR
No linked issue. OpenCode 1 desktop has no path to OpenCode 2 today; the TUI got one in #54409.
Type of change
What does this PR do?
OpenCode 1 desktop now offers OpenCode 2.0, the desktop counterpart of
/updatein the TUI.OpenCode 2 desktop keeps the app ID and the signing identity, so its installer replaces OpenCode 1 in place. OpenCode 1 reads GitHub releases and OpenCode 2 publishes to its own feed, so the offer uses a second updater:
<updaterCacheDirName>-major.On macOS only Squirrel can install, and it first fetches and verifies the archive. Both actions wait for Squirrel, so the card never confirms an upgrade that is not staged, and the servers stop only when the install can start:
The card never focuses an action that installs, so a key press meant for the prompt cannot start an upgrade.
.deb,.rpmand pacman installs offer a restart only, because their password prompt must not appear after the windows have closed.How did you verify your code works?
Each run used the released 1.19.5 app with this branch's JavaScript (Windows: an unsigned build of this branch) against the live OpenCode 2.3.0 feed.
.deb, Debian 13 under WSL.rpmand pacman, Intel Macs, and whether OpenCode 2 reopens by itself after the.debinstall.Screenshots / recordings
Restart to upgrade, recorded with a simulated updater:
restart-to-upgrade.mp4
Checklist