Skip to content

feat(macos): bundle an exact prewarmed core runtime - #130543

Closed
Patrick-Erichsen wants to merge 8 commits into
pe/macos-onboarding-keychainfrom
pe/macos-prewarmed-core-runtime
Closed

Patrick-Erichsen wants to merge 8 commits into
pe/macos-onboarding-keychainfrom
pe/macos-prewarmed-core-runtime

Conversation

@Patrick-Erichsen

@Patrick-Erichsen Patrick-Erichsen commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Let opt-in development macOS builds embed and install the exact OpenClaw core runtime that produced the app. The runtime is verified and installed transactionally into profile-owned state; release builds continue to reject the opt-in flag.

This is layer 3 of the macOS onboarding/prewarm stack and extracts the core-runtime half of #124831. Hannes Rudolph remains the author of the feature commits.

Stack

  1. fix(macos): allow cold ChatGPT Codex probes #130541 — Codex cold-start probe
  2. fix(macos): keep Gateway profile Keychain reads noninteractive #130542 — noninteractive Gateway-profile Keychain access
  3. feat(macos): bundle an exact prewarmed core runtime #130543 — exact prewarmed core runtime (this PR)
  4. feat(macos): cache exact plugins for prewarmed builds #130544 — exact prewarmed official-plugin cache

Scope boundary

This PR contains the packaging/install contract for the core runtime only. It deliberately excludes the official-plugin archive cache and its onboarding consumer, which live in #130544.

Evidence

  • Mac Studio focused test pass includes installer, packaging, command, and tooling coverage.
  • CLIInstallerTests: 24/24 on the Mac Studio.
  • Installer progress output was updated to the current structured emit_json contract.
  • The top stack head packaged OpenClaw.app successfully with the explicit ad-hoc development-signing fallback.
  • Deep code-sign verification passed; the runtime manifest identifies exact commit fd4b38b6a5727302776dd5975af5165149265e52.
  • Embedded runtime SHA-256 matched the manifest.

Draft status

The dedicated macOS Tahoe Clean VM could not begin app acceptance after either pristine snapshot was restored: Parallels reported GuestTools: state=not_installed, prlctl exec could not open a session, no guest IP was available, and even prlctl capture hung. The VM was restored to snapshot {1cca537a-4fa6-45b0-864c-174cadeca6f4} and left stopped; unrelated installer VMs were untouched.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos scripts Repository scripts size: L maintainer Maintainer-authored PR labels Aug 27, 2026
@Patrick-Erichsen Patrick-Erichsen changed the title pe/macos prewarmed core runtime feat(macos): bundle an exact prewarmed core runtime Aug 27, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

CI note: the two red Website Installer Sync checks are the Fedora 44 root/non-root lanes. This branch has no diff in scripts/install.sh; both jobs fail before OpenClaw installation because NodeSource currently installs unexpected v26.8.0-alpha.0.0.0 at /usr/sbin/node, which the stable-version guard rejects. The macOS installer lane and the stack-specific host package proof pass.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 7, 2026, 4:42 AM ET / 08:42 UTC (Revision 4).

ClawSweeper review

What this changes

The branch lets development macOS apps bundle a verified, matching Node and OpenClaw archive and install it into the selected profile without downloading or building OpenClaw.

Merge readiness

⛔ Blocked before merge - 9 items remain

Keep open for maintainer handling. Current main now bundles a matching private runtime, substantially overlapping this proposal, but the protected PR cannot be automatically closed. All five previously reported defects remain in the unchanged head.

