Skip to content

fix(plugins): restore on-demand installs in standalone builds - #174133

Merged
steipete merged 3 commits into
mainfrom
fix/standalone-plugin-install
Oct 16, 2026
Merged

steipete merged 3 commits into
mainfrom
fix/standalone-plugin-install

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Standalone builds prune the npm CLI and its runtime dependencies, so installing an omitted plugin fails with “Bundled npm CLI is missing” before registry access.

User Impact

Restores on-demand plugin installation without requiring host Node, Bun, or npm. Existing registry configuration/authentication, package-lock integrity verification, and lifecycle-script restrictions remain with npm.

Why This Change Was Made

The builder now declares npm's runtime closure as a sidecar resource and records its version, entrypoint, file count, and bytes in the manifest. The shared CLI invocation owner selects the sidecar entrypoint and runs it through the same executable with BUN_BE_BUN=1; the three shared npm environment paths cover metadata, configuration probes, installs, peer planning, and removal. Existing public Bun and CommonJS resolver hooks map their final load targets into the embedded SDK image while admission and discovery retain physical paths.

Native Bun package management is not an equivalent replacement: the installer requires npm's projected view output, remote/archive pack JSON, configuration probes, peer planning, and package-lock.json integrity records. The pinned Bun supports self-as-Bun execution but does not provide those npm contracts. The retained npm 12.2.0 closure adds 1,591 files / 9,215,364 bytes; documentation, maps, declarations, and unrelated npm bin entrypoints are excluded.

Evidence

  • Real packaged npm configuration and script-free archive packing after pruning its source dependency tree; archive SHA-512 matches its receipt.
  • Node: command resolver 4 tests (8.18 s wall), closure 1 test (17.06 s wall). Production-pinned Bun: the same 5 tests (40.13 s wall).
  • Shared npm environment/archive and standalone manifest regressions pass; focused lint/typechecks and Codex autoreview through P2 pass.
  • Full pnpm build passed (737.48 s wall); final desktop-selection standalone build passed (1,165.59 s). Developer ID signed, JIT entitlements; 76 embedded / 92 omitted plugins, including omitted Teams.
  • Before: npm install exits 1 in 4.242 s because npm is absent. After: fresh-profile npm:@openclaw/[email protected] install passes in 21.124 s; ClawHub install passes in 27.543 s. Both list and inspect as loaded with no diagnostics, and both running Gateways report Teams active with successful health RPCs. Uninstalls pass (105.000 s / 99.357 s) and remove installation directories.
  • App-like sandbox: npm install 29.673 s, loaded inspection 47.314 s, uninstall 81.913 s. All exit 0. Retains filesystem, Keychain and service restrictions; enables outbound registry networking. All live proof uses isolated homes/state, no host JavaScript runtime on PATH, no preload, and no parent BUN_BE_BUN override.
  • Live qualification exposed an installed-CommonJS SDK load failure after the initial npm repair. The final handoff correction passes 13 regressions (2.41 s wall), lint, focused typecheck, fresh Codex review, and the complete signed lifecycle above.
  • Exact-head CI run 38896843657 is green on 558bef7. A superseded head hit a UI locator timeout; the exact test passed on both PR and clean main. Broad local checks also reproduced three UI max-lines baseline errors and two dead exports on clean main; none is changed by this PR.
  • Qualification limitation: the builder-only follow-up reused Control UI assets carrying the prior proof build metadata, so Gateway logs a stale-UI warning. Plugin lifecycle and readiness pass; this run does not qualify the Control UI or a connected Teams account.

Related: #172802, #172569, #173794. Includes the public SDK hook correction from #173794 and completes its CommonJS handoff. Qualification uses that PR's plugin-selection changes, excluding its separate npm embedding experiment.

Declare npm and its bundled runtime closure as standalone resources, record its size and file count, and run it through the compiled executable in Bun mode. Preserve npm configuration, lockfile integrity checks, and script-free installation semantics for on-demand plugins.
@clawsweeper

clawsweeper Bot commented Oct 16, 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.

@steipete
steipete marked this pull request as ready for review October 16, 2026 10:58
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T11:57:58.403427Z 558bef7 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: M labels Oct 16, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Retains npm and its runtime dependencies in standalone artifacts and runs npm through the compiled executable’s Bun mode.

Example: Install npm:@openclaw/[email protected] from a standalone artifact without host Node, Bun, or npm.

  • Before: Installation stops before download because the bundled npm CLI is missing.
  • After: The installer selects runtime/npm/bin/npm-cli.js and executes it with BUN_BE_BUN=1.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, useful repair with meaningful packaged-npm coverage and no definite introduced defect; compiled-runtime qualification remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate is exempt for this maintainer-authored PR; supplied Node/Bun tests exercise packaged npm configuration and script-free packing, while compiled self-as-Bun installation qualification remains explicitly pending.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Standalone users cannot install omitted plugins because the packaged npm CLI is missing.
Reason: The maintainer-approved repair restores the existing installation capability without replacing npm semantics or adding user configuration.

Regression provenance

Regression provenance — verified: source commit 9df29068d92a by Peter Steinberger; canonical PR #172802 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it addresses a confirmed standalone installation failure still present on main, follows maintainer-approved direction, and introduces no definite correctness defect found in this review.

Priority: P2
Reviewed head: 6d774abc91cd8cd6d85409d06b4ffa0d9d285015

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not yet show a compiled standalone artifact installing, loading, using, and uninstalling an omitted plugin without host runtimes, or a base-fail/head-pass regression run.
Agent review details

How this fits together

The standalone builder turns a completed OpenClaw build into an executable, resource sidecar, and manifest; shared npm command and environment owners then serve plugin metadata, installation, peer planning, and removal.

