Skip to content

fix(updater): don't auto-install Desktop updates when the setting is off (#1104)#1127

Open
Kosinkadink wants to merge 3 commits into
mainfrom
fix/respect-auto-install-updates-setting
Open

fix(updater): don't auto-install Desktop updates when the setting is off (#1104)#1127
Kosinkadink wants to merge 3 commits into
mainfrom
fix/respect-auto-install-updates-setting

Conversation

@Kosinkadink

Copy link
Copy Markdown
Member

Summary

Fixes #1104 - "New updates still install even if the setting to automatically install Desktop updates is disabled."

The "Desktop Settings -> Updates -> Automatically install Desktop updates" setting (autoInstallUpdates) gated nothing on the install side. Even with it off, a downloaded update was still installed automatically via:

  • the Windows startup-install path (evaluateStartupInstall keyed only off installUpdatesOnStartup, never autoInstallUpdates), and
  • electron-updater's install-on-quit (autoInstallOnAppQuit, which was only suppressed for the startup-install path / OS shutdown, never for this setting).

So a user who disabled auto-install still got updates installed on next launch or on close.

Why the download still happens

ToDesktop's autoUpdater.checkForUpdates() always downloads - its UpdaterAgent.checkAndDownload() is a single atomic check-and-download with no check-only mode in the public API. Rather than bypass ToDesktop's proven detection path (which carries a real risk of missing updates), this change keeps the background download and gates only the install. The setting's label ("Automatically install...") is now literally accurate.