Priority: P2
Reviewed head: 23095105acad8a3b4eda58371477cb42975bdbed

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful packaging evidence and focused coverage remain, but unchanged installation defects and a newer canonical runtime architecture prevent merge readiness.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The ordinary external-contributor gate does not apply to the supplied MEMBER-authored, maintainer-protected PR. Captured Mac Studio evidence exercises packaging and archive identity at the top stack head, while packaged-app installation and recovery remain unverified because guest acceptance never began. No persisted user-data format changes were identified.
Patch quality 🦐 gold shrimp (3/6) 5 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor gate does not apply to the supplied MEMBER-authored, maintainer-protected PR. Captured Mac Studio evidence exercises packaging and archive identity at the top stack head, while packaged-app installation and recovery remain unverified because guest acceptance never began. No persisted user-data format changes were identified.
Evidence reviewed 10 items Pinned ownership and review continuity: The introduced delta is ba998ac..2309510. HEAD equals the previous completed review SHA; comparisons of the affected files produced no changes. The supplied test merge is stale and was not used to claim removal of current-main behavior.
Packaging invokes service finalization: The new packaging invocation runs installer main with the ordinary account environment. Installer main calls refresh_gateway_service_if_loaded independently of onboarding; that function runs gateway install --force. Package cleanup subsequently removes the temporary prefix.
Verification and rollback defects: Both staged Node probes expand the executable without quoting. Rollback unconditionally deletes the existing launcher, including when Node-pointer activation fails before the launcher has been backed up.
Findings 5 actionable findings [P1] Keep packaging out of the build host's Gateway lifecycle
[P2] Reuse the bundled target for automatic repairs
[P2] Keep commit mismatches separate from parseable version fields
Security None None.

How this fits together

The macOS packager creates the runtime archive, and app onboarding passes it to the managed CLI installer. The installed runtime then supplies the CLI and local Gateway service.

flowchart TD
  A[Development app build] --> B[Runtime packaging]
  B --> C[Archive and identity manifest]
  C --> D[App setup and repair]
  D --> E[Verify and install runtime]
  E --> F[Profile CLI]
  F --> G[Local Gateway service]
Loading

Before merge

  • Keep packaging out of the build host's Gateway lifecycle (P1) - With a loaded Gateway in the ordinary account environment, this installer invocation reaches refresh_gateway_service_if_loaded() despite --no-onboard. It runs gateway install --force from the temporary prefix, potentially replacing the operator's service; package cleanup then deletes that runtime. Stage through provisioning functions without installer service finalization, as current main's staging owner does. This prior finding remains unchanged.
  • Reuse the bundled target for automatic repairs (P2) - The new setup path selects .prewarmed, but automatic managed repair still calls .exact(version). When an older managed CLI needs repair, this requests the published package instead of the embedded matching build; an unpublished development version fails or a published build has the wrong commit. Share target selection with the repair path while retaining channel and downgrade protections. This prior finding remains unchanged.
  • Keep commit mismatches separate from parseable version fields (P2) - A commit mismatch now places parenthesized commit text in .incompatible's found and required values. shouldAutomaticallyRepair passes those fields to Semver.parse, which cannot parse the resulting patch component, so the repair gate rejects the mismatch. Represent build identity separately and route same-version commit recovery explicitly. This prior finding remains unchanged.
  • Quote the staged Node executable in both probes (P2) - Both command substitutions expand $node_path unquoted. A valid profile prefix such as /Users/Test User/.openclaw splits the executable path, causing verification to fail before installation. Quote the executable in both invocations and cover an actual whitespace-containing prefix. This prior finding remains unchanged.
  • Preserve the launcher when rollback precedes its backup (P2) - If activating the Node pointer fails, rollback runs before the existing launcher is moved to backup_wrapper. It nevertheless deletes $PREFIX/bin/openclaw, and no backup exists to restore it, leaving the previously working installation without its launcher. Track which transaction steps completed and undo only those steps. This prior finding remains unchanged.
  • Resolve merge risk (P1) - Fresh-profile installation and existing-profile upgrade/recovery remain unverified through the packaged app; packaging and hash checks do not establish preservation of a working CLI and Gateway.
  • Resolve merge risk (P1) - The proposed Node-archive flow must be reconciled with current main's bundled Bun runtime before landing; no valid pinned test merge establishes how these architectures compose.
  • Complete next step (P2) - Reconcile the retained implementation with current main's bundled runtime and resolve the five unchanged findings before considering this branch for merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P1] Keep packaging out of the build host's Gateway lifecycle — scripts/package-mac-app.sh:681-686
  • [P2] Reuse the bundled target for automatic repairs — apps/macos/Sources/OpenClaw/CLIInstallPrompter.swift:74-76
  • [P2] Keep commit mismatches separate from parseable version fields — apps/macos/Sources/OpenClaw/CLIInstaller.swift:391-395
