Repository navigation
fix(agents): run tool code child with Node under Bun - #145688
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. |
|
Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 2:24 AM ET / 06:24 UTC. ClawSweeper reviewWhat this changesThe PR lets Bun-hosted Tool Search run its isolated JavaScript child with an installed compatible Node executable and shares that discovery logic with test helpers. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main still launches the code child through the host runtime. No blocking introduced defect was found, and the maintainer-protected PR should remain open. Priority: P2 Review scores
Verification
How this fits togetherTool Search lets agents discover and call tools through a compact JavaScript bridge. Model code runs in an isolated Node child, while actual tool execution returns to OpenClaw’s existing policy-controlled runtime. flowchart TD
A[Tool Search configuration] --> B{Compatible Node available?}
C[Host runtime and executable paths] --> B
B -->|Yes| D[Isolated Node code child]
B -->|No| E[Structured tool fallback]
D --> F[OpenClaw tool execution]
E --> F
F --> G[Tool results]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +111, Tests -33. Total +78 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use one capability-checked Node resolver for the isolated child, retaining structured fallback when unavailable and existing execution safeguards. Do we have a high-confidence way to reproduce the issue? Yes, from source: invoking the code tool under Bun reaches a host-runtime permission check and process.execPath launch on current main. The PR reports that failure before the fix; this read-only review did not execute it. Is this the best way to solve the issue? Yes. Selecting an installed Node with the required capability fixes the child-runtime mismatch without changing stored settings, installing dependencies, or replacing tool policy enforcement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ae43ac760877. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Bun cannot run
tool_search_codebecause the sandboxed code child requires Node's--permissionflag. The runtime checked Bun's own flags and launchedprocess.execPath, so a direct-Bun MCP recovery test failed before the code child started.Why This Change Was Made
OpenClaw now resolves a real Node executable for runtime-specific sidecars. The resolver walks
PATHplus stable system locations, skips Bun's optionalnodeshim, verifies the requested Node flag in a sterile probe process, and caches the result by runtime and executable-search inputs. Tool Search uses that verified Node for its isolated child and advertises code mode under Bun only when a compatible Node is available. The existing test Node resolver now shares the same owner.User Impact
Bun-hosted OpenClaw can use the full sandboxed Tool Search code mode while Node behavior stays unchanged. This adds no dependency and does not alter Node installation or package-manager behavior; it only locates an already-installed compatible Node for the child process. Electron keeps its existing structured-tool fallback.
Evidence
--permissionruntime error.node scripts/check-changed.mjs: passed.