Skip to content

Fix auto update#3278

Merged
Kitenite merged 1 commit into
mainfrom
fix-autoupdate-crash
Apr 8, 2026
Merged

Fix auto update#3278
Kitenite merged 1 commit into
mainfrom
fix-autoupdate-crash

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Apr 8, 2026

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes


Summary by cubic

Fixes a crash during auto-update by removing the forced immediate exit and skipping quit confirmation so autoUpdater.quitAndInstall can restart the app cleanly.

  • Bug Fixes
    • Call setSkipQuitConfirmation() before quitAndInstall to avoid quit prompts.
    • Remove the forced exit after quitAndInstall, preventing macOS crashes/hangs.
    • Minor import cleanup in auto-updater.ts.

Written for commit 427076c. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Improved update installation handling to ensure proper application shutdown during updates. The update process now uses a more reliable confirmation mechanism, eliminating a workaround previously needed for consistent behavior.

@Kitenite Kitenite merged commit 1298392 into main Apr 8, 2026
4 of 7 checks passed
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 8, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: daf8e272-0a22-42bc-b484-f8c34ad24be2

📥 Commits

Reviewing files that changed from the base of the PR and between 82236fa and 427076c.

📒 Files selected for processing (1)
  • apps/desktop/src/main/lib/auto-updater.ts

📝 Walkthrough

Walkthrough

The auto-updater module in the desktop app was updated to replace the direct app termination mechanism with a new quit flow. The change introduces a call to setSkipQuitConfirmation() before triggering autoUpdater.quitAndInstall(), removes the prior forced-exit path, and updates related imports.

Changes

Cohort / File(s) Summary
Auto-updater Quit Flow
apps/desktop/src/main/lib/auto-updater.ts
Updated imports to include BrowserWindow and replace exitImmediately with quitApp; added setSkipQuitConfirmation() call before autoUpdater.quitAndInstall() and removed forced termination logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 When updates arrive with a gentle breeze,
No force-quit crashes in our trees,
A polished flow, so clean and right,
The app bids farewell with grace and light!
Hops away satisfied

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-autoupdate-crash

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 8, 2026

Greptile Summary

This PR refactors installUpdate() in the desktop auto-updater to replace the forced exitImmediately() (which bypassed all before-quit handlers) with a graceful quit flow by calling setSkipQuitConfirmation() before autoUpdater.quitAndInstall(). The goal is to allow the normal quit path to run (e.g. service cleanup) while still skipping the user-facing quit-confirmation dialog.

Key changes:

  • exitImmediately import swapped for quitApp (though quitApp itself is not used in installUpdate)
  • setSkipQuitConfirmation() called before quitAndInstallbut this function is never defined or imported, causing a ReferenceError at runtime every time a user installs an update
  • BrowserWindow added to the electron import but is unused anywhere in the file

Confidence Score: 1/5

Not safe to merge — installUpdate() will throw a ReferenceError at runtime, completely breaking the update install flow for all users.

setSkipQuitConfirmation is called in the critical installUpdate() path but is undefined everywhere in the codebase. This is a guaranteed runtime crash on the primary user path of this feature. The fix requires exporting a new helper from main/index.ts and importing it here.

apps/desktop/src/main/lib/auto-updater.ts (line 94) and apps/desktop/src/main/index.ts (needs a new exported setSkipQuitConfirmation function).

Vulnerabilities

No security concerns identified.

Important Files Changed

Filename Overview
apps/desktop/src/main/lib/auto-updater.ts Replaces forced exitImmediately() with setSkipQuitConfirmation() before quitAndInstall, but setSkipQuitConfirmation is never defined or imported — causes a ReferenceError at runtime; also adds an unused BrowserWindow import.

Sequence Diagram

sequenceDiagram
    participant UI as Renderer
    participant AU as auto-updater.ts
    participant Index as main/index.ts
    participant EU as electron-updater

    UI->>AU: installUpdate()
    AU->>AU: setSkipQuitConfirmation() ❌ ReferenceError
    Note over AU: Function not defined — throws here
    AU--xEU: quitAndInstall() never reached
    Note over Index: skipQuitConfirmation flag never set
    Note over Index: before-quit confirmation dialog would block quit anyway
Loading

Reviews (1): Last reviewed commit: "Save" | Re-trigger Greptile

emitStatus(AUTO_UPDATE_STATUS.IDLE);
return;
}
setSkipQuitConfirmation();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 setSkipQuitConfirmation is undefined — will throw ReferenceError at runtime

setSkipQuitConfirmation is called here but is never defined in this file and is not imported from anywhere. The only reference to it in the entire codebase is this call site (apps/desktop/src/main/lib/auto-updater.ts:94), meaning installUpdate() will throw a ReferenceError every time a user tries to install an update.

In apps/desktop/src/main/index.ts (line 154) there is a module-level skipQuitConfirmation variable that quitApp() sets to true before calling app.quit(). The intent here appears to be skipping the quit-confirmation dialog so autoUpdater.quitAndInstall() can proceed unblocked. The missing piece is a dedicated exported setter in main/index.ts:

// In apps/desktop/src/main/index.ts — add and export this function
export function setSkipQuitConfirmation(): void {
    skipQuitConfirmation = true;
}

Then import it in auto-updater.ts:

import { quitApp, setSkipQuitConfirmation } from "main/index";

Without this fix the update install path is completely broken.

@@ -1,8 +1,8 @@
import { EventEmitter } from "node:events";
import { app, dialog } from "electron";
import { BrowserWindow, app, dialog } from "electron";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Unused BrowserWindow import

BrowserWindow was added to the import on this line but is never referenced anywhere in the file. This will likely trigger a lint/compiler warning and should be removed.

Suggested change
import { BrowserWindow, app, dialog } from "electron";
import { app, dialog } from "electron";

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.

1 participant