Agent review details

Security

None.

PR surface

Tests +244, Docs +12, Config 0, Other +558. Total +814 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 5 245 1 +244
Docs 1 12 0 +12
Config 1 1 1 0
Generated 0 0 0 0
Other 10 593 35 +558
Total 17 851 37 +814

Review metrics

Metric Value Why it matters
Production versus test growth production/tooling +482 net; tests +320 net; docs +12 Growth implements a new archive-install capability, but current main now provides a canonical bundled-runtime owner that may eliminate much of this parallel implementation.
New installation controls 2 CLI flags and 2 packaging environment variables added These expose an additional runtime-selection path whose setup and repair behavior must remain consistent.

Stored data model

Persistent data-model change detected: database schema: apps/macos/Sources/OpenClaw/CLIInstaller.swift, database schema: scripts/install-cli.sh, serialized state: scripts/verify-macos-prewarmed-runtime.mts, unknown-data-model-change: scripts/verify-macos-prewarmed-runtime.mts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Align with canonical runtime ownership (recommended)
    Rework any remaining unique capability onto current main's isolated staging and bundled-runtime lifecycle, then verify fresh installation and upgrade recovery.
  2. Retire the overlapping proposal manually
    A maintainer can retire this protected branch after confirming the current bundled runtime satisfies its development workflow.

Technical review

Best possible solution:

Use current main's canonical bundled-runtime staging and seeding owners, carrying forward only demonstrably missing behavior with transactional recovery and packaged-app upgrade proof.

Do we have a high-confidence way to reproduce the issue?

Yes, the unchanged branch provides clear source-level triggers: packaging with a loaded Gateway, installation beneath a path containing spaces, Node-pointer activation failure, and automatic repair of a prewarmed build. These scenarios were not executed during this read-only review.

Is this the best way to solve the issue?

No, this branch is no longer the best implementation shape: current main already owns matching-runtime packaging and profile seeding, while this parallel installer retains five concrete defects.

Full review comments:

  • [P1] Keep packaging out of the build host's Gateway lifecycle — scripts/package-mac-app.sh:681-686
    With a loaded Gateway in the ordinary account environment, this installer invocation reaches refresh_gateway_service_if_loaded() despite --no-onboard. It runs gateway install --force from the temporary prefix, potentially replacing the operator's service; package cleanup then deletes that runtime. Stage through provisioning functions without installer service finalization, as current main's staging owner does. This prior finding remains unchanged.
    Confidence: 0.99
  • [P2] Reuse the bundled target for automatic repairs — apps/macos/Sources/OpenClaw/CLIInstallPrompter.swift:74-76
    The new setup path selects .prewarmed, but automatic managed repair still calls .exact(version). When an older managed CLI needs repair, this requests the published package instead of the embedded matching build; an unpublished development version fails or a published build has the wrong commit. Share target selection with the repair path while retaining channel and downgrade protections. This prior finding remains unchanged.
    Confidence: 0.98
  • [P2] Keep commit mismatches separate from parseable version fields — apps/macos/Sources/OpenClaw/CLIInstaller.swift:391-395
    A commit mismatch now places parenthesized commit text in .incompatible's found and required values. shouldAutomaticallyRepair passes those fields to Semver.parse, which cannot parse the resulting patch component, so the repair gate rejects the mismatch. Represent build identity separately and route same-version commit recovery explicitly. This prior finding remains unchanged.
    Confidence: 0.99
  • [P2] Quote the staged Node executable in both probes — scripts/install-cli.sh:1756-1757
    Both command substitutions expand $node_path unquoted. A valid profile prefix such as /Users/Test User/.openclaw splits the executable path, causing verification to fail before installation. Quote the executable in both invocations and cover an actual whitespace-containing prefix. This prior finding remains unchanged.
    Confidence: 1
  • [P2] Preserve the launcher when rollback precedes its backup — scripts/install-cli.sh:1786-1787
    If activating the Node pointer fails, rollback runs before the existing launcher is moved to backup_wrapper. It nevertheless deletes $PREFIX/bin/openclaw, and no backup exists to restore it, leaving the previously working installation without its launcher. Track which transaction steps completed and undo only those steps. This prior finding remains unchanged.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against fa420c6eb275.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is an opt-in development capability with concrete installation defects, rather than a proven urgent regression in a shipped default.
  • merge-risk: 🚨 availability: Packaging can replace the build account's loaded Gateway with a temporary runtime, and rollback can remove its existing CLI launcher.
  • merge-risk: 🚨 compatibility: Exact-build installation and repair must preserve existing channel choices and compose with current main's bundled-runtime lifecycle.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The ordinary external-contributor gate does not apply to the supplied MEMBER-authored, maintainer-protected PR. Captured Mac Studio evidence exercises packaging and archive identity at the top stack head, while packaged-app installation and recovery remain unverified because guest acceptance never began. No persisted user-data format changes were identified.

