Repository navigation
fix(gateway): cloud worker dispatch fails with incomplete built import closure when an external plugin ships hidden dist chunks - #165669
Conversation
…t closure when an external plugin ships hidden dist chunks The node bootstrap packager skipped every dot-prefixed entry at every depth when copying an installed external plugin, dropping the dist/.setup/ shared chunks that OpenClaw's npm plugin build publishes. Keep dot entries inside the plugin's own dist/ tree so the built import closure stays complete, while plugin-root dot entries and IGNORED_PLUGIN_DIRECTORIES stay excluded. Fixes openclaw#165638
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 1:43 PM ET / 17:43 UTC (Revision 3). ClawSweeper reviewWhat this changesThe cloud-worker bootstrap packager retains external plugins’ compiled dist/.setup chunks while preserving private-file exclusions, with an archive extraction and execution regression. Merge readiness✅ Ready for maintainer review The PR remains necessary because pinned main and v2026.9.8 still omit the required chunks. The revised head resolves the previous private-file exclusion finding, and the published-plugin proof covers the failing preparation boundary. No remaining actionable finding was identified. Priority: P1 Review scores
Verification
How this fits togetherBefore provisioning a remote-exec cloud worker, the Gateway packages its runtime and required trusted plugins into a bootstrap archive. The archive’s import closure must validate before provisioning can continue. flowchart TD
A[Remote-exec worker request] --> B[Select required trusted plugins]
B --> C[Package Gateway and plugin files]
C --> D[Retain compiled chunks and exclude private files]
D --> E[Validate complete import closure]
E --> F[Bootstrap archive]
F --> G[Worker provisioning]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +11, Tests +50. Total +61 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the existing bootstrap builder as the packaging owner, preserving published runtime chunks together with private-file exclusions and complete import validation. Do we have a high-confidence way to reproduce the issue? Yes, from source: an external plugin entry importing dist/.setup chunks loses those files under the current-main filter and fails closure validation. The contributor supplies matching before/after output; this read-only review did not execute the path. Is this the best way to solve the issue? Yes. Exempting the exact published chunk directory repairs the existing packaging owner while preserving descendant exclusions and validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4c4e42aabbe9. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
…etup Only the plugin npm build's published shared-chunk directory dist/.setup is retained; other hidden entries below dist (for example dist/.cache) stay excluded so private host metadata cannot reach the worker archive.
1c4fa4a to
a586079
Compare
|
Merged via squash.
|
…t closure when an external plugin ships hidden dist chunks (openclaw#165669) * fix(gateway): cloud worker dispatch fails with incomplete built import closure when an external plugin ships hidden dist chunks The node bootstrap packager skipped every dot-prefixed entry at every depth when copying an installed external plugin, dropping the dist/.setup/ shared chunks that OpenClaw's npm plugin build publishes. Keep dot entries inside the plugin's own dist/ tree so the built import closure stays complete, while plugin-root dot entries and IGNORED_PLUGIN_DIRECTORIES stay excluded. Fixes openclaw#165638 * fix(gateway): narrow node bootstrap hidden-chunk retention to dist/.setup Only the plugin npm build's published shared-chunk directory dist/.setup is retained; other hidden entries below dist (for example dist/.cache) stay excluded so private host metadata cannot reach the worker archive.
…t closure when an external plugin ships hidden dist chunks (#165669) * fix(gateway): cloud worker dispatch fails with incomplete built import closure when an external plugin ships hidden dist chunks The node bootstrap packager skipped every dot-prefixed entry at every depth when copying an installed external plugin, dropping the dist/.setup/ shared chunks that OpenClaw's npm plugin build publishes. Keep dot entries inside the plugin's own dist/ tree so the built import closure stays complete, while plugin-root dot entries and IGNORED_PLUGIN_DIRECTORIES stay excluded. Fixes #165638 * fix(gateway): narrow node bootstrap hidden-chunk retention to dist/.setup Only the plugin npm build's published shared-chunk directory dist/.setup is retained; other hidden entries below dist (for example dist/.cache) stay excluded so private host metadata cannot reach the worker archive. (cherry picked from commit b1f85ad)
Backport openclaw#165669 to the extended-stable bootstrap packager. Co-authored-by: RomneyDa <[email protected]>
Closes #165638
What Problem This Solves
Fixes an issue where users with an external plugin such as
@openclaw/codexinstalled (npm plugins whose built chunks live underdist/.setup/) could not dispatch cloud workers: every dispatch failed during node bootstrap preparation withNode distribution openclaw has an incomplete built import closure ... dist/extensions/codex/dist/api.js imports missing dist/extensions/codex/dist/.setup/....No worker VM is ever created while such a plugin is installed, so remote-exec dispatch is fully blocked on affected hosts.
Related: [Bug]: Cloud worker dispatch fails with "incomplete built import closure" when @openclaw/codex is installed (node bootstrap skips dist/.setup/ in external plugins) #165638; clawsweeper review confirmed the defect remains on current main and requested (a) narrowing hidden-file retention to required compiled chunks only, and (b) installed-runtime proof with the published plugin. Both are addressed in this update.
Why This Change Was Made
dist/.setup/directory that OpenClaw's plugin npm build emits (scripts/lib/plugin-npm-runtime-build.mtschunkFileNames) — so the import-closure validator sees a complete built closure and the worker enrolls.collectInstalledBundledFiles(bundled npm dependencies) is unchanged — it is not implicated in this failure and keeps this fix bounded; no changes to plugin published layouts or to import validation.dist/.setup/directory entry itself is exempt from the dot-entry check — hidden children below it (for exampledist/.setup/.cache/credentials.json) stay excluded, and thenode_modules/src/test/testsexclusions apply unconditionally at every depth, including insidedist/.setup/. The regression test asserts hidden and ignored entries both belowdist/and insidedist/.setup/stay out of the archive, and the real-plugin run below confirms the same with the published@openclaw/codexpackage.User Impact
dist/.setup/chunks installed, cloud worker dispatch proceeds past bootstrap preparation and the worker enrolls; the artifact containsdist/extensions/<id>/dist/.setup/*and no other hidden plugin entries.src/gateway/worker-environments/node-bootstrap-artifact-build.ts(single visitor condition + thedist/.setupconstant) and the regression fixture "retains an external plugin's hidden runtime chunks under its dist directory" insrc/gateway/worker-environments/node-bootstrap-artifact.test.ts.Evidence
mainrunning (1) the focused vitest project suite and (2) the production builderprepareNodeBootstrapArtifactdirectly against the published@openclaw/[email protected]npm tarball (npm pack @openclaw/[email protected]), which ships 140 files underpackage/dist/.setup/.{ "prepare": "ok", "openclawVersion": "2026.9.8", "enabledPluginIds": ["codex"], "archiveEntries": 172, "archiveSetupChunks": 140, "sampleSetupChunk": "package/dist/extensions/codex/dist/.setup/account-usage-runtime-G348lY1q.mjs", "sampleChunkMatchesSource": true, "hiddenNonSetupEntries": [], "injectedCacheExcluded": true, "nestedSetupPrivateExcluded": true }dist/.setup/chunks with byte-identical contents, while injected private entries —dist/.cache/credentials.json,dist/.setup/.cache/credentials.json, anddist/.setup/node_modules/— all stay excluded. The focused vitest suite additionally executes the packagedopenclaw.mjswith a real Node process and printslocal-ai:cloud-ready.@openclaw/[email protected]external plugin now completes (140 hidden shared chunks retained, no other hidden entries transferred); the artifact's built import closure validates. The changed test costs ~150ms (34 tests in the file pass in ~6s).prepareNodeBootstrapArtifactfails with the issue's exact diagnostic before any worker VM is created:collectInstalledBundledFilesfor bundled npm dependencies.