Skip to content

fix(desktop): allow updater-controlled relaunch - #4721

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
0x4bs3nt:fix/desktop-update-relaunch
Jul 28, 2026
Merged

fix(desktop): allow updater-controlled relaunch#4721
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
0x4bs3nt:fix/desktop-update-relaunch

Conversation

@0x4bs3nt

@0x4bs3nt 0x4bs3nt commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Listen for Electron’s native before-quit-for-update event.
  • Allow the subsequent updater-controlled quit to proceed without calling preventDefault().
  • Preserve the existing graceful-shutdown behavior for ordinary quits.
  • Add regression coverage for macOS, Windows, and Linux.

Why

T3 Code’s lifecycle handler cancelled every before-quit event, including quits initiated by Electron’s updater. On macOS, this interrupted the native install-and-relaunch sequence, causing “Restart to update” to close the app without reopening it.

Recognizing Electron’s dedicated update-quit signal keeps normal shutdown safeguards intact while allowing the updater to own its install and relaunch sequence.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes — not applicable
  • I included a video for animation/interaction changes — not applicable

Note

Low Risk
Small, targeted change to quit handling with platform regression tests; normal user-initiated quits still use the existing graceful shutdown path.

Overview
Fixes “Restart to update” closing the app without relaunching (especially on macOS) by not treating updater-driven quits like user quits that need graceful shutdown.

The desktop app was calling preventDefault() on every before-quit unless a normal quit had already been allowed. Electron’s updater first emits before-quit-for-update, then before-quit as part of install/relaunch—blocking that second event breaks the updater’s sequence.

ElectronApp now exposes onBeforeQuitForUpdate, a scoped subscription to autoUpdater’s before-quit-for-update (register on acquire, remove on release). DesktopLifecycle sets an updaterQuitAllowed flag when that fires so the next before-quit is allowed through without preventDefault() or the shutdown-and-retry-quit path. Ordinary quits are unchanged.

Regression tests cover scoped updater listeners, lifecycle behavior on darwin/win32/linux, and test doubles for the new service method.

Reviewed by Cursor Bugbot for commit bed368e. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Allow updater-controlled relaunch by not blocking before-quit after before-quit-for-update

  • Adds onBeforeQuitForUpdate to the ElectronApp service interface, implemented via Effect.acquireRelease to scope a listener on Electron.autoUpdater's before-quit-for-update event in ElectronApp.ts.
  • Introduces an updaterQuitAllowed flag in DesktopLifecycle.ts that is set when the updater fires before-quit-for-update, allowing the subsequent before-quit event to proceed rather than being cancelled.
  • Behavioral Change: previously, all before-quit events were blocked unless quitAllowed was set via the normal quit flow; now updater-initiated quits bypass that block.

Macroscope summarized bed368e.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c0584438-597a-4206-a0f4-b5694f405017

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jul 28, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Straightforward bug fix that allows Electron's auto-updater to complete its relaunch sequence by adding a flag to bypass quit-prevention when the updater triggers the quit. Changes are self-contained with comprehensive test coverage.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge
juliusmarminge merged commit 9ccfd9d into pingdotgg:main Jul 28, 2026
14 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Jul 28, 2026
## What's Changed
* Make mobile Thread List v2 the default by @juliusmarminge in pingdotgg/t3code#4717
* Fix mobile showcase workflow without Clerk by @juliusmarminge in pingdotgg/t3code#4718
* Fix relay credential lookup for unlinked environments by @juliusmarminge in pingdotgg/t3code#4692
* Settle merged PR threads immediately by @t3dotgg in pingdotgg/t3code#4704
* feat(web): add maria's sidebar header artwork toggle by @maxktz in pingdotgg/t3code#4652
* feat(web): add appearance settings category by @maxktz in pingdotgg/t3code#4715
* fix(desktop): allow updater-controlled relaunch by @0x4bs3nt in pingdotgg/t3code#4721


