openclaw - 💡(How to fix) Fix Gateway event loop blocked during agent prep: max delay 32s, utilization 100%, API requests hang [6 comments, 6 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#75330Fetched 2026-05-01 05:35:05
View on GitHub
Comments
6
Participants
6
Timeline
15
Reactions
6
Timeline (top)
commented ×6cross-referenced ×5subscribed ×2mentioned ×1

Error Message

Error: channels.telegram.botToken: unresolved SecretRef "file:filemain:/telegram/botToken" durationMs=10017

Root Cause

The main session continuously triggers stuck-session diagnostics:

sessionId=allgemein state=processing age=146s queueDepth=1 reason=processing_with_queued_work

Recovery is skipped because an embedded run is active.

Code Example

02:46:38 - eventLoopDelayMaxMs=15,544ms  eventLoopUtilization=0.90
02:49:20 - eventLoopDelayMaxMs=6,492ms   eventLoopUtilization=0.60  
02:51:20 - eventLoopUtilization=1.0       ← immediately followed by:
02:51:23 - totalMs=41,088 (agent prep completes)
02:56:25 - eventLoopDelayMaxMs=5,544ms   eventLoopUtilization=0.34
02:57:03 - totalMs=43,772 (agent prep completes)

---

sessionId=allgemein state=processing age=146s queueDepth=1 reason=processing_with_queued_work

---

Error: channels.telegram.botToken: unresolved SecretRef "file:filemain:/telegram/botToken"
durationMs=10017
RAW_BUFFERClick to expand / collapse

Version

OpenClaw 2026.4.29 (a448042)

Environment

  • OS: CachyOS (Arch Linux), Kernel 6.19.12-1
  • Node: v25.9.0
  • Install: npm global
  • Hardware: Dell Latitude 5300

Symptoms

Gateway API requests become extremely slow or hang during agent preparation. The event loop shows massive blocking spikes. The allgemein main session is continuously reported as "stuck" at 140+ seconds.

Measured Event Loop Metrics

MetricWorst Value
eventLoopDelayMaxMs32,581 ms
eventLoopDelayMaxMs15,544 ms
eventLoopUtilization1.0 (100%)
eventLoopUtilization0.898

API Request Degradation (during agent prep)

RequestDurationNormal
models.list21,119 ms~300-500ms
sessions.list5,209 ms~500-700ms
node.list6,360 ms~300-500ms
node.list5,777 ms~300-500ms

Correlation: Prep stages ↔ event loop blocks

02:46:38 - eventLoopDelayMaxMs=15,544ms  eventLoopUtilization=0.90
02:49:20 - eventLoopDelayMaxMs=6,492ms   eventLoopUtilization=0.60  
02:51:20 - eventLoopUtilization=1.0       ← immediately followed by:
02:51:23 - totalMs=41,088 (agent prep completes)
02:56:25 - eventLoopDelayMaxMs=5,544ms   eventLoopUtilization=0.34
02:57:03 - totalMs=43,772 (agent prep completes)

The event loop blocks map directly to agent prep phases. The gateway is completely unresponsive to API calls during the 40+ second agent preparation window.

Stuck Session

The main session continuously triggers stuck-session diagnostics:

sessionId=allgemein state=processing age=146s queueDepth=1 reason=processing_with_queued_work

Recovery is skipped because an embedded run is active.

Additional Error (may be related)

During one stuck period, a lane task error appeared:

Error: channels.telegram.botToken: unresolved SecretRef "file:filemain:/telegram/botToken"
durationMs=10017

This 10-second error contributes to the event loop blocking but is secondary to the main prep-stage issue.

Root Cause Hypothesis

The system-prompt building stage (#75329) performs synchronous/blocking operations for the entire 30-35 second duration. This blocks the Node.js event loop, preventing the gateway from handling any other requests. The eventLoopUtilization=1.0 and delay metrics confirm the event loop starvation.

Possible causes:

  1. Synchronous file I/O during SKILL.md/manifest parsing
  2. frontmatter-Cc-V8aI2.js doing synchronous parsing that can fail/retry (related to #75328 json5 issue)
  3. Large in-memory string operations not being broken into chunks
  4. Missing await or setImmediate yields in the prep pipeline

Impact

  • Gateway API (dashboard, CLI tools) hangs during every agent interaction
  • openclaw status and openclaw gateway status take seconds instead of milliseconds
  • Combined with #75328 (Telegram dead) and #75329 (40s prep), the gateway is effectively broken

Regression

Version 2026.4.23: event loop clean, API requests <1s.

extent analysis

TL;DR

The most likely fix involves addressing the synchronous operations during the system-prompt building stage, which is blocking the Node.js event loop and causing the gateway to become unresponsive.

Guidance

  • Review the system-prompt building stage code for synchronous file I/O operations during SKILL.md/manifest parsing and consider converting them to asynchronous operations.
  • Investigate the frontmatter-Cc-V8aI2.js file for synchronous parsing that can fail or retry, and look into using asynchronous parsing methods.
  • Check the prep pipeline for missing await or setImmediate yields that could be causing the event loop to block.
  • Consider breaking down large in-memory string operations into smaller chunks to prevent event loop starvation.

Example

No specific code snippet can be provided without more context, but an example of converting a synchronous file I/O operation to an asynchronous one using fs.promises might look like this:

const fs = require('fs').promises;

// Before
const data = fs.readFileSync('SKILL.md', 'utf8');

// After
const data = await fs.readFile('SKILL.md', 'utf8');

Notes

The provided information suggests that the issue is related to the system-prompt building stage, but without access to the specific code, it's difficult to provide a more detailed solution. The lane task error mentioned may be a secondary issue caused by the event loop blocking.

Recommendation

Apply a workaround by identifying and addressing the synchronous operations in the system-prompt building stage, as this is the most likely cause of the event loop blocking and gateway unresponsiveness.

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 Gateway event loop blocked during agent prep: max delay 32s, utilization 100%, API requests hang [6 comments, 6 participants]