flowchart TD
  A[Completed OpenClaw build] --> B[Standalone resource planner]
  C[Bundled npm runtime] --> B
  B --> D[Executable and sidecar]
  E[Plugin install request] --> F[Shared npm command and environment]
  D --> F
  F --> G[npm registry and managed plugin root]
Loading

Technical review

Best possible solution:

Retain npm’s declared sidecar closure and existing installation owners, then complete the recorded compiled-artifact qualification.

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

Current-main pruning and npm resolution explain the missing-CLI failure, and the linked desktop qualification records that exact failure through a real plugin installation command; no target code was executed during this review.

Is this the best way to solve the issue?

The repair fits the existing resource planner and CLI invocation owner while preserving npm-specific metadata, peer-planning, integrity, and lifecycle-script contracts.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Standalone resource pruning changes intended behavior with a stated reason (9df2906: Shrink standalone sidecars by retaining explicitly owned disk resources and removing the loose dependency tree.)
  • Bun npm command selection keeps the original intent (5c3d2ee: Use bundled npm under Bun to preserve managed installation and package-lock semantics without host Node or npm.)
  • Standalone executable identity keeps the original intent (3bfccdb: Centralize executable identity and invocation shape for compiled and loose runtimes.)
  • Project-local npm environment keeps the original intent (cbe5515: Prevent inherited npm global settings from redirecting project dependency installations.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Current-main failure remains: Main excludes node_modules from ordinary sidecar resources while its npm resolver still requires npm/package.json; the PR adds the missing explicit resource declaration. (scripts/lib/bun-standalone-sidecar.mjs:106, b4ce369de7e8)
  • Introduced repair verified: The pinned introduction diff retains npm’s package topology, declares its resource category, and carries Bun execution mode through the existing metadata, configuration-probe, and project-install environment owners. (scripts/lib/bun-standalone-package-manager.mjs:6, 6d774abc91cd)
  • Recorded production failure: The qualification in feat(macos): launch the compiled OpenClaw runtime #172569 records the msteams installation failing before download because packaged npm files are absent, and identifies retaining npm’s child-program closure as the owner follow-up.
  • Existing npm contracts preserved: Install, peer-planning, and uninstall callers retain their shared script-disabled environment; no dependency version, registry policy, lockfile format, or plugin authorization contract changes. (src/infra/safe-package-install.ts:24, 6d774abc91cd)
  • Qualification pause recorded: The maintainer-authored body explicitly leaves signed desktop install/load/Gateway/uninstall qualification in progress and says merging follows that proof. (6d774abc91cd)
  • Required CI remains unresolved: The exact-head UI E2E check times out waiting for the cloud:aws selector and causes the CI gate to fail; available evidence does not establish whether this is inherited or caused by the diff. (ui/src/e2e/session-placement.move.e2e.test.ts, 6d774abc91cd)

Likely related people:

  • Peter Steinberger: Raw commit 9df2906 adds scripts/lib/bun-standalone-sidecar.mjs:106 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9df29068d92a; files: scripts/lib/bun-standalone-sidecar.mjs)
  • Vincent Koc: Raw commit 7996775 adds src/infra/npm-command.ts:32 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 799677545245; files: src/infra/npm-command.ts)

PR surface

Source +6, Tests +110, Docs +7, Other +88. Total +211 across 12 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 11 5 +6
Tests 3 110 0 +110
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 5 89 1 +88
Total 12 217 6 +211

Labels

Label changes:

  • add P2: Repairs on-demand plugin installation in the new standalone packaging path, with limited blast radius and no established stable-release outage.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Repairs on-demand plugin installation in the new standalone packaging path, with limited blast radius and no established stable-release outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Complete the recorded standalone qualification through real plugin install, load, Gateway use, and uninstall without host Node, Bun, or npm.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 16, 2026, 7:28 AM ET / 11:28 UTC.

@steipete
steipete merged commit 319e515 into main Oct 16, 2026
149 of 150 checks passed
@steipete
steipete deleted the fix/standalone-plugin-install branch October 16, 2026 12:21
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 16, 2026
…ge harness

Main hourly 38902471699 failed check-dependencies on two exports that lost
their last consumers: the SessionWorkspaceRail re-export (callers import the
Solid module directly since #174068) and SynologyChatAccountRaw (only used
inside types.ts since #173734).

The package-openclaw-for-docker trusted-harness test copies a fixed file
closure; #174133 made src/infra/npm-command.ts import ../../cli-invocation.mjs,
so the harness failed with MODULE_NOT_FOUND. cli-invocation.mjs only imports
node builtins. Negative control on current main fails on macOS too; with the
file added the case passes.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…aw#174133)

* fix(plugins): retain npm runtime for standalone installs

Declare npm and its bundled runtime closure as standalone resources, record its size and file count, and run it through the compiled executable in Bun mode. Preserve npm configuration, lockfile integrity checks, and script-free installation semantics for on-demand plugins.

* test(build): declare absent package manager in manifest fixture

* fix(build): map installed plugin SDK loads into standalone image
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…ge harness

Main hourly 38902471699 failed check-dependencies on two exports that lost
their last consumers: the SessionWorkspaceRail re-export (callers import the
Solid module directly since openclaw#174068) and SynologyChatAccountRaw (only used
inside types.ts since openclaw#173734).

The package-openclaw-for-docker trusted-harness test copies a fixed file
closure; openclaw#174133 made src/infra/npm-command.ts import ../../cli-invocation.mjs,
so the harness failed with MODULE_NOT_FOUND. cli-invocation.mjs only imports
node builtins. Negative control on current main fails on macOS too; with the
file added the case passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant