Summary
The node.list RPC call performs a filesystem scan over all directories in ~/.openclaw/agents/ on every invocation, including directories that are orphaned (not present in agents.list). On hosts with many stale agent directories and slow storage (eMMC/SD card), this causes the Node.js event loop to block for 30–48 seconds per call, making the gateway unresponsive.
Environment
- OpenClaw version: 2026.4.29 (a448042)
- OS: Ubuntu, Linux 6.8.0-111-generic x86_64
- Hardware: Intel Celeron N4000 @ 1.10GHz, 2 cores, eMMC storage
- Node.js: 25.5.0
Steps to Reproduce
- Add many agents to
agents.list, use them, then remove them from the config (leaving their directories on disk)
- Or install a bulk agent pack and later remove entries from config
- Start the gateway
- Open the control UI — trigger
node.list RPC call
- Observe event loop delay
Observed Behavior
node.list takes 48 seconds to respond
sessions.list takes 7–8 seconds
- Gateway liveness warning fires:
eventLoopDelayMaxMs=36473.7ms, eventLoopUtilization=0.667
- Gateway process consumes 85–100% CPU on a 2-core machine
- System load average reaches 3.5+ on a 2-core host
Log evidence:
[WARN] liveness warning: reasons=event_loop_delay interval=57s eventLoopDelayP99Ms=34.2 eventLoopDelayMaxMs=36473.7 eventLoopUtilization=0.667 cpuCoreRatio=0.659
[INFO] ⇄ res ✓ node.list 48689ms
[INFO] ⇄ res ✓ sessions.list 7001ms
152 agent directories were present on disk; only 2 were registered in agents.list. After manually deleting the 150 orphaned directories, node.list response time dropped dramatically and gateway CPU settled to ~25%.
Expected Behavior
node.list should only scan directories for agents present in agents.list, skipping orphaned directories entirely
- Alternatively, disk I/O should be non-blocking / async so it does not stall the event loop regardless of directory count
Secondary Issue: No cleanup path
openclaw doctor detects orphaned agent directories and warns about them, but offers no fix command — only a manual instruction to "restore or remove stale dirs." Given that orphaned dirs directly cause severe performance degradation, doctor --fix should handle this automatically.
Workaround
Manually delete orphaned directories:
# Keep only dirs that match an entry in agents.list
cd ~/.openclaw/agents
# Remove all dirs not in your agents.list
Summary
The
node.listRPC call performs a filesystem scan over all directories in~/.openclaw/agents/on every invocation, including directories that are orphaned (not present inagents.list). On hosts with many stale agent directories and slow storage (eMMC/SD card), this causes the Node.js event loop to block for 30–48 seconds per call, making the gateway unresponsive.Environment
Steps to Reproduce
agents.list, use them, then remove them from the config (leaving their directories on disk)node.listRPC callObserved Behavior
node.listtakes 48 seconds to respondsessions.listtakes 7–8 secondseventLoopDelayMaxMs=36473.7ms,eventLoopUtilization=0.667Log evidence:
152 agent directories were present on disk; only 2 were registered in
agents.list. After manually deleting the 150 orphaned directories,node.listresponse time dropped dramatically and gateway CPU settled to ~25%.Expected Behavior
node.listshould only scan directories for agents present inagents.list, skipping orphaned directories entirelySecondary Issue: No cleanup path
openclaw doctordetects orphaned agent directories and warns about them, but offers no fix command — only a manual instruction to "restore or remove stale dirs." Given that orphaned dirs directly cause severe performance degradation,doctor --fixshould handle this automatically.Workaround
Manually delete orphaned directories: