openclaw - 💡(How to fix) Fix [Bug]: Gateway pegs a CPU core during agent tool run with no read I/O [2 pull requests]

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 an embedded agent tool run, the gateway process can spend most samples at or above one full CPU core with no read I/O, indicating CPU-bound event handling rather than disk reads.

Root Cause

During an embedded agent tool run, the gateway process can spend most samples at or above one full CPU core with no read I/O, indicating CPU-bound event handling rather than disk reads.

Fix Action

Fixed

Code Example

pidstat summary: rows=60 avg_usr=79.42 avg_sys=4.25 avg_wait=0.03 avg_cpu=83.66 avg_minflt=307.77 avg_majflt=0.00 avg_rd=0.00 avg_wr=90.16 avg_ccwr=67.10
cpu_ge_90_count=43 cpu_ge_100_count=42 max_cpu=190.0
selected rows:
05:07:11 cpu=100.00 rd=0.00 majflt=0 openclaw
05:07:47 cpu=190.00 rd=0.00 majflt=0 openclaw
05:08:04 cpu=101.00 rd=0.00 majflt=0 openclaw
redacted gateway correlation:
2026-05-21T05:07:47.187+00:00 agent/embedded embedded run tool start: runId=[redacted run id] tool=exec toolCallId=REDACTED
2026-05-21T05:08:04.330+00:00 agent/embedded embedded run tool end: runId=[redacted run id] tool=exec toolCallId=REDACTED
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

During an embedded agent tool run, the gateway process can spend most samples at or above one full CPU core with no read I/O, indicating CPU-bound event handling rather than disk reads.

Steps to reproduce

  1. Run a gateway with the Control UI connected during an embedded agent/tool run.
  2. Capture pidstat -h -u -r -d -p <gateway-pid> 1 60 for the gateway process during the tool window.
  3. Correlate the sample with gateway tool start/end logs and websocket event delivery.

Expected behavior

Gateway event handling should avoid redundant live tool-event projection and should preserve event-loop budget for timers, websocket control traffic, channel health checks, and chat latency.

Actual behavior

A 60-second sample averaged 83.66% CPU, had 42 of 60 rows at or above 100% CPU, peaked at 190% CPU, and averaged 0.00 kB/s read I/O. Gateway logs show the hot window overlapped an embedded tool run.

OpenClaw version

NOT_ENOUGH_INFO

Operating system

NOT_ENOUGH_INFO

Install method

NOT_ENOUGH_INFO

Model

NOT_ENOUGH_INFO

Provider / routing chain

NOT_ENOUGH_INFO

Additional provider/model setup details

NOT_ENOUGH_INFO

Logs, screenshots, and evidence

pidstat summary: rows=60 avg_usr=79.42 avg_sys=4.25 avg_wait=0.03 avg_cpu=83.66 avg_minflt=307.77 avg_majflt=0.00 avg_rd=0.00 avg_wr=90.16 avg_ccwr=67.10
cpu_ge_90_count=43 cpu_ge_100_count=42 max_cpu=190.0
selected rows:
05:07:11 cpu=100.00 rd=0.00 majflt=0 openclaw
05:07:47 cpu=190.00 rd=0.00 majflt=0 openclaw
05:08:04 cpu=101.00 rd=0.00 majflt=0 openclaw
redacted gateway correlation:
2026-05-21T05:07:47.187+00:00 agent/embedded embedded run tool start: runId=[redacted run id] tool=exec toolCallId=REDACTED
2026-05-21T05:08:04.330+00:00 agent/embedded embedded run tool end: runId=[redacted run id] tool=exec toolCallId=REDACTED

Impact and severity

Affected: gateways running embedded agent/tool work with live UI subscribers. Severity: high for responsiveness. Frequency: one exact 60-second live sample captured during the investigation. Consequence: one gateway process can consume a full core during tool-event handling, leaving less event-loop budget for other gateway responsibilities.

Additional information

Primary fix path: deduplicate live tool event mirrors so overlapping run-scoped and session-scoped websocket subscriptions do not receive duplicate tool frames. Related fix path: back off low-priority session tool mirrors while diagnostic queue pressure is active.

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…

FAQ

Expected behavior

Gateway event handling should avoid redundant live tool-event projection and should preserve event-loop budget for timers, websocket control traffic, channel health checks, and chat latency.

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]: Gateway pegs a CPU core during agent tool run with no read I/O [2 pull requests]