Skip to content

feat(macos): cache exact plugins for prewarmed builds - #130544

Closed
Patrick-Erichsen wants to merge 3 commits into
pe/macos-prewarmed-core-runtimefrom
pe/macos-prewarmed-plugin-cache
Closed

Patrick-Erichsen wants to merge 3 commits into
pe/macos-prewarmed-core-runtimefrom
pe/macos-prewarmed-plugin-cache

Conversation

@Patrick-Erichsen

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

Copy link
Copy Markdown
Contributor

Summary

Add a commit/version/hash-bound cache of exact official-plugin archives to opt-in prewarmed development builds. Archives stay dormant until normal onboarding selects that plugin, then flow through the existing managed npm-pack and security path; dependencies still resolve normally from npm.

This is the top layer of the macOS onboarding/prewarm stack and extracts the plugin-cache 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
  4. feat(macos): cache exact plugins for prewarmed builds #130544 — exact prewarmed official-plugin cache (this PR)

Scope boundary

This PR adds cache staging, manifest verification, installation, and onboarding consumption. It does not bypass the normal plugin trust/install path and does not install or expose plugins before selection.

Evidence

Mac Studio validation at exact head fd4b38b6a5727302776dd5975af5165149265e52:

  • focused Vitest: 278 tests passed
  • CLIInstallerTests: 24/24
  • MacGatewayProfilesTests: 17/17
  • script declaration check passed
  • added the required scripts/prewarmed-plugin-cache.d.mts
  • corrected plugin-cache rollback output to the structured installer JSON contract
  • opt-in OpenClaw.app package completed successfully with ad-hoc development signing
  • deep code-sign verification passed
  • exact runtime manifest and running CLI both report 2026.8.1 / fd4b38b6a5727302776dd5975af5165149265e52
  • embedded runtime SHA-256 matched its manifest
  • plugin-cache manifest SHA-256 matched its app manifest
  • cache contains 89 entries with 89 unique plugin IDs

Draft status

Real guest acceptance is blocked before OpenClaw execution. After restoring both pristine macOS Tahoe Clean snapshots, Parallels reported GuestTools: state=not_installed; prlctl exec had no session, the guest exposed no IP/SSH route, and prlctl capture also hung. The exact VM process was stopped without restarting Parallels, the original snapshot {1cca537a-4fa6-45b0-864c-174cadeca6f4} was restored, the guest was left stopped, and the two unrelated installer VMs remained running and 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos scripts Repository scripts commands Command implementations size: XL maintainer Maintainer-authored PR labels Aug 27, 2026
@Patrick-Erichsen Patrick-Erichsen changed the title pe/macos prewarmed plugin cache feat(macos): cache exact plugins for prewarmed builds Aug 27, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 26, 2026, 8:56 PM ET / August 27, 2026, 00:56 UTC.

ClawSweeper review

What this changes

Adds a hash-bound archive cache for official plugins to opt-in prewarmed macOS development builds, then uses matching archives during normal plugin onboarding.

Merge readiness

⛔ Blocked until real behavior proof is added - 9 items remain

Keep open: the new profile-state cache can be rewritten with a matching manifest hash and then receives a trusted-install bypass that skips the configured before-install hook. This draft, maintainer-labeled stacked PR needs the trust boundary repaired and demonstrated before merge.