**Full Changelog**: pingdotgg/t3code@v0.0.30-nightly.20260728.930...v0.0.30-nightly.20260728.931

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.30-nightly.20260728.931
vimoppa added a commit to vimoppa/t3code that referenced this pull request Jul 28, 2026
* fix(mobile): threads load snapped to bottom on iOS (pingdotgg#4689)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* feat: default sidebar v2 on for nightly and dev builds (pingdotgg#4491)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(web): 33 web UI fixes (pingdotgg#4700)

* Make mobile Thread List v2 the default (pingdotgg#4717)

* Fix mobile showcase workflow without Clerk (pingdotgg#4718)

* Fix relay credential lookup for unlinked environments (pingdotgg#4692)

Co-authored-by: codex <codex@users.noreply.github.com>

* Settle merged PR threads immediately (pingdotgg#4704)

* feat(web): add maria's sidebar header artwork toggle (pingdotgg#4652)

* feat(web): add appearance settings category (pingdotgg#4715)

* fix(desktop): allow updater-controlled relaunch (pingdotgg#4721)

* fix(web): prevent diff panel scroll jumping (pingdotgg#4724)

* Link inline code file paths in chat markdown (pingdotgg#4726)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* Fix Android showcase capture and rebuild v2 queued rows (pingdotgg#4730)

Co-authored-by: Claude <noreply@anthropic.com>

* fix(nix): refresh pnpm dependency hash

---------

Co-authored-by: Theo Browne <me@t3.gg>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Max Katz <me@maxkatz.me>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: jan <hi@4bs3nt.com>
tarik02 added a commit to tarik02/t3code that referenced this pull request Jul 28, 2026
* Add OTA update checks to mobile settings (pingdotgg#4686)

* fix(mobile): threads load snapped to bottom on iOS (pingdotgg#4689)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* feat: default sidebar v2 on for nightly and dev builds (pingdotgg#4491)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(web): 33 web UI fixes (pingdotgg#4700)

* Make mobile Thread List v2 the default (pingdotgg#4717)

* Fix mobile showcase workflow without Clerk (pingdotgg#4718)

* Fix relay credential lookup for unlinked environments (pingdotgg#4692)

Co-authored-by: codex <codex@users.noreply.github.com>

* Settle merged PR threads immediately (pingdotgg#4704)

* feat(web): add maria's sidebar header artwork toggle (pingdotgg#4652)

* feat(web): add appearance settings category (pingdotgg#4715)

* fix(desktop): allow updater-controlled relaunch (pingdotgg#4721)

* fix(web): prevent diff panel scroll jumping (pingdotgg#4724)

* Link inline code file paths in chat markdown (pingdotgg#4726)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* Fix Android showcase capture and rebuild v2 queued rows (pingdotgg#4730)

Co-authored-by: Claude <noreply@anthropic.com>

* perf(server): negotiate permessage-deflate on the websocket (pingdotgg#4705)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Theo Browne <me@t3.gg>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Max Katz <me@maxkatz.me>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: jan <hi@4bs3nt.com>
andreasmolnardev pushed a commit to andreasmolnardev/codewise that referenced this pull request Jul 28, 2026
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Jul 29, 2026
## What's Changed
* Add OTA update checks to mobile settings by @juliusmarminge in pingdotgg/t3code#4686
* fix(mobile): threads load snapped to bottom on iOS by @t3dotgg in pingdotgg/t3code#4689
* feat: default sidebar v2 on for nightly and dev builds by @t3dotgg in pingdotgg/t3code#4491
* fix(web): 33 web UI fixes by @maxktz in pingdotgg/t3code#4700
* Make mobile Thread List v2 the default by @juliusmarminge in pingdotgg/t3code#4717
* Fix mobile showcase workflow without Clerk by @juliusmarminge in pingdotgg/t3code#4718
* Fix relay credential lookup for unlinked environments by @juliusmarminge in pingdotgg/t3code#4692
* Settle merged PR threads immediately by @t3dotgg in pingdotgg/t3code#4704
* feat(web): add maria's sidebar header artwork toggle by @maxktz in pingdotgg/t3code#4652
* feat(web): add appearance settings category by @maxktz in pingdotgg/t3code#4715
* fix(desktop): allow updater-controlled relaunch by @0x4bs3nt in pingdotgg/t3code#4721
* fix(web): prevent diff panel scroll jumping by @0x4bs3nt in pingdotgg/t3code#4724
* Link inline code file paths in chat markdown by @juliusmarminge in pingdotgg/t3code#4726
* Fix Android showcase capture and rebuild v2 queued rows by @juliusmarminge in pingdotgg/t3code#4730
* perf(server): negotiate permessage-deflate on the websocket by @t3dotgg in pingdotgg/t3code#4705
* docs: overhaul agent guidance by @t3dotgg in pingdotgg/t3code#4782
* Prevent sidebar row labels from truncating by @juliusmarminge in pingdotgg/t3code#4789
* perf(server): gzip large thread snapshots by @t3dotgg in pingdotgg/t3code#4788
* fix(web): stashed prompts now survive switching providers by @t3dotgg in pingdotgg/t3code#4787
* Fix Git ref refresh resource storms by @juliusmarminge in pingdotgg/t3code#4727
* perf(server): trim stale context-window rows and drop dead replay RPC by @t3dotgg in pingdotgg/t3code#4791
* fix(web): defer command palette filesystem navigation by @juliusmarminge in pingdotgg/t3code#2109
* fix(release): skip scripts during Vercel installs by @t3dotgg in pingdotgg/t3code#4796
* refactor(client): share filesystem browse navigation by @juliusmarminge in pingdotgg/t3code#4797
* fix(mobile): defer filesystem navigation by @juliusmarminge in pingdotgg/t3code#4799
* refactor(server): use native HTTP compression streams by @juliusmarminge in pingdotgg/t3code#4798
* Remove Connect waitlist and add GA announcement tooling by @juliusmarminge in pingdotgg/t3code#4691


**Full Changelog**: pingdotgg/t3code@v0.0.29...v0.0.30

## What's Changed
* Add OTA update checks to mobile settings by @juliusmarminge in pingdotgg/t3code#4686
* fix(mobile): threads load snapped to bottom on iOS by @t3dotgg in pingdotgg/t3code#4689
* feat: default sidebar v2 on for nightly and dev builds by @t3dotgg in pingdotgg/t3code#4491
* fix(web): 33 web UI fixes by @maxktz in pingdotgg/t3code#4700
* Make mobile Thread List v2 the default by @juliusmarminge in pingdotgg/t3code#4717
* Fix mobile showcase workflow without Clerk by @juliusmarminge in pingdotgg/t3code#4718
* Fix relay credential lookup for unlinked environments by @juliusmarminge in pingdotgg/t3code#4692
* Settle merged PR threads immediately by @t3dotgg in pingdotgg/t3code#4704
* feat(web): add maria's sidebar header artwork toggle by @maxktz in pingdotgg/t3code#4652
* feat(web): add appearance settings category by @maxktz in pingdotgg/t3code#4715
* fix(desktop): allow updater-controlled relaunch by @0x4bs3nt in pingdotgg/t3code#4721
* fix(web): prevent diff panel scroll jumping by @0x4bs3nt in pingdotgg/t3code#4724
* Link inline code file paths in chat markdown by @juliusmarminge in pingdotgg/t3code#4726
* Fix Android showcase capture and rebuild v2 queued rows by @juliusmarminge in pingdotgg/t3code#4730
* perf(server): negotiate permessage-deflate on the websocket by @t3dotgg in pingdotgg/t3code#4705
* docs: overhaul agent guidance by @t3dotgg in pingdotgg/t3code#4782
* Prevent sidebar row labels from truncating by @juliusmarminge in pingdotgg/t3code#4789
* perf(server): gzip large thread snapshots by @t3dotgg in pingdotgg/t3code#4788
* fix(web): stashed prompts now survive switching providers by @t3dotgg in pingdotgg/t3code#4787
* Fix Git ref refresh resource storms by @juliusmarminge in pingdotgg/t3code#4727
* perf(server): trim stale context-window rows and drop dead replay RPC by @t3dotgg in pingdotgg/t3code#4791
* fix(web): defer command palette filesystem navigation by @juliusmarminge in pingdotgg/t3code#2109
* fix(release): skip scripts during Vercel installs by @t3dotgg in pingdotgg/t3code#4796
* refactor(client): share filesystem browse navigation by @juliusmarminge in pingdotgg/t3code#4797
* fix(mobile): defer filesystem navigation by @juliusmarminge in pingdotgg/t3code#4799
* refactor(server): use native HTTP compression streams by @juliusmarminge in pingdotgg/t3code#4798
* Remove Connect waitlist and add GA announcement tooling by @juliusmarminge in pingdotgg/t3code#4691


**Full Changelog**: pingdotgg/t3code@v0.0.29...v0.0.30

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants