Skip to content

fix(serve): initialize the updater in headless Electron serve - #27771

Merged
OrcaWin merged 1 commit into
mainfrom
np/d1d-serve-updater
Oct 12, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
np/d1d-serve-updater

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​67 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​67
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​75 $\color{#cf222e}{\Huge{\mathbf{−}}}$​38 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​37

ELI5

A headless orca serve running on Electron never starts its updater, because the updater is only set up when a desktop window opens and serve has no window. Paired clients therefore see "updater unavailable" forever and can't update that server. This PR starts the updater for headless serve right after the server reports ready.

What Changed

  • Before: setupAutoUpdater was reached only through scheduleMainWindowAutoUpdaterSetup (window ready-to-show). In Electron serve mode that never happens, so autoUpdaterInitialized stayed false and getRemoteServerUpdateSupport() answered updater-unavailable. This affected CLI-supervised macOS serve ([Bug]: CLI-supervised macOS orca serve never initializes remote updater #22261) and every other Electron serve.
  • After:
    • launchServeMode calls a new setupHeadlessServeAutoUpdater(store, …) after readiness has been printed. It is deferred with setImmediate, because loading the updater is slow on cold machines.
    • It passes the serve install mode (resolveUpdateInstallMode(true)), the same store-backed hooks the window path uses, and a pre-quit store flush that aborts the install if the flush fails.
    • A failure to load the updater is logged and never breaks serve startup.
  • setupAutoUpdater now accepts null for the window. Its window sends were already optional. A later window attach still sets the window; a call without a window never clears one that is already set.
  • The option builder is shared between the window path and the headless path, so the two can't drift apart.
  • What a client sees afterwards depends on the platform:
  • orcad serve has no app updater and is unchanged.

Why

This is B1 of the headless-serve robustness plan. Window-driven setup was the only entry point, and making the window optional is the smallest fix. The updater already stores its status independently of the window, and remote snapshots read that status. A separate updater core, or a "status sink" layer, was considered and rejected as a framework with no second user.

Linked Issue

Fixes #22261

Visual Proof

N/A. Headless serve has no UI. Paired clients now render the existing update states instead of "unavailable".

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • main-window-updater-headless-serve.test.ts: setup runs after readiness, without a window, in the serve install mode, with the store hooks and pre-quit flush; an updater that fails to load never throws through serve startup.

  • The existing window-path tests (main-window-updater-deferred-setup.test.ts) and the updater and startup suites still pass.

  • pnpm tc, oxlint and check:code-quality:changed pass locally.

  • Not run: a real-host update of a LaunchAgent-supervised serve. That is real-host test 2 in the design.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Compatibility: no wire change. Older clients render the update states they already know.
  • Windows and Linux Electron serve now run the same background update checks a desktop does (autoDownload is off). An install still needs an explicit request and stays subject to the existing per-mode refusals.
  • SSH: the serve host updates itself. Nothing changes for SSH targets.

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)

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 07ac5bc5-ac88-49b8-a44e-3153f2436ca0

📥 Commits

Reviewing files that changed from the base of the PR and between 9693bad and 43a12a8.


📒 Files selected for processing (5)
  • src/main/startup/main-process-runtime-launch.ts
  • src/main/updater.ts
  • src/main/updater/updater-setup.ts
  • src/main/window/main-window-updater-headless-serve.test.ts
  • src/main/window/main-window-updater.ts

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: e8cbe3ad-8dcd-4bf2-b8ba-990764e016a2


📥 Commits

Reviewing files that changed from the base of the PR and between 6c3ce44 and 9693bad.



📒 Files selected for processing (5)
  • src/main/startup/main-process-runtime-launch.ts
  • src/main/updater.ts
  • src/main/updater/updater-setup.ts
  • src/main/window/main-window-updater-headless-serve.test.ts
  • src/main/window/main-window-updater.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.




📝 Walkthrough
📝 Walkthrough

Walkthrough

Headless serve mode now initializes the auto-updater after printing the ready message. Updater setup options are shared with window-driven setup, and the updater accepts a null window. Before an update-triggered quit, headless serve flushes a full checkpoint and aborts installation if the flush fails.



Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 9693b

Headless serve updater setup has no identified blocker and is ready to merge after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: initializing the updater for headless Electron serve mode.
Description check Passed The description follows the required template and explains the user impact, implementation, rationale, linked issue, testing, compatibility, and checklist status. It also documents that real-host upda…
Linked Issues check Passed Issue #22261 requires headless CLI-supervised macOS serve to initialize the updater and expose the supervised update mode. launchServeMode now calls setupHeadlessServeAutoUpdater after readiness. …
Out of Scope Changes check Passed The production changes stay on the headless Electron updater path and its shared window/headless setup options. The shared option builder preserves existing window behavior and supports the required h…



✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@OrcaWin
OrcaWin force-pushed the np/d1d-serve-updater branch from 9693bad to 43a12a8 Compare October 12, 2026 05:01
@OrcaWin
OrcaWin merged commit ae0ff63 into main Oct 12, 2026
32 checks passed
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.

[Bug]: CLI-supervised macOS orca serve never initializes remote updater

1 participant