Skip to content

fix(updater): install macOS orca serve updates instead of waiting on Squirrel forever - #21433

Closed
jbamlee wants to merge 5 commits into
stablyai:mainfrom
jbamlee:fix/mac-serve-update-squirrel-deadlock
Closed

jbamlee wants to merge 5 commits into
stablyai:mainfrom
jbamlee:fix/mac-serve-update-squirrel-deadlock

Conversation

@jbamlee

@jbamlee jbamlee commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When Orca runs as a background server (orca serve under 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'):

  • The update downloads, but the status stays at downloading 100% (macos_waiting_for_squirrel) and never reaches downloaded.
  • A paired client's remote update is refused with remote_update_not_downloaded.
  • A local install request waits 15s for Squirrel (deferMacQuitUntilInstallerReady), logs macos_install_guard_timeout, and quits without installing. launchd then relaunches the old version.

After:

  • The download is reported as downloaded, so both local and remote installs can start.
  • The install goes straight to the handoff. quitAndInstall skips the Squirrel-readiness guard. It goes to the existing supervised handoff (requestServeUpdateHandoff), then to autoUpdater.quitAndInstall(true, false). That call is where electron-updater's MacUpdater asks Squirrel to fetch the bundle from its localhost proxy.
  • Nothing destructive happens until Squirrel reports the bundle staged (its native update-downloaded). At that point commitStagedMacInstall commits the install, arms the exit watchdog, and then kills in-process PTYs and removes close listeners.
    • Orca's native listener is registered at setup, so it runs before the listener MacUpdater adds to quit the app.
    • Commit happens first. A throwing cleanup is recorded as post_commit_cleanup_failed, the same way performQuitAndInstall already handles it, and cannot skip the watchdog or MacUpdater's quit.
  • While staging, only Squirrel's own native error fails 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.
    • MacUpdater re-emits that native error as an updater 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.
  • If Squirrel is silent for 120s, the updater reports a non-retryable error status and records 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.ts deliberately sets autoInstallOnAppQuit = false for serve modes, so that an ordinary service quit never installs implicitly. With that flag off, electron-updater 6.8.9's MacUpdater.doDownloadUpdate does not call nativeUpdater.checkForUpdates() after the download. It only calls it inside MacUpdater.quitAndInstall() (see node_modules/electron-updater/out/MacUpdater.js). Orca's macOS readiness wait assumed the eager path that autoInstallOnAppQuit = true gives interactive installs. isMacStagingDeferredToInstall() (darwin + supervised serve) names that difference, and both waits now consult it.

Unchanged:

  • Interactive mode, unsupported-headless-serve, and Linux/Windows supervised serve.
  • UpdaterHandlerContext moved verbatim into src/main/updater-handler-context.ts. The new context fields would otherwise push updater-events.ts past the 300-line limit.

Why

Alternatives considered:

  • Set autoInstallOnAppQuit = true for 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 plain launchctl stop or a crash would install without the supervisor handoff. That is what the comment in updater-setup.ts forbids.
  • Call nativeUpdater.checkForUpdates() ourselves after the download. Same install-on-any-exit problem, and it races electron-updater's own proxy and auth bookkeeping.
  • Abandon the install when staging is slow. MacUpdater's update-downloaded listener 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 serve under a user LaunchAgent with ORCA_SERVE_UPDATE_HANDOFF_PATH set:

  • 1.4.201, 1.4.203, 1.4.204 and 1.4.205 all stopped at update_downloaded {"macInstallerReady":false} → macos_waiting_for_squirrel.
  • The log has zero request lines for the Squirrel.Mac proxy (Proxy server for native Squirrel.Mac is listening, then nothing).
  • ~/Library/Caches/com.stablyai.orca.ShipIt was last touched by the one install that succeeded before the host moved to serve mode.
  • The shipped 1.4.205 bundle still has the same autoInstallOnAppQuit expression 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

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

End-to-end on real packaged builds (macOS arm64, launchd-supervised orca serve)

Setup:

  • Built this branch at 5128ea8 twice with electron-builder --mac dir --arm64: once as 1.4.205-e2e.2 (the running app) and once as 1.4.205-e2e.3 (the update target).
  • Signed both with the same throwaway self-signed identity, so Squirrel's designated-requirement check can pass between them.
  • Installed e2e.2 into a scratch directory and ran bin/orca serve --port 6771 --no-pairing under a user LaunchAgent (KeepAlive).
    • State was isolated with ORCA_E2E_USER_DATA_DIR, HOME and ORCA_CLI_INSTALL_PATH. The production install on the same machine was untouched.
  • Attached a desktop window by launching the app a second time, since the updater only initializes once a window is attached.
  • ⌥-clicked Check for Updates, chose the target's latest-mac.yml, then pressed the update card's download and install buttons.

Success path (serve stderr, trimmed):

[updater] update_downloaded {"version":"1.4.205-e2e.3","macInstallerReady":false}
[updater] quit_and_install_started {"version":"1.4.205-e2e.3","macInstallerReady":false}
[updater] quit_and_install_invoking_native {"version":"1.4.205-e2e.3"}
[autoUpdater] / requested
[autoUpdater] /<sha512>.zip requested by Squirrel.Mac, pipe …/orca-updater/pending/…
[autoUpdater] nativeUpdater.update-downloaded
[updater] macos_deferred_staging_committed {"version":"1.4.205-e2e.3"}
[updater] macos_installer_ready {"deferredInstallRequested":false,"hasNewerDownloadedVersion":true}
[updater] will-quit cleanup for update install; daemonTeardown=disconnect
ShipIt: Installation completed successfully

Result:

  • The bundle's CFBundleShortVersionString became 1.4.205-e2e.3.
  • The same supervisor process respawned the child: launchd runs = 1, so this was not a launchd restart.
  • The child reports appVersion 1.4.205-e2e.3 over RPC.
  • serve-update-handoff.json was cleared.

Failure path, on the same running build:

  • The GitHub check had also offered the published v1.4.205, which is Developer ID signed and so cannot satisfy the test identity.
  • Installing it twice gave the same result both times:
    1. Squirrel fetched from the proxy.
    2. Squirrel rejected the bundle: code failed to satisfy specified code requirement(s).
    3. The install ended with quit_and_install_failed_via_event.
    4. The handoff recorded failed with its reason.
    5. The serve child kept running with the same pid.

Before this change (field):

  • Four consecutive releases stopped at macos_waiting_for_squirrel, with no proxy request at all.

New tests in src/main/updater.headless-serve-install.test.ts:

  • They stub process.platform = 'darwin', so they also run on Linux CI.
  • They model electron-updater's MacUpdater with autoInstallOnAppQuit off:
    • each unstaged quitAndInstall adds a persistent native update-downloaded listener that calls app.quit();
    • native errors are re-emitted as updater errors first;
    • native listeners run in registration order.
  • They cover five behaviors:
    • The status reaches downloaded, and the install commits only after Squirrel stages it. Order: commit → session cleanup → MacUpdater quit.
    • A Squirrel failure keeps sessions intact and fails the handoff. The retry then completes, with one commit and both MacUpdater listeners quitting.
    • A throwing session cleanup still commits and still lets MacUpdater quit.
    • An unrelated updater error during staging does not abandon the install.
    • A silent Squirrel is reported after 120s without failing the handoff, and a late staging still commits.
  • All five fail when run against the base commit (5 failed, 9 existing passed): the status stays at downloading 100% and native quitAndInstall is 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.
  • Updater and serve-handoff suites: 35 files, 360 tests, all passing.
  • pnpm test (full), which on this machine shows two kinds of failure, both unrelated to this change:
    • During the full parallel run, the ssh/ipc module graph hits suite-level ENOENT errors in Vitest's SSR transform cache. Those files pass when re-run on their own.
    • The remaining 8 files fail identically on the base commit here: real Claude CLI binaries, browser viewport, relay PTY, skill-recipe shell, repo-icon autodetect, and relay region correction.

Contract test: src/main/electron-updater-mac-staging-contract.test.ts runs the installed MacUpdater.quitAndInstall and handleUpdateDownloaded. 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:

  • one Claude Opus reviewer instance;
  • four Codex review rounds.

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:

  • Claude Opus reviewer (first commit):
    • The updater error path failed the handoff for unrelated errors during staging.
    • Session cleanup ran before Squirrel staged.
    • Staging was unbounded.
    • Tests were synchronous.
    • All four were confirmed and fixed.
  • Codex round 1: found the same cleanup-order, unbounded-wait and test-fidelity issues. Fixed. That repair also found and fixed a missing darwin check in isMacStagingDeferredToInstall.
  • Codex round 2: abandoning the install on timeout let MacUpdater's retained listener install under a failed handoff. Changed to report-only.
  • Codex round 3:
    • A throwing cleanup inside Squirrel's event skipped the commit and MacUpdater's quit. The install now commits first.
    • Retries were not modeled with MacUpdater's persistent listeners. Tests now model them.
  • Codex round 4: CLEAN, no findings.
  • PR bots:
    • Pullfrog: the fix depends on electron-updater's MacUpdater behavior, which all updater tests mock. Added the contract test above.
    • CodeRabbit: no actionable comments.
      • Its docstring-coverage warning is not taken; AGENTS.md asks for brief non-obvious comments, and these methods follow the file's one-line Why: convention.
      • The linked-issue warning is covered under Linked Issue.

Review coverage:

  • Cross-platform: every new branch is gated on darwin plus supervised serve. Linux and Windows serve installs and interactive installs keep their existing paths.
  • SSH/remote/local: remote install now reaches the existing downloaded gate. No wire change; execution ownership is unchanged.
  • Agents/integrations: none touched.
  • Performance: one timer per install attempt.
  • UI: none.
  • Security: no change to signature verification. Squirrel still validates the bundle against the running app's designated requirement.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Cross-platform: every new branch requires darwin and supervised serve. Linux and Windows serve installs keep their immediate commit.
  • SSH/remote: fixes the remote install for macOS supervised servers. No wire or schema change.
  • Mobile: not affected.
  • Backwards compatibility: no persisted-state or IPC changes.
  • Performance: one timer per install attempt; no new work in hot paths.
  • Known residual: a Squirrel that never answers leaves the install pending until the service is restarted. It is reported after 120s, and the process keeps serving. Forcing an exit before staging would quit without installing, and abandoning the handoff would let a late staging install unsupervised.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

jbamlee and others added 4 commits September 18, 2026 17:51
…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]>
@jbamlee
jbamlee marked this pull request as draft September 18, 2026 10:08
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 49465a18-7ac8-4bfe-8ec3-45272e462264

