openclaw - 💡(How to fix) Fix Plugin bundled runtime deps re-staged on every restart, causing 100% CPU and event loop saturation [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

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#75718Fetched 2026-05-02 05:31:14
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Timeline (top)
closed ×1commented ×1cross-referenced ×1

Every gateway restart triggers synchronous "staging bundled runtime deps" for ALL enabled plugins, even when the plugin-runtime-deps directory already exists and is complete. This causes:

  1. 100% CPU / event loop saturationeventLoopUtilization=1, cpuCoreRatio=1.0 for 3-5 minutes after each restart
  2. Gateway unreachable during staging (WebSocket handshake timeouts, CLI commands timeout)
  3. Cron tasks fail (status: "lost" or "failed") because the gateway can't dispatch them
  4. Channel messages lost — Telegram/WhatsApp fetch timeouts during the saturated period

Per the dependency resolution docs:

"Runtime dependency repair should not run just because OpenClaw started. A normal startup with an unchanged plan and complete dependency materialization should skip package-manager work."

But in practice, every plugin stages on every restart.

Root Cause

  1. 100% CPU / event loop saturationeventLoopUtilization=1, cpuCoreRatio=1.0 for 3-5 minutes after each restart
  2. Gateway unreachable during staging (WebSocket handshake timeouts, CLI commands timeout)
  3. Cron tasks fail (status: "lost" or "failed") because the gateway can't dispatch them
  4. Channel messages lost — Telegram/WhatsApp fetch timeouts during the saturated period

Fix Action

Workaround

Disabling the memory-core plugin reduced the staging load enough for the gateway to eventually settle (CPU drops to 0.3% after ~5 min instead of staying at 100%). But this is not a fix — the other plugins still re-stage on every restart.

Code Example

[plugins] whatsapp staging bundled runtime deps (39 specs): @agentclientprotocol/claude-agent-acp@0.31.1, ...
[plugins] whatsapp installed bundled runtime deps in 11ms: ...
[plugins] xiaomi staging bundled runtime deps (39 specs): ...
[plugins] xiaomi installed bundled runtime deps in 11ms: ...

---

liveness warning: reasons=event_loop_delay,event_loop_utilization,cpu
  eventLoopDelayP99Ms=17750.3
  eventLoopUtilization=1
  cpuCoreRatio=0.982
  active=0 waiting=0 queued=0

---

[channels] failed to load bundled channel telegram: Cannot find module 'grammy'
RAW_BUFFERClick to expand / collapse

Description

Every gateway restart triggers synchronous "staging bundled runtime deps" for ALL enabled plugins, even when the plugin-runtime-deps directory already exists and is complete. This causes:

  1. 100% CPU / event loop saturationeventLoopUtilization=1, cpuCoreRatio=1.0 for 3-5 minutes after each restart
  2. Gateway unreachable during staging (WebSocket handshake timeouts, CLI commands timeout)
  3. Cron tasks fail (status: "lost" or "failed") because the gateway can't dispatch them
  4. Channel messages lost — Telegram/WhatsApp fetch timeouts during the saturated period

Per the dependency resolution docs:

"Runtime dependency repair should not run just because OpenClaw started. A normal startup with an unchanged plan and complete dependency materialization should skip package-manager work."

But in practice, every plugin stages on every restart.

Steps to Reproduce

  1. Have OpenClaw 2026.4.29 installed with 5+ bundled plugins enabled (e.g., acpx, browser, memory-core, telegram, whatsapp)
  2. Start the gateway: openclaw gateway restart
  3. Monitor CPU: ps aux | grep openclaw — observe 80-110% CPU
  4. Check logs: openclaw logs — observe [plugins] <name> staging bundled runtime deps for each plugin
  5. Wait 3-5 minutes for staging to complete and CPU to settle
  6. Restart again — same staging cycle repeats

Expected Behavior

On a normal restart with an unchanged plugin plan and existing plugin-runtime-deps directory:

  • Staging should be skipped (dependency materialization already complete)
  • Gateway should be ready in seconds, not minutes
  • Event loop should not be saturated

Actual Behavior

  • Every plugin (acpx, browser, memory-core, telegram, whatsapp, xiaomi, etc.) logs [plugins] <name> staging bundled runtime deps (N specs) on every restart
  • Counted across today's logs: acpx staged 87 times, whatsapp 77 times, memory-core 57 times, browser 52 times, telegram 49 times, xiaomi 40 times
  • Each staging resolves 36-39 npm packages synchronously
  • Combined with channel init + session loading, this overwhelms the event loop

Diagnostic Evidence

Log pattern (repeated for each plugin on every restart):

[plugins] whatsapp staging bundled runtime deps (39 specs): @agentclientprotocol/[email protected], ...
[plugins] whatsapp installed bundled runtime deps in 11ms: ...
[plugins] xiaomi staging bundled runtime deps (39 specs): ...
[plugins] xiaomi installed bundled runtime deps in 11ms: ...

Diagnostic output during staging:

liveness warning: reasons=event_loop_delay,event_loop_utilization,cpu
  eventLoopDelayP99Ms=17750.3
  eventLoopUtilization=1
  cpuCoreRatio=0.982
  active=0 waiting=0 queued=0

Gateway restart count today: 46+ restarts logged (LaunchAgent keeps respawning)

Secondary issue: Even when deps ARE staged, the runtime sometimes can't find them:

[channels] failed to load bundled channel telegram: Cannot find module 'grammy'

But grammy IS installed in ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-17c3fa238f70/node_modules/grammy/.

Environment

  • OpenClaw version: 2026.4.29 (a448042)
  • OS: macOS 15.7.5 (x64), Node 25.6.1
  • Install method: npm global (/usr/local/lib/node_modules/openclaw)
  • Plugin runtime deps: ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.29-17c3fa238f70 (2.1GB, 537 packages)
  • Enabled plugins: acpx, browser, memory-core (disabled for testing), telegram, whatsapp

Workaround

Disabling the memory-core plugin reduced the staging load enough for the gateway to eventually settle (CPU drops to 0.3% after ~5 min instead of staying at 100%). But this is not a fix — the other plugins still re-stage on every restart.

Suggested Fix

  1. Cache staging state: If the plugin-runtime-deps directory exists and the generated install manifest matches the effective plugin plan, skip the package manager entirely
  2. Make staging async: Don't block the event loop during dependency verification
  3. Debounce across restarts: Persist a hash of the plugin plan + dep versions; only re-stage when the hash changes

Additional Context

  • Gateway went through 46+ restarts today (config changes + LaunchAgent respawns)
  • The cumulative staging work across all those restarts is significant: ~500 staging events × 36-39 packages each
  • This was observed after a 4.22→4.27 upgrade and subsequent reinstall

extent analysis

TL;DR

The most likely fix is to implement a caching mechanism for staging state, making staging asynchronous, and debouncing across restarts to prevent redundant dependency verification.

Guidance

  • Investigate the plugin-runtime-deps directory and its contents to understand why the staging process is not being skipped despite its existence.
  • Consider implementing a cache to store the staging state, allowing the system to skip staging if the directory exists and the plugin plan remains unchanged.
  • To prevent event loop saturation, explore making the staging process asynchronous, allowing other tasks to run concurrently.
  • Debouncing across restarts by persisting a hash of the plugin plan and dependency versions can help reduce unnecessary staging events.

Example

No code example is provided due to the complexity of the issue and the need for a more in-depth understanding of the OpenClaw plugin architecture.

Notes

The provided diagnostic evidence and logs suggest that the staging process is the primary cause of the issue. However, the secondary issue of the runtime sometimes being unable to find dependencies despite them being installed may require additional investigation.

Recommendation

Apply a workaround by implementing a caching mechanism for staging state and making staging asynchronous to mitigate the issue until a permanent fix can be developed. This approach can help reduce the load on the event loop and prevent saturation.

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 Plugin bundled runtime deps re-staged on every restart, causing 100% CPU and event loop saturation [1 comments, 2 participants]