Evidence

What I checked:

  • Pinned ownership and review continuity: The introduced delta is ba998ac..2309510. HEAD equals the previous completed review SHA; comparisons of the affected files produced no changes. The supplied test merge is stale and was not used to claim removal of current-main behavior. (23095105acad)
  • Packaging invokes service finalization: The new packaging invocation runs installer main with the ordinary account environment. Installer main calls refresh_gateway_service_if_loaded independently of onboarding; that function runs gateway install --force. Package cleanup subsequently removes the temporary prefix. (scripts/package-mac-app.sh:681, 23095105acad)
  • Verification and rollback defects: Both staged Node probes expand the executable without quoting. Rollback unconditionally deletes the existing launcher, including when Node-pointer activation fails before the launcher has been backed up. (scripts/install-cli.sh:1756, 23095105acad)
  • Setup and automatic repair diverge: Interactive setup selects the prewarmed target, but automatic repair still installs .exact(version). Commit mismatches are encoded into incompatible found/required strings, while the repair gate parses those strings as SemVer; the parenthesized commit makes parsing fail. (apps/macos/Sources/OpenClaw/CLIInstaller.swift:391, 23095105acad)
  • Existing test coverage: Swift coverage verifies target construction and commit classification. The Darwin installer test uses a fake Node executable, a whitespace-free prefix, and a successful transaction; it does not exercise loaded-service packaging or rollback failures. Tests were inspected, not executed. (test/scripts/install-cli-prewarmed.test.ts:19, 23095105acad)
  • Current-main alternative: Current main stages a matching private Bun runtime. BundledRuntime validates version, commit, timestamp, and build ID; its seeding owner publishes profile-local builds and retains the previous build. CLIInstaller uses that seeded runtime for bundled-app status. This covers the central problem through a different architecture, without establishing automatic-close provenance. (apps/macos/Sources/OpenClaw/NodeMode/BundledRuntime.swift:70, fa420c6eb275)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Reconcile remaining unique behavior with current main's bundled-runtime owner instead of retaining a parallel installer.
  • Resolve all five prior findings with boundary coverage for loaded services, whitespace paths, commit repair, and rollback failures.
  • Record redacted packaged-app fresh-install and upgrade/recovery results for the retained implementation.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-27T00:55:47.294Z sha 2309510 :: found issues before merge. :: [P2] Reuse the prewarmed target for automatic repairs
  • reviewed 2026-09-04T22:45:50.492Z sha 2309510 :: blocked before merge. :: [P2] Reuse the prewarmed target for automatic repairs | [P2] Keep commit-mismatch status usable by automatic repair
  • reviewed 2026-09-08T19:03:15.240Z sha 2309510 :: blocked before merge. :: [P1] Keep packaging out of the build host’s Gateway lifecycle | [P2] Reuse the prewarmed target for automatic repairs | [P2] Represent commit mismatches separately from version display text | [P2] Quote the staged Node executable in both verification probes | [P2] Preserve the launcher when rollback precedes its backup

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Sep 7, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Closing as stale: this macOS onboarding/prewarm stack has been inactive since August, and main now bundles a matching private runtime.

Closed by Roboclaw at the author's request after an audit of his open PRs. The branch is kept, so this can be reopened if needed.

@RomneyDa
RomneyDa deleted the pe/macos-prewarmed-core-runtime branch November 30, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants