Repository navigation
fix(cloud-workers): build complete source runtime artifacts - #130735
Conversation
Allow the canonical package builder to include explicitly selected source runtime plugins with exact target-installed dependencies and regenerated inventory. Preserve concise enrollment prerequisite errors without changing trust or normal core publication. Fixes #130702. Complete source-built cloud worker packages now retain required runtime plugins; deployment artifacts must be rebuilt from the landed source.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 27, 2026, 2:00 AM ET / 06:00 UTC. ClawSweeper reviewWhat this changesThe PR adds a repeatable source-package option for bundling selected external runtime plugins into cloud-worker artifacts, documents the workflow, and keeps enrollment errors concise. Merge readinessKeep this maintainer-labeled PR open: it addresses the linked cloud-worker packaging defect, but its stale-build guard omits peer metadata and can produce an incomplete selected-plugin artifact. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe package builder creates the OpenClaw archive installed on cloud nodes; node enrollment then verifies the bundled Codex plugin and its platform-native runtime before remote execution starts. flowchart LR
A[Trusted source checkout] --> B[Package builder]
B --> C[Selected runtime plugin]
C --> D[Cloud worker archive]
D --> E[Node installation]
E --> F[Enrollment validation]
F --> G[Codex native process]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +4, Tests +241, Docs +21, Other +194. Total +460 across 8 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep the package-composition approach, but validate built peerDependencies and peerDependenciesMeta against source metadata, cover the stale-peer case, then rebuild and clean-install the selected package from the landed SHA. Do we have a high-confidence way to reproduce the issue? Yes, from source: make only dist/extensions/<id>/package.json declare a required peer that source metadata lacks, then package with --skip-build; the current guard accepts that drift and root dependency composition omits the peer. Is this the best way to solve the issue? No: the owner boundary and normal artifact preservation are appropriate, but validation must use all runtime package metadata that the archive actually ships. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against be8b6ff3c469. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Pre-merge record (2026-08-27)Land-ready for a8117c6ead9f4a60e94b25a885b47ed9735abf02, including the peer-metadata finding from the completed ClawSweeper review. The existing parity guard now checks both peer fields. Both stale-peer cases failed before the fix by reaching packing and pass afterward; the full package/preflight/postinstall suite passed 98 tests, three Windows-only skips, including actual selected/default fixture archives and restoration. Fresh isolated autoreview found no actionable P0 defects. The original 286-test evidence remains in the PR body. Commands run for the follow-up: node scripts/run-vitest.mjs test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts -t 'selected built plugin'
node scripts/run-vitest.mjs test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts test/scripts/package-source-preflight.test.ts test/scripts/postinstall-bundled-plugins.test.ts
node scripts/check-changed.mjs -- scripts/lib/package-bundled-plugins.mts test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts
git diff --check c47974ccf4cb780a59dabcf47cbdb35f60a5c516...a8117c6ead9f4a60e94b25a885b47ed9735abf02The first command is the preserved failing reproduction; the full suite and complete changed gate passed after repair. Native publication used Rank-up disposition: peer-field parity and stale-peer regression applied. Full selected-runtime artifact rebuild/target installation remains a separate deployment-owner follow-up, not claimed here. The real Linux arm64 installation/native protocol proof is historical (base b05938b plus repair, Codex 0.149.1, reused full build, candidate digest I personally inspected Codex 0.150.1 at 90854393966b21e9ebfd21b122334eb09a20c93d: native launcher, stdio transport, and initialize test. Launcher/transport are unchanged from 0.149.1; this source check is not a new artifact test. Final exact-head CI33046530552 completed successfully at Post-merge exact-source artifact proof (2026-08-27)The previously deferred full selected-runtime rebuild and target installation are now verified on Linux ARM64 from the actual landed source a7325137451a1f0c0d1b571edb4109216f1cbbd0, including the peer-metadata repair. This is new evidence, not the historical Codex 0.149.1 artifact relabeled. node scripts/package-openclaw-for-docker.mjs --bundle-plugin codex --pnpm-pack --allow-unreleased-changelog --output-dir .artifacts/cloud-node-landed-a7325137451 --output-name openclaw-cloud-a7325137451a1f0c0d1b571edb4109216f1cbbd0.tgzThe canonical command ran with no Artifact: A fresh local Linux ARM64 container with Node 26.7.0 / npm 11.19.0 installed that exact archive with normal lifecycle scripts and an empty credential-free environment. Core/plugin were 2026.8.1; the source-pinned dependency and actual native executable were Codex 0.150.1. Bundled inspection, installed plugin import, newly source-generated prelaunch prerequisites/enablement, and native Parent independently checked the archive digest, source identity, raw result/native/audit receipts, proof scripts, and container absence. Limits remain: ARM64 package/native proof only; no x64 installation, node pairing, real cloud agent turn, registry release, or production adoption. An operator must use an artifact matching the accepted Gateway source cohort; this archive is not implicitly approved for a different deployment SHA. |
|
Merged via squash.
|
…#130735) * fix(cloud-workers): build complete source runtime artifacts Allow the canonical package builder to include explicitly selected source runtime plugins with exact target-installed dependencies and regenerated inventory. Preserve concise enrollment prerequisite errors without changing trust or normal core publication. Fixes openclaw#130702. Complete source-built cloud worker packages now retain required runtime plugins; deployment artifacts must be rebuilt from the landed source. * fix(packaging): reject stale selected plugin peer metadata
Closes #130702
What Problem This Solves
Fixes an issue where source-built cloud workers cannot start Codex remote execution when the installed core-only artifact omits the required external runtime plugin and the exact source-version plugin is not available in the registry.
The worker correctly refuses the missing or untrusted runtime. A standalone local plugin archive does not carry official npm provenance, so changing a server's setup command to install such an archive is not a valid substitute. The missing piece is a complete source-built cloud distribution.
Why This Change Was Made
The canonical package builder now accepts repeatable
--bundle-plugin <id>selections. It builds through the existing source-plugin selection contract, includes only the selected excluded plugins, incorporates their exact declared dependencies into the temporary distribution manifest, and regenerates the installation inventory before packing. Dependency conflicts, nonexact pins, missing or mismatched build output, and private/nonpackaged selections fail visibly. Source metadata and inventory are restored afterward.This is a package-composition capability, not a new runtime installer. Normal core packaging remains lean and unchanged. External plugin publication, trust classification, node enrollment, execution approvals, configuration, protocol, and persistence contracts are unchanged. Native dependencies install for the target platform; the archive does not copy the build machine's plugin
node_modulesor native executable.The same failure also exposed a diagnostic bug in the generated prelaunch Node program: an uncaught exception printed its source and stack after the useful message, displacing that message from the bounded provider error. Catching at that producer preserves the concise reason and exit code 1 without increasing limits, parsing stacks downstream, or weakening prerequisites or cleanup.
User Impact
Operators using unpublished source builds have a documented, reproducible way to produce an exact matching cloud-node artifact, including the required runtime plugin. Existing digest-pinned artifact delivery can install that complete distribution normally. Setup failures retain their actionable reason.
The documented source recipe uses the repository's supported
--pnpm-packoption. A complete artifact must still be generated from the same source revision as its Gateway and delivered through the operator's trusted setup path. No registry release or server-specific workaround is included in this PR.Release note: allow complete source-built cloud worker packages with selected runtime plugins, and preserve concise enrollment failure diagnostics.
Evidence
Actual package and native runtime proof
A real core-only archive installed in clean Linux arm64 with Node 26.7.0, npm 11.19.0, a fresh HOME, and normal package lifecycle scripts reproduced
Plugin not found: codexand the generated prelaunch prerequisite failure (exit 1). The actual archive regression also failed before the source repair because the selected plugin was absent.The final verified candidate installed normally in a second fresh Linux arm64 environment. It reported
@openclaw/[email protected],origin: bundled, exact@openai/[email protected], and prelaunch exit 0. The installed plugin imported successfully. The real platform-native binary then completedinitialize→initialized→environment/info→ stdin EOF, exiting 0 without a signal in a credential-free HOME/CODEX_HOME.d8b85576900558783c65f8fe707a17c0030f73b9836097293fa4d46e13f3dae5244e8531513db999bf71bff0a5cd98cc7a766f1b57f5e5a9fdeee76fa5c5a00cThese are proof artifacts from base
b05938bac10130b2f086a541b04a43a43bd6faa9plus the implementation, not artifacts mislabeled with an eventual merge SHA. The last documentation-only change makes the recipe explicitly match the tested pnpm packing mode. Final deployment artifacts must be rebuilt from the landed source.The ordinary and selected archives passed the canonical tarball checker, including relative import closure and installation inventory parity. Independent archive inspection found no credentials, auth files, lockfiles, nested plugin dependency trees, or copied host-native Codex payload. Task-owned containers were removed.
Regression and static checks
git diff --checkpassed. Parent checked formatting after the final documentation-only flag correction.Boundaries and limitations
The normal source build was completed before the packaging changes; real artifacts reused that complete build with
--skip-build. New selection forwarding has regression coverage. Normal package installation and real native transport are proved on Linux arm64, not a mocked executable. Local Linux x64 emulation failed before installation withExec format error; no x64 success is claimed. This proof does not claim a real cloud allocation, node pairing, full agent turn, offline completeness, or production deployment.The default npm packing path hit its existing five-minute limit on the loaded local checkout. Cleanup succeeded, and the existing supported pnpm packing mode produced the verified artifact. No timeout, retry policy, budget, baseline, or package lifecycle check was weakened.
Direct dependency contract inspection used Codex tag
rust-v0.149.1, peeled commitff29a44391deccde0aba0f8390337d7f3c319ea4:codex-cli/bin/codex.jsplatform-native resolution andcodex-rs/exec-server/src/server/transport.rs/tests/initialize.rsstdio initialization and shutdown. OpenClaw's official/bundled provenance and native dependency checks remain untouched.Production: runtime +4/−0; packaging/tooling +202/−8 (net +194); total net +198. Tests +276/−35 (net +241). Documentation adds the complete-package recipe. The production growth supplies explicit distribution composition and reversible inventory/dependency ownership; removing the normal public core exclusion instead would violate the external-plugin publication contract.
AI-assisted, maintainer-requested root-cause repair. Server artifact adoption and cloud launch verification follow source landing through the existing deployment owner; no live server configuration was edited to make this proof pass.
Publication head and refreshed base
The repair was committed and rebased once onto main at
c47974ccf4cb780a59dabcf47cbdb35f60a5c516.git range-diffconfirms the repair patch is unchanged. This base includes the readable/copyable cloud diagnostics UI repair in #130672 and preserves main's larger machine-catalog handling.Main also advanced the Codex dependency to
0.150.1. Dependencies were refreshed with one successfulpnpm install; this PR does not change that pin. The historical clean-install artifact evidence above remains specifically for0.149.1, not a rebuilt0.150.1artifact. Direct comparison of the upstream native launcher and stdio transport found them unchanged from the inspectedrust-v0.149.1source; the initialize regression additionally checks returned environment information. Final deployment still requires a new artifact and target-platform verification from the landed SHA.Post-rebase verification at
c93390e8bf8876f310de8026c02dd2fdffce4081:All commands passed: 286 tests across eight files, three Windows-only skips, in 229 seconds; script types, docs MDX, and changed-file formatting passed. The package test exercises real selected/default tarball contents. The preserved main machine-catalog regression also passed.
pull_requestCI run 33043636976 completed successfully on this exact head. The single CI watcher exited 0 withGREENand zero pending checks; the final check query found no failed or pending checks. No CI repair or rerun was needed. Source metadata remains restored and the checkout is clean.Landing review follow-up
ClawSweeper identified stale built peer metadata in the new generic selection path. The follow-up at
a8117c6ead9f4a60e94b25a885b47ed9735abf02compares bothpeerDependenciesandpeerDependenciesMetain the existing built/source parity check. The existing fixture now covers a different built peer declaration and a source-optional peer becoming required only in the built manifest. Both cases failed before the fix by reaching packing unexpectedly; both pass after the repair and assert packing never starts.The focused package, source dependency, and postinstall suite passed 98 tests with three Windows-only skips, including actual selected/default fixture archives and cleanup. Fresh isolated Codex autoreview passed at the configured P0 threshold; the reviewer did not run tests. Production is now +213/-8 (net +205), tests +286/-35 (net +251), docs +23/-2, still eight files. The seven additional production lines are the formatted extension of the existing comparison to both peer contracts; no new runtime path or manifest/lock/version change.
This addresses the peer comparison and stale-peer regression Rank-up moves. The optional full selected-runtime artifact rebuild is deferred to the separately authorized landed-SHA artifact and deployment-owner follow-up. The current proof rebuilds fixture archives, not a fresh Codex 0.150.1 native distribution. Historical arm64 evidence and all platform/cloud/deployment limitations above remain unchanged. The landing agent personally inspected the exact Codex 0.150.1 launcher, stdio transport, and initialization test linked above.
Current follow-up local verification (all passed):
The changed gate includes script and test-root typechecks, full script lint, formatting, and relevant guards. An earlier gate invocation was stopped when the native checkout refresh invalidated its fixed-tree context; the command above was rerun completely at the new head and exited 0. No failed check was waived.
Final exact-head CI33046530552 completed successfully at
a8117c6ead9f4a60e94b25a885b47ed9735abf02, with no failed or pending checks.OPENCLAW_TESTBOX=1 scripts/pr prepare-run 130735completed successfully using native exact-head evidence (also Workflow Sanity33046530646); the prepared and remote head stayed unchanged and no push or rebase was needed. Current active branch rules require the CI gate and linear history, with no enforced independent approval. No bypass used. The latest new-head ClawSweeper comment remains a started placeholder; the completed review's findings and Rank-up moves are addressed above.