Skip to content

feat(desktop): honor OPENCODE_DISABLE_AUTOUPDATE in the updater - #55155

Closed
carterworks wants to merge 3 commits into
anomalyco:devfrom
carterworks:desktop-disable-autoupdate
Closed

carterworks wants to merge 3 commits into
anomalyco:devfrom
carterworks:desktop-disable-autoupdate

Conversation

@carterworks

@carterworks carterworks commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #52122
Refs #41329, #54022

Type of change

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

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 prod channel, so it still ran automatic update checks and could offer a release the package did not install. autoupdate: false in 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 its disabled state — no automatic check at startup, no ten-minute re-check, and the Check for updates menu item stays unavailable — matching dev-channel behavior.

The decision moves to updaterEnabled in packages/gui-extensions/src/updater/enabled.ts so the packager-facing contract is unit-testable.

The repo's own Nix desktop derivation now passes --set OPENCODE_DISABLE_AUTOUPDATE 1 to 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) in packages/gui-extensions
  • bun typecheck in packages/gui-extensions
  • bun run lint:changed
  • nix-instantiate --parse nix/desktop.nix
  • prettier --check packages/web/src/content/docs/cli.mdx

Screenshots / recordings

Not a visual change.

Checklist

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

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.
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@opencode-agent opencode-agent Bot 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.

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.

Related: #52122, #54022, #41329

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.
@github-actions

Copy link
Copy Markdown
Contributor

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:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nix desktop arms the production auto-updater

1 participant