Skip to content

fix(memory): keep local embedding worker forks working after Homebrew Node upgrades - #99541

Closed
qingminglong wants to merge 1 commit into
openclaw:mainfrom
qingminglong:codex/issue-99183-stale-node-execpath
Closed

qingminglong wants to merge 1 commit into
openclaw:mainfrom
qingminglong:codex/issue-99183-stale-node-execpath

Conversation

@qingminglong

@qingminglong qingminglong commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #99183

What Problem This Solves

Fixes an issue where users running the Gateway with Homebrew-managed Node could lose fresh local embedding worker forks after Homebrew upgrades Node and removes the old Cellar binary.

Why This Change Was Made

The local embedding worker now resolves Homebrew Cellar process.execPath values to stable Homebrew symlinks before calling fork(). Non-Cellar paths keep the existing executable unchanged, and the change stays inside the memory host worker supervisor without adding config, public API, or a new worker error code.

User Impact

Local semantic-memory embeddings can continue starting fresh worker processes after a Homebrew Node upgrade instead of failing with spawn ... ENOENT until the Gateway is restarted.

Evidence

  • Claim proved: stale Homebrew Cellar worker forks use a stable Node executable path before fork(), while non-Cellar paths remain unchanged.
  • Commands / artifacts:
  • Observed result:
    • Unit tests verify Cellar paths are passed to fork() as /opt/homebrew/opt/node/bin/node or /usr/local/bin/node, non-Cellar paths pass through unchanged, and aborts during the new async boundary do not send cancelled requests.
    • The macOS proof ran on macOS 15.7.7 arm64 with Homebrew prefix /opt/homebrew and Homebrew Node 26.4.0.
    • The parent process started from a Homebrew Cellar Node executable: /opt/homebrew/Cellar/node/openclaw-proof-99541-28698715497-1/bin/node.
    • After that Cellar executable was removed, a raw child_process.fork() without explicit execPath failed with spawn /opt/homebrew/Cellar/node/openclaw-proof-99541-28698715497-1/bin/node ENOENT.
    • The PR worker path then completed successfully while the stale Cellar executable remained unavailable; the child process ran through the stable Homebrew Node path, with child argv0 recorded as /opt/homebrew/opt/node/bin/node and child execPath resolving to /opt/homebrew/Cellar/node/26.4.0/bin/node.

@clawsweeper

clawsweeper Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed July 4, 2026, 3:31 AM ET / 07:31 UTC.

Summary
Review failed before ClawSweeper could summarize the requested change.

PR surface: Source +50, Tests +146. Total +196 across 2 files.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: unknown-data-model-change: packages/memory-host-sdk/src/host/embeddings-worker-stale-execpath.test.ts, unknown-data-model-change: packages/memory-host-sdk/src/host/embeddings-worker.ts, vector/embedding metadata: packages/memory-host-sdk/src/host/embeddings-worker-stale-execpath.test.ts, vector/embedding metadata: packages/memory-host-sdk/src/host/embeddings-worker.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Not assessed.
Failure reason: codex execution failed.

This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict.
Keep any merge decision on the normal maintainer review path until ClawSweeper can complete a fresh review.

Risk before merge

  • [P1] No close action taken because the review did not complete.

Maintainer options:

  1. Decide the mitigation before merge
    Retry the Codex review after fixing the execution failure.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • Review did not complete, so no work-lane recommendation was made.
Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

Do we have a high-confidence way to reproduce the issue?

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model internal, reasoning high; reviewed against d226afbc5cbf.

Label changes

Label changes:

  • remove proof: sufficient: Current real behavior proof status is not_applicable, not sufficient.
  • remove P2: Current review triage priority is none.
  • remove rating: 🐚 platinum hermit: Current review failed before PR readiness was assessed, so no rating label should remain.
  • remove status: 👀 ready for maintainer look: Current PR status no longer selects a status label.
Evidence reviewed

PR surface:

Source +50, Tests +146. Total +196 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 52 2 +50
Tests 1 146 0 +146
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 198 2 +196

What I checked:

  • failure reason: codex execution failed.
  • codex failure detail: Codex review failed for this PR with exit 1.
  • codex stderr: No stderr captured.
  • codex stdout: {"type":"thread.started","thread_id":"019f2c09-a85f-7061-aa02-f4b231955529"}.

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)
How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-04T07:18:08.060Z sha 7d53310 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 3, 2026
@harjothkhara

Copy link
Copy Markdown
Contributor

I compared the current #99183 cluster (#99222, #99318, #99541, #99563) against current main and Node's fork() contract.

Best-fix read: #99541 looks like the strongest landing lane, pending the real macOS/Homebrew proof already requested. It keeps the repair inside packages/memory-host-sdk/src/host/embeddings-worker.ts, resolves the stale Cellar path before fork(), keeps the resolver private, and adds tests for the Homebrew opt/bin fallback plus the new async abort window. That matches current main's failure point, where ensureChild() calls fork() without execPath, and Node's implementation then uses process.execPath before spawning.

Why I would not pick the siblings as-is:

Remaining merge gap: add the real Homebrew/macOS proof requested by ClawSweeper, ideally showing the old Cellar executable unavailable and a fresh local embedding worker starting through the stable symlink. With that proof, this PR seems like the cleanest candidate in the cluster.

@qingminglong

Copy link
Copy Markdown
Contributor Author

Current-head proof status for 7d53310605e9fd111db375d479cc5f22da2f42db: the Windows contributor machine does not have a reachable macOS/Homebrew host, Crabbox, Blacksmith, or CRABBOX_HOST_ID, so I cannot honestly produce the real macOS/Homebrew Gateway proof requested by ClawSweeper from here.

The remaining proof ask is a maintainer/macOS run that shows a stale Homebrew Cellar process.execPath is resolved to a stable Node path before the local embedding worker fork. Suggested proof shape:

git fetch origin pull/99541/head:pr-99541-proof
git checkout pr-99541-proof
node scripts/run-vitest.mjs packages/memory-host-sdk/src/host/embeddings-worker-stale-execpath.test.ts
node scripts/run-vitest.mjs packages/memory-host-sdk/src/host/embeddings.test.ts
git diff --check HEAD~1..HEAD

For the real-behavior portion, please run on macOS with Homebrew Node and capture redacted terminal/log output showing:

  • the gateway/worker parent had a Homebrew Cellar-style Node path, for example /opt/homebrew/Cellar/node/<old>/bin/node
  • the old Cellar executable is unavailable or represents the deleted upgrade path
  • a fresh local embedding worker starts through /opt/homebrew/opt/node/bin/node or /usr/local/bin/node
  • no spawn .../Cellar/... ENOENT occurs for the fresh worker fork

This is a proof handoff only; it does not claim the macOS/Homebrew runtime proof has already been completed.

@qingminglong

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local embedding worker fork fails with ENOENT after Node upgrade — fork() inherits execPath of a deleted binary

2 participants