Repository navigation
Conversation
…ng install Supervised `orca serve` keeps autoInstallOnAppQuit off, so electron-updater's MacUpdater hands the download to Squirrel.Mac only inside quitAndInstall. The updater, however, held the status at "downloading 100%" and gated quitAndInstall on Squirrel having already staged the bundle. Neither could happen first, so every macOS serve update stalled at macos_waiting_for_squirrel, remote installs failed with remote_update_not_downloaded, and a local install request timed out and quit without installing. In supervised serve mode, report the download as installable and let the install proceed to the handoff and native quitAndInstall. The install commits and arms the exit watchdog when Squirrel signals it has staged the bundle; a staging failure still recovers through the existing pre-commit error path. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… serve bundle The supervised macOS install now calls electron-updater's quitAndInstall before Squirrel has staged anything, and that staging completes asynchronously. Three consequences needed handling: - PTY cleanup and close-listener removal ran before staging, so a Squirrel failure recovered the server with its in-process sessions already killed. They now run when Squirrel reports the bundle staged, together with the commit and exit watchdog. - Any updater 'error' during staging (for example a background check) failed the handoff while MacUpdater's pending listener would still quit and install. While staging is awaited, only Squirrel's native error ends it. - Nothing bounded a Squirrel that never answers. After two minutes the install recovers through the existing pre-commit failure path and the server keeps serving. isMacStagingDeferredToInstall is now darwin-only, so Linux supervised installs keep their immediate commit. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…e install Recovering the install on the staging timeout reset Orca's state and failed the supervisor handoff, but electron-updater's MacUpdater keeps its own completion listener. A Squirrel that finished after the timeout still quit the app and installed, now with a failed handoff, so the supervisor skipped the replacement spawn. The timeout now only reports a non-retryable error status and records the slow staging; the handoff and in-flight install stay live so a late staging commits and relaunches normally. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Squirrel's update-downloaded listeners run in registration order, and Orca's runs before the one MacUpdater adds to quit the app. The staged-install commit ran PTY cleanup first, so a throwing cleanup callback skipped the commit, the exit watchdog, and MacUpdater's quit, leaving the install stuck in progress. Commit and arm the watchdog first, then run cleanup under the same post_commit_cleanup_failed handling performQuitAndInstall already uses. The tests now register MacUpdater's persistent quit listener per unstaged install, so a retried install is followed through completion. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe updater now supports macOS staging deferred to installation. It routes staging commit and failure callbacks through the updater event context. It delays destructive cleanup until staging completes and applies a 120-second timeout. It clears the timeout during state reset. New tests cover commit, retry, cleanup failure, unrelated errors, timeout behavior, and native updater contracts. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The added macOS updater contract tests do not introduce an actionable merge risk. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description thoroughly explains the problem, behavior changes, implementation, testing, risks, and platform impact. However, the required Linked Issue section is incomplete because it contains only "Fixes #" and explicitly states that no issue was filed.
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. Comment |
There was a problem hiding this comment.
ℹ️ No critical issues — one defer-able risk noted below.
Reviewed changes
Reviewed the full 10-file diff at 5128ea8, including the new updater.headless-serve-install.test.ts macOS cases, and verified the load-bearing electron-updater behavior against the installed MacUpdater.js.
- Download reports installable: the
update-downloadedhandler skips the Squirrel-readiness wait for supervised macOS serve, so both local and remote installs can start (updater-events.ts). - Staging deferred to install:
isMacStagingDeferredToInstall()gates the macOS readiness waits andperformQuitAndInstallholds PTY/window cleanup until Squirrel's nativeupdate-downloaded(updater-install-execution.ts,updater-download-install.ts). - Commit on stage: a native listener registered before MacUpdater's own quit listener commits the install, arms the exit watchdog, then releases sessions; a throwing cleanup is recorded as
post_commit_cleanup_failed(updater-mac-install.ts,updater-install-execution.ts). - Failure and timeout handling: only Squirrel's native
errorends staging (recovering the handoff); a 120s timer reportsmacos_deferred_staging_slowwithout abandoning the handoff. - Context extraction:
UpdaterHandlerContextmoved toupdater-handler-context.ts.
ℹ️ The staging assumption is pinned only against a hand-written MacUpdater model
The fix depends on electron-updater's MacUpdater.quitAndInstall registering a native update-downloaded listener and calling nativeUpdater.checkForUpdates() when autoInstallOnAppQuit is false. I confirmed this against the installed [email protected], and the new tests model it faithfully, but the suite mocks electron-updater entirely and package.json uses ^6.8.9. A minor/patch upgrade that changes that method would keep the tests green while the supervised serve install silently regresses to the original deadlock.
Technical details
# Coupling to electron-updater internals
## Affected sites
- `src/main/updater/updater-install-execution.ts:194` — `isMacStagingDeferredToInstall` encodes the "staging happens only inside quitAndInstall" assumption.
- `src/main/updater.headless-serve-install.test.ts:392` — comment documents the modeled MacUpdater behavior the suite relies on.
- `package.json:182` — `electron-updater` is a caret range, so the dependency can float.
## Required outcome
- The assumption should be re-verified (or fail loudly) if `electron-updater`'s `MacUpdater.quitAndInstall` behavior changes.
## Suggested approach (optional)
- A narrow test that loads the installed `MacUpdater` and asserts it registers the native `update-downloaded` listener and calls `nativeUpdater.checkForUpdates()` when `autoInstallOnAppQuit` is false, or a version assertion in the existing test.
## Open questions for the human (optional)
- Is the caret range intentional, or would pinning `electron-updater` be acceptable given this coupling?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…nstalls rely on The supervised macOS serve install assumes electron-updater's MacUpdater starts Squirrel staging only inside quitAndInstall when autoInstallOnAppQuit is off, and quits the app once staged when autoRunAppAfterInstall is off. Every updater suite mocks electron-updater, so run the installed MacUpdater methods directly; an upgrade that changed either behavior now fails here instead of silently restoring the deadlock. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Thanks for the reviews. Here is what I did with each finding. Pullfrog: coupling to
CodeRabbit:
The description now also includes an end-to-end run on real packaged, launchd-supervised
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Re-reviewed the delta at 4e8b2c4 on top of the prior pullfrog review at 5128ea8. The new commit adds the contract test the prior review asked for, pinning the electron-updater MacUpdater behavior the supervised serve install depends on; the rest of the PR is unchanged and re-verified.
- Contract test added:
src/main/electron-updater-mac-staging-contract.test.tsloads the real installed[email protected]MacUpdaterand asserts staging happens insidequitAndInstall(not the finished download) and thathandleUpdateDownloadedquits without relaunching. I mutation-verified it: removingnativeUpdater.checkForUpdates()from the installedMacUpdater.quitAndInstallmakes it fail, so it genuinely guards the deadlock regression rather than restating the mock. - Download reports installable: the
update-downloadedhandler skips the Squirrel-readiness wait for supervised macOS serve, so local and remote installs can start (updater-events.ts). - Staging deferred to install:
isMacStagingDeferredToInstall()gates the readiness waits, andperformQuitAndInstallholds PTY/window cleanup until Squirrel's nativeupdate-downloaded(updater-install-execution.ts,updater-download-install.ts). - Commit on stage: a native listener registered before MacUpdater's own quit listener commits the install, arms the exit watchdog, then releases sessions; a throwing cleanup is recorded as
post_commit_cleanup_failed(updater-mac-install.ts,updater-install-execution.ts). - Failure and timeout handling: only Squirrel's native
errorends staging (recovering the handoff); a 120s timer reportsmacos_deferred_staging_slowwithout abandoning the handoff. - Context extraction:
UpdaterHandlerContextmoved toupdater-handler-context.ts.
I ran the new contract test, updater.headless-serve-install.test.ts, and updater-events.test.ts — 34 passed / 3 skipped.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Thank you @jbamlee, this was a precise fix for a nasty deadlock. Your five commits landed unchanged, with your authorship kept, through #27466 (merged as 68c46fa), rebased on current main. One follow-up commit adapts the tests: main had gained a macOS quit-guard test (#24952) that needed your two new staging callbacks, and the new install test no longer uses |

