Repository navigation
fix(updater): clear a cancelled macOS install request before staging the next update - #28010
Conversation
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to The install ordering is implemented, but its new test leaves an asynchronous regression unprotected. This is a bounded concern that can be addressed before merge or tracked as a follow-up. Pre-merge checks |
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/updater.headless-serve-install.test.ts (1)
350-403: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep staging pending until the test checks the native install boundary.
prepareShipItStagingMockresolves immediately, so the test passes even ifquitAndInstallinvokes native installation without awaiting staging. Use a deferred promise and assert that native installation has not started before resolving it.Suggested fix
const lifecycle: string[] = [] + let finishPreparing: () => void = () => undefined prepareShipItStagingMock.mockImplementation(() => { lifecycle.push('shipit-staging-prepared') - return Promise.resolve() + return new Promise<void>((resolve) => { + finishPreparing = resolve + }) }) ... quitAndInstall() await vi.advanceTimersByTimeAsync(100) + expect(lifecycle).toEqual(['handoff-persisted', 'shipit-staging-prepared']) + finishPreparing() + await vi.advanceTimersByTimeAsync(0) + expect(lifecycle).toEqual([ 'handoff-persisted', 'shipit-staging-prepared', 'native-quit-and-install'
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
00e2bd40-cf36-4b1c-af93-9cf3ece84717
📒 Files selected for processing (10)
src/cli/runtime/serve-install-hold.test.tssrc/cli/runtime/serve-install-hold.tssrc/main/updater.headless-serve-install.test.tssrc/main/updater.mac-install.test.tssrc/main/updater/shipit-leftover-recovery.test.tssrc/main/updater/shipit-leftover-recovery.tssrc/main/updater/updater-download-install.tssrc/main/updater/updater-install-execution.tssrc/main/updater/updater-installer-session-release.tssrc/shared/shipit-process-listing.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
ELI5
On a Mac, the app's updater (Squirrel) hands each update to a helper called ShipIt. If ShipIt is cancelled partway, for example because a background
orca serverestarted while it was installing, it leaves its request and a half-prepared copy of the update behind. From then on every update stops at "Downloading… 100%". It stays that way across restarts until someone deletes those files by hand (#14732). This PR has Orca clear those leftovers before it prepares the next update, but only when it can prove nothing else still needs them.What Changed
~/Library/Caches/com.stablyai.orca.ShipIt/. A cancelled install leftShipItState.plistand anupdate.<random>/folder there. The reporter showed that later updates then never reached "installer ready", and that deleting exactly those two items fixed it.ShipItState.plistandupdate.*folders. ShipIt's logs stay.~/Library/Application Support/orca/bundle-coordination/install.lock, created with exclusive create and holding the owner's pid. A lock whose owner died is reclaimed once. While a live holder has it, nothing is deleted.bundle-coordination/shipit-staging-owners/<pid>, so a desktop holding an update that's ready to install is never cleaned out from under it. Records of dead processes are pruned.com.stablyai.orca.ShipIt(launchd's job label for it), or the process list can't be read, nothing is deleted. Other apps' ShipIt processes don't block the cleanup. Owners are checked again right before deleting, in case one registered while the process list was being read.updater_macos_shipit_leftoversbreadcrumb.pslisting and the ShipIt matching that the supervisor's install hold already used moved tosrc/shared/shipit-process-listing.ts, so both callers share them. A new matcher finds Orca's ShipIt by its job label, so app paths that contain spaces still match. The installer's session-release helper moved to its own file to keepupdater-install-execution.tsunder the line limit; its behavior is unchanged.Why
This is B7 of the headless-serve robustness plan. B4 and B6 (#27716, #27722) stop the respawn race that cancels ShipIt. But a machine that has already hit it once stays stuck, and anything else that kills ShipIt has the same effect.
Alternatives considered:
Clearing only under the lock, only with no live owner and no ShipIt running, and only right before preparing the next update, is the narrowest rule that both unsticks the machine and never races a live install.
Linked Issue
Fixes the "every later update stalls" half of #14732 (with #27716 and #27722).
Visual Proof
N/A. This changes background update behavior, with no UI.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
shipit-leftover-recovery.test.ts, in temporary folders:updater.mac-install.test.ts: the desktop download starts only after the recovery step finishes. This failed before the change.updater.headless-serve-install.test.ts: supervised serve on macOS runs the step after the handoff and right before the native install, never at download. This failed before the change.The full updater and serve-install-hold suites,
pnpm tc, oxlint,pnpm run check:code-quality:changedandpnpm lintpass locally.Not run: a real cancelled ShipIt on a test Mac. That is real-host test 2 in the design.
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)