openclaw - 💡(How to fix) Fix Bundled runtime dependency staging should create an isolated package root before npm install [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#72374Fetched 2026-04-27 05:30:41
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Timeline (top)
closed ×1commented ×1cross-referenced ×1

OpenClaw's bundled runtime dependency staging can run npm install from a staging directory that has no root package.json. npm then walks upward, finds an unrelated parent package.json, and installs that project’s dependencies instead of an isolated minimal runtime dependency set.

In one local incident, npm walked up to an unrelated parent package.json, pulled unrelated dependencies, and starved the OpenClaw gateway during startup/runtime dependency preparation.

Root Cause

This can be triggered by local directory layout and is hard to diagnose because the visible symptom looks like a model/runtime wedge rather than an npm package-root leak. It also makes OpenClaw behaviour non-deterministic across hosts depending on what happens to exist in parent directories.

Fix Action

Fix / Workaround

  • unrelated parent dependencies were installed/pulled
  • gateway startup/resources were badly impacted
  • the chat surface appeared stuck until the dependency staging issue was patched and gateway restarted

Local mitigation tested

A local runtime patch creates/uses an isolated package root in the runtime staging directory before dependency installation. Runtime deps were then preinstalled into that staging directory. After gateway restart, startup improved and openclaw health --json returned live/ready.

Code Example

{
  "private": true,
  "type": "module"
}
RAW_BUFFERClick to expand / collapse

Summary

OpenClaw's bundled runtime dependency staging can run npm install from a staging directory that has no root package.json. npm then walks upward, finds an unrelated parent package.json, and installs that project’s dependencies instead of an isolated minimal runtime dependency set.

In one local incident, npm walked up to an unrelated parent package.json, pulled unrelated dependencies, and starved the OpenClaw gateway during startup/runtime dependency preparation.

Observed behaviour

A bundled runtime dependency install was started from a directory without a local package.json. npm resolved package context from a parent directory outside the OpenClaw runtime staging area.

Result:

  • unrelated parent dependencies were installed/pulled
  • gateway startup/resources were badly impacted
  • the chat surface appeared stuck until the dependency staging issue was patched and gateway restarted

Expected behaviour

Runtime dependency staging should be hermetic. It should never rely on npm walking upward to discover a parent package root.

The staging directory should contain its own minimal package.json before any npm install / dependency install command is run, or npm should be invoked in a way that cannot inherit an unrelated parent project.

Why this matters

This can be triggered by local directory layout and is hard to diagnose because the visible symptom looks like a model/runtime wedge rather than an npm package-root leak. It also makes OpenClaw behaviour non-deterministic across hosts depending on what happens to exist in parent directories.

Local mitigation tested

A local runtime patch creates/uses an isolated package root in the runtime staging directory before dependency installation. Runtime deps were then preinstalled into that staging directory. After gateway restart, startup improved and openclaw health --json returned live/ready.

Suggested fix

Before dependency installation, ensure the staging directory has an explicit minimal package root, for example:

{
  "private": true,
  "type": "module"
}

Then run npm with cwd set to that staging directory and avoid any upward package-root resolution. A startup/debug log line showing the resolved install root would also make this easier to diagnose.

Environment

  • OpenClaw installed via package manager
  • Host OS: macOS arm64

extent analysis

TL;DR

Ensure the staging directory has an explicit minimal package.json before running npm install to prevent npm from walking upward and installing unrelated dependencies.

Guidance

  • Create a minimal package.json in the staging directory with "private": true and "type": "module" to establish an isolated package root.
  • Run npm install with the current working directory (cwd) set to the staging directory to prevent upward package-root resolution.
  • Verify the fix by checking the startup/debug log for the resolved install root and ensuring that only the expected dependencies are installed.
  • Consider adding a log line to display the resolved install root for easier diagnosis in the future.

Example

{
  "private": true,
  "type": "module"
}

This minimal package.json can be used to establish an isolated package root in the staging directory.

Notes

This fix assumes that the issue is caused by npm walking upward to find a parent package.json and installing unrelated dependencies. If the issue persists after applying this fix, further investigation may be necessary to determine the root cause.

Recommendation

Apply the suggested fix by creating a minimal package.json in the staging directory and running npm install with the cwd set to that directory, as this will prevent npm from installing unrelated dependencies and ensure a hermetic runtime dependency staging process.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Bundled runtime dependency staging should create an isolated package root before npm install [1 comments, 2 participants]