Repository navigation
feat(desktop): honor OPENCODE_DISABLE_AUTOUPDATE in the updater - #55155
carterworks wants to merge 3 commits into
Conversation
Third-party packagers (Nix, AUR, Homebrew) ship their own desktop build and need the bundled updater to leave the package-managed install alone. The updater read only the compiled channel, so a repackaged release always ran automatic checks and could offer a release the package did not install. Gate the updater on the same OPENCODE_DISABLE_AUTOUPDATE variable the CLI already honors. When it is set the updater reports the disabled state and the Check for updates menu item stays unavailable.
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
The change looks correct. I read through the disabled path: when updaterEnabled returns false, the electron-updater platform is never loaded, the state machine starts disabled, and the menu item stays unavailable. That is the same path dev-channel builds already take. The updater tests in packages/gui-extensions pass (19, including the new ones), and so does typecheck. I couldn't run a packaged Electron build here, so this isn't verified end to end.
Public API: the desktop main process now reads the existing OPENCODE_DISABLE_AUTOUPDATE environment variable (1/true, case-insensitive), with the same parsing as the CLI. This is backwards compatible. The only behaviour change: users who set the variable only for the CLI will now also stop getting desktop update checks.
One gap: the repo's own Nix package doesn't set the variable yet. The makeWrapper call in nix/desktop.nix has no --set OPENCODE_DISABLE_AUTOUPDATE 1, so the Nix desktop build from #52122 still runs the production updater after this PR. Adding that flag to the wrapper here would fix that issue in the same change. It may also be worth noting in the env var's docs that it now applies to the desktop app too.
The desktop derivation wraps the packaged app but left the bundled updater armed, so a Nix install could be replaced by the production update feed (anomalyco#52122). Set OPENCODE_DISABLE_AUTOUPDATE in the wrapper on Linux and macOS so the updater leaves the Nix-managed install alone.
The variable also disables the desktop app updater now, not just the CLI's own check, so say so in the environment variable table.
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #52122
Refs #41329, #54022
Type of change
What does this PR do?
Third-party packagers (Nix, AUR, Homebrew) ship their own desktop build from the released binary, but the bundled updater only checked the compiled channel. A repackaged release is always the
prodchannel, so it still ran automatic update checks and could offer a release the package did not install.autoupdate: falsein config does not apply to the desktop app.This gates the desktop updater on
OPENCODE_DISABLE_AUTOUPDATE, the variable the CLI already honors, so one setting disables updates for both. When it is set, the updater starts in itsdisabledstate — no automatic check at startup, no ten-minute re-check, and the Check for updates menu item stays unavailable — matchingdev-channel behavior.The decision moves to
updaterEnabledinpackages/gui-extensions/src/updater/enabled.tsso the packager-facing contract is unit-testable.The repo's own Nix desktop derivation now passes
--set OPENCODE_DISABLE_AUTOUPDATE 1to its Linux and macOS wrappers, so a Nix install no longer arms the production updater (#52122). The environment variable table also notes that the variable covers the desktop app.How did you verify your code works?
bun test src/updater/enabled.test.ts(9 cases) inpackages/gui-extensionsbun typecheckinpackages/gui-extensionsbun run lint:changednix-instantiate --parse nix/desktop.nixprettier --check packages/web/src/content/docs/cli.mdxScreenshots / recordings
Not a visual change.
Checklist