Repository navigation
fix(process): exec and MCP servers fail with ENOENT after a Homebrew Node upgrade - #166222
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 October 6, 2026, 9:22 PM ET / October 7, 2026, 01:22 UTC (Revision 4). ClawSweeper reviewWhat this changesThe PR lets command relays and the spawn broker use an available stable Homebrew Node path after their original executable disappears, with regression tests and troubleshooting documentation. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and the latest release retain the failing relay launch. The focused patch has sufficient production-path recovery proof, and no actionable correctness or security finding remains. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw's process supervisor and MCP transport use a child relay to launch and manage local commands. The spawn broker provides an alternative process transport; both need an available Node executable to start their internal workers. flowchart TD
A[Exec tool requests] --> C[Process supervisor]
B[MCP server startup] --> C
C --> D[Child relay launch]
D --> E[Select available Node executable]
F[Spawn broker startup] --> E
E --> G[Original executable or stable Homebrew path]
G --> H[Managed child processes]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +15, Tests +50, Docs +7, Other +1. Total +73 across 8 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep runtime recovery at the shared process launch owners, preserving the original executable while available and using the established Homebrew candidates after removal. Do we have a high-confidence way to reproduce the issue? Yes, from source: remove the Homebrew Cellar executable retained by a running Gateway, then request a new relay launch. Current main still passes that missing path directly; this read-only review did not execute the scenario. Is this the best way to solve the issue? Yes. Reusing the existing formula-specific candidate contract at both internal launch sites is a focused repair that preserves working runtime selection and existing process ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 98567acd6060. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
Merged via squash.
|
…Node upgrade (openclaw#166222) * test(process): cover relay launch after a Homebrew Node upgrade * fix(process): launch stable Homebrew Node after a Cellar upgrade * fix(process): add stable-node-path to the PR wrapper inventory * fix(process): make Homebrew relay recovery regression portable * test(process): prune retired relay mock exception --------- Co-authored-by: Jay Zhou <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
After
brew upgrade noderemoves the executable used by a running Gateway,execcalls and stdio MCP server startup can fail withspawn .../Cellar/node/<old>/bin/node ENOENTwhile the Gateway remains reachable.User Impact
Command relays and the spawn broker can launch through the matching formula's stable Homebrew path after the old executable disappears. They keep the original executable while it exists. Restarting the Gateway after a Node upgrade still moves the Gateway itself onto the new runtime.
Why This Change Was Made
Both launch sites now use a shared synchronous resolver backed by the existing Homebrew candidate contract. It preserves the running executable until removal, then tries the formula's
optpath and the unversioned formula's prefixbinpath. It leaves non-Homebrew paths and the asynchronous service-install resolver's behavior unchanged.The wrapper inventory additions are required: its existing broker-host root now eagerly imports the resolver and its normalization dependency. The inventory guard verifies this closure. Maintainer cleanup removes a redundant callback, shortens the new comment, makes the regression's worker URL portable on Windows, preserves the spawn mock's exports, and documents restart guidance.
Evidence
Current main still has both raw
process.execPathlaunch sites (verified at7880834c19616b5efb871e1755cd4b30cf2f2481). Their history traces to #150564; the earlier stable-path and stale-runtime diagnostics addressed other owners.Final candidate:
e2227954495d13976c5dffba489dce0b75b3dbb9.oxfmt --check,node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json <changed TypeScript files>, andgit diff --checkpassed. Contributor code was not executed on the maintainer host.cbx_7c15fdcb53af, bound to the final full SHA above: no instance role, no Tailscale, no hydration, Node 24.21.0.tsgo:coreand all 35 tests across five files passed; combined wall time 52.33 s (test wrapper 35.57 s). The mock-export ratchet passed in 17.06 s. The targeted PR-wrapper inventory guard passed in 7.26 s.On that same lease and head, only the three production files were restored to merge base
c10679395819ede78bb073f979f95c157e165bfa; test files were preserved:The negative control exited 1 in 22.08 s, failing the intended launch-path assertion at
relay-integration.test.ts:94(temporary prefix normalized):Both this proof lease and the earlier baseline-generation lease
cbx_85562ab9165fwere stopped. Crabbox reported a stdout event-upload timeout after completion; the captured command output and successful run result supplied the evidence above.LOC against the main merge base: production +22/-7 (net +15); tests +52/-2 (net +50); required tooling inventory +2/-0; retired test-mock baseline +0/-1; docs +7/-0. All non-test/non-doc files combined are +24/-8 (net +16). The production LOC exception is explicit: the distinct launch-time resolver and its two consumers require the remaining growth; no safe behavior-preserving deletion in these owner files was found to offset it. Maintainer cleanup removed six production lines from the contributor version without weakening lifecycle or launch checks.
The preceding head’s CI run passed all 24 selected Node test jobs but failed because the mock-export cleanup required pruning its retired baseline entry. The baseline was regenerated with its owning command on isolated AWS (10,580 → 10,579 entries), reviewed, and committed; no checks were weakened or rerun merely for green.
Test cost: combined five-file test wrapper 35.57 s; stable-node resolver shard 1.36 s (8 ms test bodies), process shard 27.07 s (relay test bodies 27 ms; includes broker siblings and 17.40 s cold worker preparation), MCP shard 3.46 s. The added relay regression itself took 3 ms. Final-head CI run 37556461876 completed successfully: 27 successful Node test jobs, 3010 aggregate runner seconds. These job totals include shared shard/setup cost, not per-file marginal cost.
Scope: this repairs the shared exec/MCP relay and broker startup/restart executable selection. Separate cached executable paths in Bun terminal discovery, SQLite worker launch, Chrome MCP normalization, and external MCP configuration need their own focused follow-ups. A real launchd-managed Homebrew upgrade was not exercised by this validation.
Original fix by @jayzhou2309; maintainer cleanup and isolated verification by @steipete. Contributor commits and credit are preserved.
Fixes #166170