Priority: P1
Reviewed head: fd4b38b6a5727302776dd5975af5165149265e52
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The feature has meaningful implementation and test coverage, but an unresolved security-boundary bypass blocks merge readiness.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: Authority-chain proof required: show that a rewritten profile-state manifest and archive cannot reach a trusted installation or bypass the before-install hook; redact any private paths or account data in the evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🧂 unranked krab (1/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: Authority-chain proof required: show that a rewritten profile-state manifest and archive cannot reach a trusted installation or bypass the before-install hook; redact any private paths or account data in the evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 7 items Mutable cache receives trusted-install status: The resolver reads the manifest and archive digest from profile-state cache files, then returns a cache hit when those self-authored values agree.
Changed onboarding path grants the bypass: Every cache hit is passed to the archive installer with trustedSourceLinkedOfficialInstall set to true.
Trusted flag skips material hook: The security scan returns after policy evaluation when the trusted flag is true, before the before-install hook path.
Findings 1 actionable finding [P1] Do not trust archives from mutable profile cache
Security Needs attention Mutable cache can bypass before-install hook: An attacker able to rewrite the retained cache archive and its manifest digest can produce a cache hit that skips the before-install hook, even though the installer classifies the archive source as mutable user data.

How this fits together

The macOS packager stages plugin archives beside a prewarmed runtime, and the installer copies them into profile state. Onboarding later resolves a selected archive and sends it through the managed npm plugin installer.

flowchart LR
  A[Opt-in macOS build] --> B[Plugin archive cache]
  B --> C[Profile-state cache]
  C --> D[Onboarding plugin selection]
  D --> E[Cache validation]
  E --> F[Managed plugin installer]
  F --> G[Install policy and hooks]
Loading

Decision needed

Question Recommendation
Should a profile-state prewarmed cache ever bypass the before-install hook, and if so what immutable authenticity root will be verified at consumption? Retain normal install friction: Do not pass the trusted-install flag for archives read from profile state, while retaining cache integrity checks and normal policy/hook handling.

Why: The current cache digest is stored alongside the mutable archive, so preserving the trusted bypass requires a security-boundary design choice rather than a mechanical test-only change.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: Authority-chain proof required: show that a rewritten profile-state manifest and archive cannot reach a trusted installation or bypass the before-install hook; redact any private paths or account data in the evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Do not trust archives from mutable profile cache (P1) - A cache hit is promoted to trustedSourceLinkedOfficialInstall, but the manifest SHA and archive SHA are both read from the profile-state cache. Replacing both files while preserving package identity still reaches this line and skips the before-install hook; retain normal install friction or verify an independent immutable authenticity root.
  • Resolve security concern: Mutable cache can bypass before-install hook - An attacker able to rewrite the retained cache archive and its manifest digest can produce a cache hit that skips the before-install hook, even though the installer classifies the archive source as mutable user data.
  • Resolve merge risk (P1) - A process that can modify the profile-state cache can replace both archive and manifest digest, retain the expected package identity, and bypass the before-install hook when onboarding selects that plugin.
  • Complete next step (P2) - A concrete security finding is established, but maintainers must choose whether mutable profile-state archives may retain any trusted-install semantics.
  • Improve patch quality - Remove the trusted-source bypass for profile-state archives, or add independent immutable authenticity verification at consumption.
  • Improve patch quality - Add a regression that rewrites both the cached manifest and archive and proves the before-install hook still runs or installation fails.
  • Improve patch quality - Provide redacted final-effect proof for both the valid cache and the forged-cache case; update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review if needed.

Findings

  • [P1] Do not trust archives from mutable profile cache — src/commands/onboarding-plugin-install.ts:1292-1293
  • [high] Mutable cache can bypass before-install hook — src/commands/onboarding-plugin-install.ts:1292
Agent review details

Security

Needs attention: The patch creates a concrete plugin-install trust escalation from mutable profile-state cache data.

PR surface

Source +205, Tests +476, Docs +2, Config 0, Other +492. Total +1175 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 3 213 8 +205
Tests 8 480 4 +476
Docs 1 3 1 +2
Config 1 1 1 0
Generated 0 0 0 0
Other 9 514 22 +492
Total 22 1211 36 +1175

Review metrics

Metric Value Why it matters
Production versus test delta production/tooling +720/-30; tests +491/-6 The feature adds substantial packaging, installer, and trust-boundary code, so the missing forged-cache security regression is material.

Stored data model

Persistent data-model change detected: database schema: apps/macos/Sources/OpenClaw/CLIInstaller.swift, database schema: apps/macos/Tests/OpenClawIPCTests/CLIInstallerTests.swift, database schema: scripts/install-cli.sh, database schema: scripts/package-mac-app.sh, database schema: scripts/prewarmed-plugin-cache.d.mts, database schema: src/plugins/prewarmed-plugin-cache.test.ts, and 24 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Remove profile-cache trust escalation (recommended)
    Keep the verified cache as an offline source but run the existing before-install hook for every archive read from profile state.
  2. Pause for an immutable trust design
    Retain the bypass only after maintainers approve an independently verifiable authenticity root and its revocation behavior.

Technical review

Best possible solution:

Keep profile-staged archives on the ordinary install-safety path unless consumption can verify an immutable authority-bound cache signature or digest independent of the mutable cache.

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

Yes, source-reproducible: replace a cached archive and its manifest SHA together after staging, then select that official plugin during onboarding; the changed path grants trusted installation.

Is this the best way to solve the issue?

No: the current self-authored cache digest cannot justify bypassing the existing before-install hook after the cache enters mutable profile state.

Full review comments:

  • [P1] Do not trust archives from mutable profile cache — src/commands/onboarding-plugin-install.ts:1292-1293
    A cache hit is promoted to trustedSourceLinkedOfficialInstall, but the manifest SHA and archive SHA are both read from the profile-state cache. Replacing both files while preserving package identity still reaches this line and skips the before-install hook; retain normal install friction or verify an independent immutable authenticity root.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 35adcc6c6f3b.

Labels

Label changes:

  • add P1: The patch introduces a reachable bypass of a plugin installation safety hook through mutable profile state.
  • add merge-risk: 🚨 security-boundary: A cache hit promotes mutable local archive contents to trusted-install handling.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Authority-chain proof required: show that a rewritten profile-state manifest and archive cannot reach a trusted installation or bypass the before-install hook; redact any private paths or account data in the evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P1: The patch introduces a reachable bypass of a plugin installation safety hook through mutable profile state.
  • merge-risk: 🚨 security-boundary: A cache hit promotes mutable local archive contents to trusted-install handling.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Authority-chain proof required: show that a rewritten profile-state manifest and archive cannot reach a trusted installation or bypass the before-install hook; redact any private paths or account data in the evidence. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [high] Mutable cache can bypass before-install hook — src/commands/onboarding-plugin-install.ts:1292
    An attacker able to rewrite the retained cache archive and its manifest digest can produce a cache hit that skips the before-install hook, even though the installer classifies the archive source as mutable user data.
    Confidence: 0.98

What I checked:

Likely related people:

  • Peter Steinberger: Recent current-main history owns the managed installer and onboarding paths adjacent to this trust boundary. (role: recent area contributor; confidence: high; commits: b10beeee7c24, da2684aee8; files: src/commands/onboarding-plugin-install.ts, src/plugins/install-npm-pack.ts, scripts/install-cli.sh)
  • Hannes Rudolph: The PR attributes the feature commit to Hannes, and nearby macOS/Codex onboarding work appears in the feature history. (role: feature owner; confidence: medium; commits: 51cd127aac1a, 34c3d15a6d7f; files: scripts/prewarmed-plugin-cache.mjs, scripts/stage-macos-prewarmed-plugin-cache.mts)

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.

@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.

@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-plugin-cache 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 commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants