Skip to content

Conversation

@charlesvien
Copy link
Contributor

@charlesvien charlesvien commented Jan 17, 2026

Alright here's what I found in the cave...

context: the auto updater seems to be broken because the before-quit event handler unconditionally called event.preventDefault() followed by app.exit(0) to perform cleanup.

the bug: when autoUpdater.quitAndInstall() was invoked, it triggered the before-quit event, but the handler would intercept it, prevent the default behavior, and forcibly exit the app before the updater could complete its installation flow.

solution: this PR introduces a new AppLifecycleService that centralizes all shutdown logic and tracks an isQuittingForUpdate flag. Now when installing an update, the UpdatesService first calls lifecycleService.shutdown() to gracefully clean up, then sets lifecycleService.setQuittingForUpdate() before calling quitAndInstall(). The before-quit handler now checks this flag and returns early if set, allowing the auto updater to proceed unblocked. This separates the "normal quit with cleanup" path from the "quit for update" path

NOTE: There is a different event sequence for quitAndInstall()

Excerpt taken from electron docs

The Event Sequence for quitAndInstall()

Normal quit:

  1. before-quit emitted
  2. Windows receive close events
  3. Windows close
  4. will-quit emitted
  5. App exits

quitAndInstall() sequence (different!):

  1. All windows receive close events first
  2. Windows close
  3. before-quit emitted after windows are closed
  4. Installer runs

@charlesvien charlesvien changed the title Implement AppLifecycleService and refactor to fix auto updater feat: Implement AppLifecycleService and refactor to fix auto updater Jan 17, 2026
Copy link
Contributor Author

charlesvien commented Jan 17, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@charlesvien charlesvien changed the title feat: Implement AppLifecycleService and refactor to fix auto updater feat: Implement AppLifecycleService and refactor to fix auto updater Jan 17, 2026
@charlesvien charlesvien changed the base branch from main to graphite-base/530 January 17, 2026 08:44
@charlesvien charlesvien force-pushed the 01-16-implement_applifecycleservice_and_refactor_to_fix_auto_updater branch from 4d88993 to 3bde2b0 Compare January 17, 2026 08:44
@charlesvien charlesvien changed the base branch from graphite-base/530 to 01-17-fix_ci_cd_pipeline_trying_to_double_release_on_commits_to_main January 17, 2026 08:44
@charlesvien charlesvien force-pushed the 01-17-fix_ci_cd_pipeline_trying_to_double_release_on_commits_to_main branch from 4d87684 to feb4482 Compare January 17, 2026 21:37
Base automatically changed from 01-17-fix_ci_cd_pipeline_trying_to_double_release_on_commits_to_main to main January 17, 2026 22:51
@charlesvien charlesvien changed the base branch from main to graphite-base/530 January 17, 2026 22:59
@charlesvien charlesvien force-pushed the 01-16-implement_applifecycleservice_and_refactor_to_fix_auto_updater branch from 3bde2b0 to 7b678df Compare January 17, 2026 22:59
@charlesvien charlesvien changed the base branch from graphite-base/530 to 01-17-configure_the_git_identity_in_the_new_tag_workflow January 17, 2026 22:59
Base automatically changed from 01-17-configure_the_git_identity_in_the_new_tag_workflow to main January 18, 2026 03:18
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