📥 Commits

Reviewing files that changed from the base of the PR and between 5128ea8 and 4e8b2c4.

📒 Files selected for processing (1)
  • src/main/electron-updater-mac-staging-contract.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The 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 4e8b2

The added macOS updater contract tests do not introduce an actionable merge risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 11 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning 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 onl… Add the linked issue reference in the required "Fixes #" field. If no issue exists, create or associate one before merging.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: fixing macOS Orca serve updates that otherwise wait indefinitely on Squirrel.
Full details: Description check

Explanation

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.

  • Fix all pre-merge checks with AI

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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ 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-downloaded handler 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 and performQuitAndInstall holds PTY/window cleanup until Squirrel's native update-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 error ends staging (recovering the handoff); a 120s timer reports macos_deferred_staging_slow without abandoning the handoff.
  • Context extraction: UpdaterHandlerContext moved to updater-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?

Pullfrog  | Fix it ➔ | View workflow run | Using 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]>
@jbamlee

jbamlee commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews. Here is what I did with each finding.

Pullfrog: coupling to MacUpdater internals. Addressed in 4e8b2c4.

  • The new test, src/main/electron-updater-mac-staging-contract.test.ts, runs the installed MacUpdater methods instead of a mock:
    • updateDownloaded, with a real localhost proxy;
    • quitAndInstall;
    • handleUpdateDownloaded.
  • It asserts three things:
    1. With autoInstallOnAppQuit off, finishing the download does not start Squirrel staging.
    2. quitAndInstall does start it: it registers the native listener and calls checkForUpdates().
    3. With autoRunAppAfterInstall off, completion calls app.quit().
  • An electron-updater upgrade that changes any of these now fails this test, instead of silently restoring the deadlock.
  • I checked it against a mutated copy: early staging makes the test fail, and cleanup still closes the proxy.
  • I left the ^6.8.9 range unchanged, since the contract test covers the risk the pin would.