ELI5
When Orca runs as a background server (
orca serveunder a launchd service), updates on macOS never install. Orca downloads the update, then waits for macOS's installer (Squirrel) to say it is ready. But in this mode Squirrel is only asked to get ready when the install starts, and the install will not start until Squirrel is ready, so each side waits for the other forever.This PR lets the supervised server start the install without waiting first. It also treats "Squirrel has finished preparing the new app" as the moment the install becomes final.
What Changed
Before (macOS,
updateInstallMode === 'supervised-headless-serve'):downloading 100%(macos_waiting_for_squirrel) and never reachesdownloaded.remote_update_not_downloaded.deferMacQuitUntilInstallerReady), logsmacos_install_guard_timeout, and quits without installing. launchd then relaunches the old version.After:
downloaded, so both local and remote installs can start.quitAndInstallskips the Squirrel-readiness guard. It goes to the existing supervised handoff (requestServeUpdateHandoff), then toautoUpdater.quitAndInstall(true, false). That call is where electron-updater'sMacUpdaterasks Squirrel to fetch the bundle from its localhost proxy.update-downloaded). At that pointcommitStagedMacInstallcommits the install, arms the exit watchdog, and then kills in-process PTYs and removes close listeners.post_commit_cleanup_failed, the same wayperformQuitAndInstallalready handles it, and cannot skip the watchdog or MacUpdater's quit.errorfails the install. It goes through the existing pre-commit recovery: the handoff is marked failed, quit state is reset, the server keeps its sessions, and a retry is possible.error. Other updater errors (for example a background check) are ignored during staging, because MacUpdater's pending listener would still quit and install after Orca had abandoned the handoff.macos_deferred_staging_slow, but keeps the handoff live. It does not abandon the install, for the same reason: MacUpdater's listener would install anyway when Squirrel eventually finishes. A late staging therefore still commits and relaunches normally.Mechanism.
updater-setup.tsdeliberately setsautoInstallOnAppQuit = falsefor serve modes, so that an ordinary service quit never installs implicitly. With that flag off, electron-updater 6.8.9'sMacUpdater.doDownloadUpdatedoes not callnativeUpdater.checkForUpdates()after the download. It only calls it insideMacUpdater.quitAndInstall()(seenode_modules/electron-updater/out/MacUpdater.js). Orca's macOS readiness wait assumed the eager path thatautoInstallOnAppQuit = truegives interactive installs.isMacStagingDeferredToInstall()(darwin + supervised serve) names that difference, and both waits now consult it.Unchanged:
unsupported-headless-serve, and Linux/Windows supervised serve.UpdaterHandlerContextmoved verbatim intosrc/main/updater-handler-context.ts. The new context fields would otherwise pushupdater-events.tspast the 300-line limit.Why
Alternatives considered:
autoInstallOnAppQuit = truefor supervised serve. Squirrel would stage right after the download, so the existing wait would end. But Squirrel.Mac then installs a staged update on any app exit, so a plainlaunchctlstop or a crash would install without the supervisor handoff. That is what the comment inupdater-setup.tsforbids.nativeUpdater.checkForUpdates()ourselves after the download. Same install-on-any-exit problem, and it races electron-updater's own proxy and auth bookkeeping.update-downloadedlistener is registered with.on(), and Orca cannot remove it. A late staging would then quit and install under a failed handoff, and the supervisor would skip the replacement spawn. So the timeout only reports.Deferring the commit point to Squirrel's native signal keeps the pre-commit recovery path meaningful. That is the property the existing comment ("macOS without Squirrel stays uncommitted so late native errors can still recover") protects.
Linked Issue
No separate issue was filed. The evidence and root cause are in this description.
Field evidence from a macOS arm64 host running
orca serveunder a user LaunchAgent withORCA_SERVE_UPDATE_HANDOFF_PATHset:update_downloaded {"macInstallerReady":false}→macos_waiting_for_squirrel.Proxy server for native Squirrel.Mac is listening, then nothing).~/Library/Caches/com.stablyai.orca.ShipItwas last touched by the one install that succeeded before the host moved to serve mode.autoInstallOnAppQuitexpression and wait.Visual Proof
N/A. The change is in main-process updater state for the headless server; there is no renderer UI change. The visible effect is that the update card reaches the downloaded (install) state and the install completes, instead of staying at 100%. The end-to-end log excerpt under Testing is the evidence.
Testing
End-to-end on real packaged builds (macOS arm64, launchd-supervised
orca serve)Setup:
5128ea8twice withelectron-builder --mac dir --arm64: once as1.4.205-e2e.2(the running app) and once as1.4.205-e2e.3(the update target).e2e.2into a scratch directory and ranbin/orca serve --port 6771 --no-pairingunder a user LaunchAgent (KeepAlive).ORCA_E2E_USER_DATA_DIR,HOMEandORCA_CLI_INSTALL_PATH. The production install on the same machine was untouched.latest-mac.yml, then pressed the update card's download and install buttons.Success path (serve stderr, trimmed):
Result:
CFBundleShortVersionStringbecame1.4.205-e2e.3.runs = 1, so this was not a launchd restart.appVersion 1.4.205-e2e.3over RPC.serve-update-handoff.jsonwas cleared.Failure path, on the same running build:
v1.4.205, which is Developer ID signed and so cannot satisfy the test identity.code failed to satisfy specified code requirement(s).quit_and_install_failed_via_event.failedwith its reason.Before this change (field):
macos_waiting_for_squirrel, with no proxy request at all.New tests in
src/main/updater.headless-serve-install.test.ts:process.platform = 'darwin', so they also run on Linux CI.MacUpdaterwithautoInstallOnAppQuitoff:quitAndInstalladds a persistent nativeupdate-downloadedlistener that callsapp.quit();downloaded, and the install commits only after Squirrel stages it. Order: commit → session cleanup → MacUpdater quit.downloading 100%and nativequitAndInstallis never reached. The cleanup-throws test also fails on the previous revision of this branch, which cleaned up before committing.Local runs (macOS arm64):
pnpm typecheck: pass.pnpm lint: pass.pnpm run check:code-quality:changed: pass.oxfmt --check: clean.pnpm test(full), which on this machine shows two kinds of failure, both unrelated to this change:ENOENTerrors in Vitest's SSR transform cache. Those files pass when re-run on their own.Contract test:
src/main/electron-updater-mac-staging-contract.test.tsruns the installedMacUpdater.quitAndInstallandhandleUpdateDownloaded. An electron-updater upgrade that changed staging-inside-quitAndInstall, or quit-without-relaunch, now fails CI instead of silently restoring the deadlock.Not tested: a Developer ID signed release updating to another Developer ID signed release. That needs Stably's signing identity; the e2e above uses a self-signed pair instead.
AI Disclosure
Investigation, implementation and tests were done with Claude Code (Claude Opus 5). Before publishing, the change went through independent clean-context reviews:
Each round's findings were verified against source and fixed in this branch (see Review).
Review
Each review ran in a clean context against an exact commit. Findings were checked against source before any change:
errorpath failed the handoff for unrelated errors during staging.darwincheck inisMacStagingDeferredToInstall.MacUpdaterbehavior, which all updater tests mock. Added the contract test above.AGENTS.mdasks for brief non-obvious comments, and these methods follow the file's one-lineWhy:convention.Review coverage:
darwinplus supervised serve. Linux and Windows serve installs and interactive installs keep their existing paths.downloadedgate. No wire change; execution ownership is unchanged.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
darwinand supervised serve. Linux and Windows serve installs keep their immediate commit.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code