openclaw - 💡(How to fix) Fix bug: plugin-runtime-deps subdirectories are recursively scanned as plugin roots, causing repeated npm install on every gateway start (v2026.4.24) [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#72246Fetched 2026-04-27 05:32:37
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
1
Author
Timeline (top)
closed ×1commented ×1

On v2026.4.24, every gateway startup triggers repeated npm install runs because OpenClaw's bundled plugin runtime deps scanner recursively treats its own plugin-runtime-deps subdirectories as plugin roots, generating new install directories in a loop.

Root Cause

The install directory naming scheme is:

$OPENCLAW_HOME/.openclaw/plugin-runtime-deps/openclaw-<version>-<sha256(packageRoot)[:12]>

The scanner resolves packageRoot from the running binary path. For the rescue instance:

  • Real packageRoot: /Users/zhangxm/openclaw-doctor/node_modules/openclaw
  • Hash: e7d1a244873d
  • Install dir created: plugin-runtime-deps/openclaw-2026.4.24-e7d1a244873d/

On the next startup, the scanner picks up plugin-runtime-deps/openclaw-2026.4.24-e7d1a244873d/ as a new plugin root candidate, computes its hash (3eb56de9c5f7), finds it "missing", and runs npm install again — creating openclaw-unknown-3eb56de9c5f7/ (version reads as "unknown" because there is no valid package.json in that directory).

This is confirmed by hash arithmetic:

const h = (v) => createHash('sha256').update(path.resolve(v)).digest('hex').slice(0, 12);

h('/Users/zhangxm/openclaw-doctor/node_modules/openclaw')
// => 'e7d1a244873d'  (real install dir)

h('/Users/zhangxm/openclaw-doctor/.openclaw/plugin-runtime-deps/openclaw-2026.4.24-e7d1a244873d')
// => '3eb56de9c5f7'  (recursively generated unknown dir)

The same pattern occurs on the main instance:

plugin-runtime-deps/openclaw-2026.4.24-da6bdffc3d96/  ← real (homebrew path)
plugin-runtime-deps/openclaw-unknown-3a739f4f35db/    ← recursive ghost
plugin-runtime-deps/openclaw-unknown-bde2536dc8d4/    ← recursive ghost from doctor's dir

Code Example

$OPENCLAW_HOME/.openclaw/plugin-runtime-deps/openclaw-<version>-<sha256(packageRoot)[:12]>

---

const h = (v) => createHash('sha256').update(path.resolve(v)).digest('hex').slice(0, 12);

h('/Users/zhangxm/openclaw-doctor/node_modules/openclaw')
// => 'e7d1a244873d'  (real install dir)

h('/Users/zhangxm/openclaw-doctor/.openclaw/plugin-runtime-deps/openclaw-2026.4.24-e7d1a244873d')
// => '3eb56de9c5f7'  (recursively generated unknown dir)

---

plugin-runtime-deps/openclaw-2026.4.24-da6bdffc3d96/real (homebrew path)
plugin-runtime-deps/openclaw-unknown-3a739f4f35db/    ← recursive ghost
plugin-runtime-deps/openclaw-unknown-bde2536dc8d4/    ← recursive ghost from doctor's dir

---

// Skip paths that are inside an existing plugin-runtime-deps install root
if (pluginRoot.includes('plugin-runtime-deps')) continue;
RAW_BUFFERClick to expand / collapse

Summary

On v2026.4.24, every gateway startup triggers repeated npm install runs because OpenClaw's bundled plugin runtime deps scanner recursively treats its own plugin-runtime-deps subdirectories as plugin roots, generating new install directories in a loop.

Environment

  • OpenClaw: 2026.4.24 (cbcfdf6)
  • OS: macOS 26.4.1 (arm64)
  • Node: v22.22.2
  • Setup: two gateway instances (main + rescue/doctor) on same machine

Root Cause

The install directory naming scheme is:

$OPENCLAW_HOME/.openclaw/plugin-runtime-deps/openclaw-<version>-<sha256(packageRoot)[:12]>

The scanner resolves packageRoot from the running binary path. For the rescue instance:

  • Real packageRoot: /Users/zhangxm/openclaw-doctor/node_modules/openclaw
  • Hash: e7d1a244873d
  • Install dir created: plugin-runtime-deps/openclaw-2026.4.24-e7d1a244873d/

On the next startup, the scanner picks up plugin-runtime-deps/openclaw-2026.4.24-e7d1a244873d/ as a new plugin root candidate, computes its hash (3eb56de9c5f7), finds it "missing", and runs npm install again — creating openclaw-unknown-3eb56de9c5f7/ (version reads as "unknown" because there is no valid package.json in that directory).

This is confirmed by hash arithmetic:

const h = (v) => createHash('sha256').update(path.resolve(v)).digest('hex').slice(0, 12);

h('/Users/zhangxm/openclaw-doctor/node_modules/openclaw')
// => 'e7d1a244873d'  (real install dir)

h('/Users/zhangxm/openclaw-doctor/.openclaw/plugin-runtime-deps/openclaw-2026.4.24-e7d1a244873d')
// => '3eb56de9c5f7'  (recursively generated unknown dir)

The same pattern occurs on the main instance:

plugin-runtime-deps/openclaw-2026.4.24-da6bdffc3d96/  ← real (homebrew path)
plugin-runtime-deps/openclaw-unknown-3a739f4f35db/    ← recursive ghost
plugin-runtime-deps/openclaw-unknown-bde2536dc8d4/    ← recursive ghost from doctor's dir

Impact

  • Every cold gateway start runs 5–10 sequential npm install processes (one per plugin with bundled deps)
  • Startup takes 60–90 seconds instead of ~5 seconds
  • During startup, Discord/Telegram connections are not established → messages go unanswered
  • The openclaw doctor and openclaw status commands are also slow for the same reason

Steps to Reproduce

  1. Install OpenClaw v2026.4.24 globally via npm
  2. Start gateway once (creates plugin-runtime-deps/openclaw-<ver>-<hash>/)
  3. Stop and restart gateway
  4. Observe: a new openclaw-unknown-<hash>/ directory is created and npm install runs again

Expected Behavior

The plugin-runtime-deps directory (and its subdirectories) should be excluded from the bundled plugin root discovery scan. Only paths under dist/extensions/ should be considered as plugin roots.

Suggested Fix

In bundled-runtime-deps.ts (or wherever plugin roots are collected), add an exclusion for paths that are themselves inside plugin-runtime-deps or match the BUNDLED_RUNTIME_DEPS_LOCK_DIR / install stage patterns:

// Skip paths that are inside an existing plugin-runtime-deps install root
if (pluginRoot.includes('plugin-runtime-deps')) continue;

Or more robustly, scope the discovery glob to only dist/extensions/* and never walk into state directories.

extent analysis

TL;DR

Exclude plugin-runtime-deps directories from the bundled plugin root discovery scan to prevent recursive npm install runs.

Guidance

  • Modify the bundled-runtime-deps.ts file to skip paths that are inside an existing plugin-runtime-deps install root.
  • Alternatively, scope the discovery glob to only dist/extensions/* to prevent walking into state directories.
  • Verify the fix by checking that no new openclaw-unknown-<hash>/ directories are created after restarting the gateway.
  • Monitor the startup time and Discord/Telegram connection establishment to ensure they return to normal.

Example

// Skip paths that are inside an existing plugin-runtime-deps install root
if (pluginRoot.includes('plugin-runtime-deps')) continue;

This code snippet excludes paths containing plugin-runtime-deps from the plugin root discovery scan.

Notes

The suggested fix assumes that the bundled-runtime-deps.ts file is the correct location for the modification. If this is not the case, further investigation may be necessary to identify the correct file.

Recommendation

Apply the suggested fix by modifying the bundled-runtime-deps.ts file to exclude plugin-runtime-deps directories from the plugin root discovery scan. This should prevent the recursive npm install runs and improve the startup time.

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 bug: plugin-runtime-deps subdirectories are recursively scanned as plugin roots, causing repeated npm install on every gateway start (v2026.4.24) [1 comments, 2 participants]