CodeRabbit:

  • Docstring coverage: not taken. AGENTS.md asks for brief, non-obvious comments only, and the touched methods follow the file's one-line Why: convention.
  • Linked issue: none was filed; the field evidence and root cause are in the description.

The description now also includes an end-to-end run on real packaged, launchd-supervised orca serve builds, covering two outcomes:

  • Update: from 1.4.205-e2e.2 to 1.4.205-e2e.3. Squirrel fetched from the proxy, the install committed, ShipIt installed it, and the supervisor relaunched the new version.
  • Rejected update: the server stayed up with its handoff recorded as failed.

@jbamlee
jbamlee marked this pull request as ready for review September 18, 2026 14:56

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.ts loads the real installed [email protected] MacUpdater and asserts staging happens inside quitAndInstall (not the finished download) and that handleUpdateDownloaded quits without relaunching. I mutation-verified it: removing nativeUpdater.checkForUpdates() from the installed MacUpdater.quitAndInstall makes it fail, so it genuinely guards the deadlock regression rather than restating the mock.
  • Download reports installable: the update-downloaded handler 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, and performQuitAndInstall holds PTY/window cleanup until Squirrel's native update-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 error ends staging (recovering the handoff); a 120s timer reports macos_deferred_staging_slow without abandoning the handoff.
  • Context extraction: UpdaterHandlerContext moved to updater-handler-context.ts.

I ran the new contract test, updater.headless-serve-install.test.ts, and updater-events.test.ts — 34 passed / 3 skipped.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@OrcaWin

OrcaWin commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

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 as never.

@OrcaWin OrcaWin closed this Oct 11, 2026
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