Repository navigation
fix(runtime): use runtime-owned Worker loaders - #148272
Conversation
|
🦞👀 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. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 1:32 PM ET / 17:32 UTC (Revision 3). ClawSweeper reviewWhat this changesSelects TypeScript worker loaders for Node and Bun and adapts agent tests that depend on runtime-specific APIs or error presentation. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main and v2026.9.4 still apply the Node preload to Bun source workers. No actionable introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw's worker pool runs background tasks, including Code Mode's isolated JavaScript execution. It receives worker entry URLs and task inputs, starts workers with the appropriate loader, and returns results or failures. flowchart TD
A[Background task] --> B[Worker pool]
C[Worker entry URL] --> D[Runtime and extension selection]
D --> E[Node TypeScript preload]
D --> F[Bun native or JavaScript loading]
E --> B
F --> B
B --> G[Task result or failure]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +14, Tests +46. Total +60 across 14 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep loader selection in the runtime owner, preserving Node's ESM behavior while allowing Bun to load TypeScript natively. Do we have a high-confidence way to reproduce the issue? Yes, from source: running a TypeScript WorkerTaskPool entry under Bun on current main supplies the Node-only preload. The PR reports this failure; this review did not execute it. Is this the best way to solve the issue? Yes. The patch extends the existing runtime selection owner, retains option overrides, and preserves the Node loader contract without introducing configuration or a parallel execution path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 89029af97dc1. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
ebd5cf2 to
0326db5
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* fix(runtime): use runtime-owned Worker loaders * test: preserve Node-owned agent source probes
What Problem This Solves
Source-mode Worker pools always attached Node's
tsx/esmpreload to TypeScript entries. Bun can execute those entries natively, while the Node preload depends onnode:modulehooks that Bun does not yet implement. Direct-Bun agent-core runs therefore failed before Code Mode source workers could start.The same run exposed test contracts that depended on Node-specific default abort text, V8 GC hooks, module-loader interception, transformed Fetch cancellation, partial secret-mask presentation, Bun's incomplete built-in
undicierror classes, or the missingRequest.keepalivegetter. Two source-probe fixtures also launched the host executable even though their contract explicitly installs Node module hooks.Why This Change Was Made
The runtime Worker owner now selects its preload from both the source extension and the current executable: Node keeps the resolved
tsx/esmpreload, Bun uses its native TypeScript loader, and non-file Worker URLs receive no file preload.The tests keep their observable contracts while removing engine-specific presentation assumptions. Probes that require APIs Bun does not currently provide are narrowly skipped or adapted under Bun with removal conditions beside them:
node:moduleloader interception (oven-sh/bun#35690), synchronous worker-local V8 GC, transformed Fetch cancellation, andRequest.keepalivereflection. Source fixtures that deliberately install Node module hooks resolve Node through the existing child-process helper. The installed npmundicipackage supplies real timeout errors until the AI-assisted upstream fix in oven-sh/bun#42716 ships.User Impact
OpenClaw source workers and the direct agent-core suite run under Bun without feeding a Node-only TypeScript loader to Bun. Node behavior and built JavaScript workers are unchanged. This adds no dependency, configuration option, or public API.
Evidence
Request.keepalivereflection, and redaction presentation.***, which the repaired test now accepts by asserting only that the secret is absent.node scripts/check-changed.mjs: passed on the exact rebased head, including core/test types, lint, formatting, boundaries, and import-cycle guards.git diff --check: clean.