Repository navigation
fix(packaging): restore cloud-session bootstrap for CommonJS bundles - #160583
Conversation
The bundleDependencies change in #160015 exposed exact-path closure checks rejecting valid undici CommonJS requires. Resolve require edges with Node file and directory rules while keeping ESM imports strict, and carry package metadata through bootstrap inspection. Restore cloud-session dispatch on the next Gateway update. Add checker and transferred-artifact regressions; verify a real undici 8.10.2 bootstrap artifact without starting or stopping a Gateway.
|
🦞👀 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 September 28, 2026, 1:24 PM ET / 17:24 UTC. ClawSweeper reviewWhat this changesThe branch teaches package closure validation to resolve relative CommonJS requires using Node file and directory rules, and supplies package metadata before the Gateway builds a cloud-node archive. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Current main still rejects valid extensionless CommonJS imports during cloud bootstrap preparation. The PR addresses that failure at the shared package checker, and the reviewed patch has no discrete blocking finding. Priority: P1 Review scores
Verification
How this fits togetherWhen a cloud session starts, the Gateway builds and validates a runtime archive from its installed package and selected plugins. It transfers the verified archive to the node before enrollment and the first turn. flowchart LR
A[Cloud session request] --> B[Gateway package and plugins]
B --> C[Bootstrap archive builder]
C --> D[Import closure check]
D --> E[Verified archive]
E --> F[Cloud node enrollment]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +16, Tests +131, Other +78. Total +225 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the shared checker repair through normal exact-head gates so Gateway archive preparation accepts complete CommonJS bundles while ESM validation remains strict. Do we have a high-confidence way to reproduce the issue? Yes. A bundled CommonJS file requiring an extensionless relative target that exists as a .js file reaches the current-main exact-path rejection; the PR reports pre-fix failures, though this read-only review did not execute them. Is this the best way to solve the issue? Yes. The shared package checker owns the closure rule, and passing package metadata through the existing Gateway artifact builder keeps the fix at that boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7e6dd89766ce. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…penclaw#160583) The bundleDependencies change in openclaw#160015 exposed exact-path closure checks rejecting valid undici CommonJS requires. Resolve require edges with Node file and directory rules while keeping ESM imports strict, and carry package metadata through bootstrap inspection. Restore cloud-session dispatch on the next Gateway update. Add checker and transferred-artifact regressions; verify a real undici 8.10.2 bootstrap artifact without starting or stopping a Gateway.
Resolve the merge conflict by retaining the CommonJS bootstrap repair already landed in #160583. Only the title-metadata bound and its complete-task regression remain above main. Co-authored-by: steipete <[email protected]>
What Problem This Solves
Fixes all cloud-session dispatch on main failing before provisioning since 2026-09-28 01:44 UTC, when #160015 added undici to the bundled dependencies.
User Impact
Cloud-session dispatch can prepare its node bootstrap artifact again. The fix takes effect on the next Gateway update (or source rebuild and restart). No published version release is affected: the latest published version is v2026.9.6 from September 23, before the trigger;
git tag --contains ce73f2c8f2a7has no version-release tag.Why This Change Was Made
The shared closure checker required exact paths for CommonJS
require()calls even though undici ships the referenced files with.jsextensions. It now applies Node's relative CommonJS file and directory resolution, using each file's extension and package metadata for parsing. ESM imports and exports keep exact-path checks.Bootstrap reads package metadata before scanning JavaScript and preserves canonical manifest hashing. Installed bundles still receive full closure validation. Existing npm tarball, standalone dist, and private bundled-runtime checks share the corrected resolver; the set of release-checked scopes is unchanged. The macOS worker graph retains its existing imported paths.
Evidence
e256cbef8ae0): the checker reports present CommonJS targets as missing, and the bootstrap fixture reproduces the undici-style incomplete-closure error.node scripts/worktree-setup.mjs gatewaypassed.664d9363f7157a2316f1cd9066a1177b9bede0a9832cc6e0d0122090011be531. No Gateway was started or stopped; actual cloud dispatch is reserved for the coordinator.pnpm tsgo:core,pnpm tsgo:scripts, targeted core/script/test lint, formatting, andgit diff --checkpassed. All core and root test typecheck graphs also passed.accepts a real pnpm-produced package without booting npm for version diagnostics. Its preload rejectsnpm --version, but the supported Homebrew npm layout requires that fallback. The dist import graph passed; a standalone probe reproduced the preload failure while normal npm version retrieval succeeded. The fixture and npm inventory/resolution owners are unchanged from main. This is unrelated to the closure repair.check:changedwrapper was interrupted during the unrelated legacy-store scan after the requested gates passed. Its later whole-repository guards were not run; this is not claimed as a complete wrapper pass.