openclaw - 💡(How to fix) Fix embedded_run bootstrap-context blocks event loop for 14-22 seconds

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…

During embedded_run processing, the bootstrap-context prep stage blocks the Node.js event loop for 14-22+ seconds, preventing any async I/O (WebSocket keepalive, HTTP requests, timers) from executing.

Root Cause

During embedded_run processing, the bootstrap-context prep stage blocks the Node.js event loop for 14-22+ seconds, preventing any async I/O (WebSocket keepalive, HTTP requests, timers) from executing.

Fix Action

Fix / Workaround

Impact on channel plugins

A Cove channel plugin sends typing indicators via WebSocket. Despite the WS write being queued before dispatch starts (via setTimeout(fn, 1)), the event loop block during bootstrap-context prevents:

  • WebSocket frames from being flushed to the kernel
  • Typing keepalive timers from firing
  • Any async I/O callbacks from executing

Code Example

liveness warning: reasons=event_loop_delay,event_loop_utilization,cpu
interval=31s eventLoopDelayP99Ms=14394.9 eventLoopDelayMaxMs=14394.9
eventLoopUtilization=0.986 cpuCoreRatio=0.986
active=1 waiting=0 queued=0
work=[active=agent:kagura:discord:channel:...(processing/embedded_run,q=1,age=30s last=embedded_run:started)]

---

workspace-sandbox:4ms, skills:0ms, core-plugin-tools:288ms,
bootstrap-context:22530ms, bundle-tools:72ms, system-prompt:2ms,
session-resource-loader:118ms, agent-session:1ms, stream-setup:37ms
RAW_BUFFERClick to expand / collapse

Summary

During embedded_run processing, the bootstrap-context prep stage blocks the Node.js event loop for 14-22+ seconds, preventing any async I/O (WebSocket keepalive, HTTP requests, timers) from executing.

Evidence

Liveness diagnostic warning

liveness warning: reasons=event_loop_delay,event_loop_utilization,cpu
interval=31s eventLoopDelayP99Ms=14394.9 eventLoopDelayMaxMs=14394.9
eventLoopUtilization=0.986 cpuCoreRatio=0.986
active=1 waiting=0 queued=0
work=[active=agent:kagura:discord:channel:...(processing/embedded_run,q=1,age=30s last=embedded_run:started)]

Prep stages timing (from trace log)

workspace-sandbox:4ms, skills:0ms, core-plugin-tools:288ms,
bootstrap-context:22530ms, bundle-tools:72ms, system-prompt:2ms,
session-resource-loader:118ms, agent-session:1ms, stream-setup:37ms

bootstrap-context takes 22,530ms — 97% of the total 23,052ms prep time.

Impact on channel plugins

A Cove channel plugin sends typing indicators via WebSocket. Despite the WS write being queued before dispatch starts (via setTimeout(fn, 1)), the event loop block during bootstrap-context prevents:

  • WebSocket frames from being flushed to the kernel
  • Typing keepalive timers from firing
  • Any async I/O callbacks from executing

This results in typing indicators disappearing mid-processing (the client times out after 8s with no keepalive).

Reproduction

Observed on two different agents with very different workspace sizes:

  • Agent A (ruantang): 40KB workspace, 3.1MB session trajectory → 22-33s bootstrap
  • Agent B (kagura): 150KB+ workspace, 50MB session trajectories → 14s event loop delay

Both show the same event loop blocking pattern, suggesting the bottleneck is not workspace/session file size but something in the bootstrap pipeline itself (possibly plugin hook execution, session store operations, or synchronous computation).

Environment

  • OpenClaw 2026.5.22 (a374c3a)
  • Node.js v24.14.1
  • Ubuntu 24.04, i9-10900X, 64GB RAM
  • 17 plugins loaded (acpx, active-memory, browser, canvas, cove, cron-context, device-pair, discord, file-transfer, memory-core, microsoft, nudge, phone-control, policy, skill-workshop, talk-voice, telegram)

Suggested investigation

  1. Profile what happens during the 22s bootstrap-context phase — is it CPU-bound sync work or stalled I/O?
  2. Check if applyBootstrapHookOverrides (plugin hooks) contributes to the delay
  3. Consider yielding the event loop periodically during bootstrap to allow I/O to flush
  4. Consider moving bootstrap prep to a Worker Thread

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