Skip to content

feat(desktop): offer the OpenCode 2 upgrade - #64153

Open
Hona wants to merge 8 commits into
anomalyco:v1from
Hona:desktop-v2-upgrade
Open

Hona wants to merge 8 commits into
anomalyco:v1from
Hona:desktop-v2-upgrade

Conversation

@Hona

@Hona Hona commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

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

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

OpenCode 1 desktop now offers OpenCode 2.0, the desktop counterpart of /update in the TUI.

  • OpenCode 2 downloads in the background once OpenCode 1 is on its newest release, the way a 1.x update already downloads. A newer 1.x release still comes first.
  • Nothing installs until the user chooses: Restart to upgrade, Upgrade on quit, or Later (hidden for 7 days, like Dismiss in the TUI).
  • The card names what OpenCode 2 adds, what it keeps, and the one thing that breaks: plugins made for OpenCode 1.
  • The card opens by itself once per launch, and only right after the app starts. After that it is one click away on the titlebar update pill, in Check for updates, and in the command palette.
  • A failed download stays quiet and is retried at the next 10 minute check.
stateDiagram-v2
  [*] --> unavailable
  unavailable --> downloading: OpenCode 1 is up to date
  downloading --> ready: OpenCode 2 downloaded
  downloading --> unavailable: download failed
  ready --> unavailable: newer 1.x release found
  ready --> scheduled: Upgrade on quit
  ready --> [*]: Restart to upgrade
  scheduled --> [*]: app quits
Loading

OpenCode 2 desktop keeps the app ID, 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. The OpenCode 1 updater never sees the OpenCode 2 feed:

// packages/desktop/src/main/updater.ts
const MAJOR_FEED = "https://opencode.ai/update/api/latest/desktop/opencode/"

function majorUpdater() {
  // autoUpdater is already the right updater for this platform and package type.
  const Updater = autoUpdater.constructor as new (options: { provider: "generic"; url: string }) => AppUpdater
  const updater = new Updater({ provider: "generic", url: MAJOR_FEED })
  updater.autoDownload = false
  updater.autoInstallOnAppQuit = false
  return updater
}

Upgrade on quit arms electron-updater after the fact. It only registers its quit handler when a download finishes, so the cached installer is "downloaded" again, which returns at once:

installOnQuit: () => {
  updater.autoInstallOnAppQuit = true
  return updater.downloadUpdate()
},

How did you verify your code works?

  • Packaged this branch as an unsigned 1.19.5 Windows build and ran it in Windows Sandbox against the live feeds. Restart to upgrade closed OpenCode 1 and OpenCode 2.3.0 was running 16 seconds later, with the old app's stores imported.
  • Not verified end to end: Upgrade on quit, macOS, and Linux. macOS needs a signed build, because Squirrel only installs over an app with the same signature.
  • The card strings are translated for all 61 locales by agents and matched to each locale's existing terms. No native speaker has reviewed them.

Screenshots / recordings

Before After
No offer. OpenCode 1 desktop stays on 1.x. The OpenCode 2.0 offer

Restart to upgrade, recorded with a simulated updater:

restart-to-upgrade.mp4

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Hona added 4 commits November 13, 2026 08:33
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.
@Hona
Hona requested a review from Brendonovich as a code owner November 16, 2026 03:12
Copilot AI balanced review requested due to automatic review settings November 16, 2026 03:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants