Repository navigation
fix(updater): back up unsaved editors before a remote-triggered desktop update - #51245
Conversation
…d install updater.install over RPC reused the local 'manual' trigger, which assumes the window's preload already checkpointed the renderer. A remote caller never does, so main now prepares the renderer like an automatic install. The check/download/install/wait coordinator moves to src/shared so other clients can drive the same flow.
…kpoint is saved A main-prepared install (automatic, team-required, and now remote) left the window's close waiting on the update until the window was destroyed. The native installer closes windows first, so shutdown stalled until the 20s exit watchdog forced it. Close now waits only for the checkpoint itself.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ELI5
When another device (a paired desktop today, the phone next) tells a desktop Orca to install an update, Orca now saves your unsaved editor work and window state first, exactly like when you click Update on that desktop. After the restart, the unsaved text is back.
What Changed
updater.installover RPC restarted a desktop Orca without backing up dirty editors or checkpointing window state. The install also hit the window's unsaved-changes guard. Remote installs were only ever exercised on windowlessorca serve, so nobody saw this.UpdateInstallTriggergains'remote', whichinstallRemoteServerUpdatepasses.performQuitAndInstallalready runs main-side preparation for every trigger except'manual'.'manual'is now documented as "the local window's preload already checkpointed itself".quitAndInstallno longer has a default trigger, so each entry point names its own.prepareAutomaticInstallis renamedprepareRendererForInstall, since it isn't automatic-only.quitAndInstallcloses windows before it quits, so shutdown deadlocked until the 20 s exit watchdog forced it.src/shared/remote-runtime/host-updates/, along with restart-wait, the install-failure probe, polling and version skew, so the phone can drive the same flow.transport.describeError.RemoteServerUpdaterStatusError), including install failures read back after a restart. A German desktop now sees the translated reason, not main's English.Why
'manual'meant "the preload ranprepareAndInvokeUpdaterInstall", but the RPC install reused'manual'without any renderer involvement.trigger !== 'manual', so the RPC path silently stayed on the "preload did it" side.Linked Issue
No GitHub issue; this is host groundwork for a phone "Update host" action (the phone UI is a later PR).
Visual Proof
Real macOS packaged builds, test bundle id and isolated profile. A script drove the moved shared coordinator over the app's local RPC socket (check → download → install → wait). The editor text was typed and not saved;
notes.mdon disk was unchanged throughout.Before the remote install (v…local.3, unsaved line, dirty dot):
After the restart into the new build (v…local.2, relaunched by ShipIt), the unsaved line restored. Closing the tab asks "notes.md has unsaved changes. Save?":
Coordinator log from the final run:
Same run before the close fix:
restarting23:00:12.4 →updated23:00:44.5, and the host log showedShutdown did not finish within 20000ms of committing the update install; forcing exit.Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
macOS, real Squirrel/ShipIt installs: two packaged builds of this branch under a test bundle id, with home and profile isolated.
Fake-transport run of the shared coordinator: the happy path reaches
updated. A host checkpoint failure surfaces as the codedautomaticInstallCheckpointFailedthrough the injecteddescribeError.Gate:
pnpm check:changedpasses, and typechecks pass for node and web.Not run: Windows and Linux. Reviewed by code: electron-updater's NSIS/AppImage
quitAndInstallquits insetImmediate, after the close listeners are already removed, so the close fix changes nothing there.No automated test: the behaviour lives in Electron window/updater lifecycles that only a real packaged install exercises. That's what the run above did.
Performance
None, because the new work runs once per remote install. It is the same renderer checkpoint every local and automatic install already does. The moved coordinator keeps its existing polling cadence and adds no owners or timers.
Risk
Level: Medium
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
updater.*is still off the phone allowlist; the phone "Update host" PR adds it with its UI.updater.installon an older desktop gets the old behaviour (no preparation). Older clients get the new preparation from a new host.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)