Changes

  • evaluateStartupInstall() - new auto_install_disabled skip reason; a staged update is never applied at startup when the setting is off. (Skip stays silent in telemetry - it's an intentional user choice, not an anomaly.)
  • syncInstallOnQuitPolicy() - single source of truth for autoInstallOnAppQuit: disabled when the startup-install path owns the install or auto-install is off; armed only on non-Windows with auto-install on. Used by register() and re-applied from notifyAutoUpdateChanged() so toggling the setting takes effect without a restart.

Resulting behavior (setting OFF)

The update still downloads in the background, then waits for the user to click the "Desktop Update Ready" title-bar pill, which triggers installUpdate() (the existing user-gated confirm -> restart-and-install flow). No install on next launch, no install on close.

Tests

Added to src/main/lib/updater.test.ts:

  • register() disables install-on-quit when auto-install is off (opted out of startup install)
  • startup install is inert when auto-install is off, even with a staged update on Windows (+ no canary telemetry)
  • installUpdate() (pill-confirm path) still installs when auto-install is off
  • toggling auto-install re-arms / disarms install-on-quit without a restart

Validation

pnpm run typecheck, pnpm run lint, pnpm run build, and pnpm run test (2223 tests) all pass.

…off (#1104)

The "Automatically install Desktop updates" setting (autoInstallUpdates)
gated nothing on the install side: a downloaded update still installed via
the Windows startup-install path or electron-updater's install-on-quit,
regardless of the setting. (ToDesktop's checkForUpdates always downloads,
so the download itself stays - only the install is now gated.)

- evaluateStartupInstall(): skip with new `auto_install_disabled` reason
  when auto-install is off, so a staged update is never applied at startup.
- syncInstallOnQuitPolicy(): single source of truth for
  autoInstallOnAppQuit - off when the startup-install path owns the install
  OR auto-install is disabled; armed only on non-Windows with auto-install
  on. Used by register() and re-applied on the autoInstallUpdates toggle so
  it takes effect without a restart.

With the setting off, a downloaded update now waits for an explicit
"Desktop Update Ready" pill click (installUpdate) instead of installing
automatically on next launch or on close.

Amp-Thread-ID: https://ampcode.com/threads/T-019ece99-2c11-75ca-bcdf-3ad07bde982b
Co-authored-by: Amp <amp@ampcode.com>
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Kosinkadink, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 11 minutes and 22 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4ad68eab-b9d1-45d7-899a-a36efd316b30

📥 Commits

Reviewing files that changed from the base of the PR and between 15d63e0 and 9c79df5.

📒 Files selected for processing (1)
  • src/main/lib/updater.test.ts
📝 Walkthrough

Walkthrough

Adds a new exported syncInstallOnQuitPolicy() function that reconciles electronAutoUpdater.autoInstallOnAppQuit based on both the startup-install setting and the autoInstallUpdates preference. Wires this into register() unconditionally and into notifyAutoUpdateChanged() so runtime setting changes take effect immediately (no install-sting required!). Extends evaluateStartupInstall() with an auto_install_disabled skip reason, and adds six regression tests covering startup, manual, dynamic toggle, and session-end suppression scenarios.

Changes

Auto-install-off policy enforcement

Layer / File(s) Summary
Install-on-quit policy reconciliation and session suppression
src/main/lib/updater.ts
Introduces session-scoped _installOnQuitSuppressedForSession flag that suppressInstallOnQuit() latches and attempts to set autoInstallOnAppQuit = false. Implements exported syncInstallOnQuitPolicy() to reconcile the flag based on session suppression, startup-install, and autoInstallUpdates settings, wrapped in try/catch. Updates register() to unconditionally call syncInstallOnQuitPolicy() instead of conditionally calling suppressInstallOnQuit().
Startup install auto_install_disabled skip reason
src/main/lib/updater.ts
Extends StartupInstallDecision.reason with auto_install_disabled enum value. Updates evaluateStartupInstall() to return an early-exit decision with that reason when startup-install is enabled but autoInstallUpdates is disabled.
notifyAutoUpdateChanged runtime setting reconciliation
src/main/lib/updater.ts
notifyAutoUpdateChanged() now calls syncInstallOnQuitPolicy() before rebroadcasting cached app-update state, so toggling the autoInstallUpdates setting immediately reconfigures install-on-quit behavior at runtime without requiring restart.
Regression tests for auto-install-off behavior
src/main/lib/updater.test.ts
Six new test cases assert: register() disables autoInstallOnAppQuit when autoInstallUpdates is false on both Windows and macOS; staged startup install remains inactive with zero startup_install_skipped telemetry; installUpdate() still triggers restartAndInstall on the manual path; notifyAutoUpdateChanged() dynamically re-arms/disarms autoInstallOnAppQuit at runtime; and suppressInstallOnQuit() prevents re-arming even if autoInstallUpdates toggles during shutdown.

Possibly related PRs

  • Comfy-Org/Comfy-Desktop#1079: Modifies the same updater.ts install-on-quit and startup-install control flow that this PR extends with autoInstallUpdates awareness.
  • Comfy-Org/Comfy-Desktop#1066: Adds the original suppressInstallOnQuit() and startup-install gating that this PR supersedes with the generalized syncInstallOnQuitPolicy().
  • Comfy-Org/Comfy-Desktop#1097: Modifies updater.ts/updater.test.ts around the same electronAutoUpdater.autoInstallOnAppQuit Windows install-on-quit control in register().

Suggested reviewers

  • deepme987
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR comprehensively addresses issue #1104 by implementing auto-install setting enforcement across startup-install and electron-updater paths, with new skip reason and policy reconciliation.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #1104: test coverage for auto-install disabling, startup-install evaluation logic, and install-on-quit policy reconciliation with session suppression.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/respect-auto-install-updates-setting
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/respect-auto-install-updates-setting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot requested a review from deepme987 June 16, 2026 06:25
…view)

Code review caught a race: syncInstallOnQuitPolicy() (now re-run on the
autoInstallUpdates toggle) could re-arm autoInstallOnAppQuit after the OS
session-end guard suppressInstallOnQuit() had disabled it, reintroducing
the mid-write install corruption during shutdown.

Latch the suppression for the life of the process: suppressInstallOnQuit()
sets a flag that syncInstallOnQuitPolicy() honors, so a settings toggle
mid-shutdown can never re-arm install-on-quit.

Tests: never re-arms after session-end suppression; macOS disables
install-on-quit when auto-install is off.

Amp-Thread-ID: https://ampcode.com/threads/T-019ece99-2c11-75ca-bcdf-3ad07bde982b
Co-authored-by: Amp <amp@ampcode.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/lib/updater.test.ts`:
- Around line 487-490: The test for the autoInstallUpdates regression is not
testing a real toggle scenario since the setting is already truthy by default.
Before the line that sets settingsStore['autoInstallUpdates'] = true, first set
it to false, then set it to true to create an actual mid-shutdown toggle. This
demonstrates that a real toggle from false to true still cannot re-arm the
install-on-quit feature. Additionally, condense the comment on the preceding
line to a single concise sentence that explains the regression test's purpose,
following the coding guideline to avoid multi-paragraph justifications for small
changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5f2baf6c-5913-49d0-b784-879de967168d

📥 Commits

Reviewing files that changed from the base of the PR and between eb23083 and 15d63e0.

📒 Files selected for processing (2)
  • src/main/lib/updater.test.ts
  • src/main/lib/updater.ts

Comment thread src/main/lib/updater.test.ts Outdated
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.

[Bug] New updates still install even if the setting to automatically install Desktop updates is disabled

1 participant