openclaw - 💡(How to fix) Fix [Bug]: Session cleanup per #75707 workaround has no effect on ~18s prep-stage overhead (macOS ARM64, v2026.4.29) [1 comments, 2 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#76009Fetched 2026-05-03 04:43:21
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
2
Timeline (top)
mentioned ×2subscribed ×2closed ×1commented ×1

Follow-up to #75861 (closed as duplicate of #75707) and #75688 (closed, superseded by narrower trackers). This report tracks what was tried, measured results, and whether any improvement occurred on an affected macOS ARM64 machine after applying one of the #75707 workarounds.

Root Cause

Follow-up to #75861 (closed as duplicate of #75707) and #75688 (closed, superseded by narrower trackers). This report tracks what was tried, measured results, and whether any improvement occurred on an affected macOS ARM64 machine after applying one of the #75707 workarounds.

Fix Action

Fix / Workaround

Follow-up to #75861 (closed as duplicate of #75707) and #75688 (closed, superseded by narrower trackers). This report tracks what was tried, measured results, and whether any improvement occurred on an affected macOS ARM64 machine after applying one of the #75707 workarounds.

Following the #75707 workaround list, the most impactful item was attempted:

The zombie-session workaround from #75707 did NOT resolve the pre-flight overhead on this macOS configuration. The core-plugin-tools (6.2s), system-prompt (5.0s), and stream-setup (5.0s) stages are completely unaffected by session file count. This confirms @adminsystemease's observation on #75861 that the bottleneck is synchronous JS work in the embedded runtime, not I/O or session state.

Code Example

prep stages totalMs=18325:
  core-plugin-tools:       6216ms
  system-prompt:           4986ms
  stream-setup:            4939ms
  bundle-tools:            1104ms
  session-resource-loader: 1075ms
  bootstrap-context:          5ms
  workspace-sandbox:          0ms

---

Run 1: totalMs=18266  core-plugin-tools:6142  system-prompt:4999  stream-setup:4938  bundle-tools:1110  session-resource-loader:1074
Run 2: totalMs=18221  core-plugin-tools:6170  system-prompt:4994  stream-setup:4918  bundle-tools:1068  session-resource-loader:1067
Run 3: totalMs=18869  core-plugin-tools:6147  system-prompt:4972  stream-setup:4953  bundle-tools:1100  session-resource-loader:1690
Run 4: totalMs=18209  core-plugin-tools:6151  system-prompt:4983  stream-setup:4925  bundle-tools:1069  session-resource-loader:1079
Run 5: totalMs=18320  core-plugin-tools:6213  system-prompt:4991  stream-setup:4954  bundle-tools:1071  session-resource-loader:1088

---

eventLoopDelayMaxMs: 7017–10502ms
eventLoopUtilization: 0.780.91
interval: 30–36s

---

eventLoopDelayMaxMs: 5763–8015ms  (marginal ~20% reduction, still 10× above normal <500ms)
eventLoopUtilization: 0.230.97  (still widely fluctuating)
interval: 31–36s  (unchanged)

---

2026-05-02T16:20:43.829+08:00 [trace:embedded-run] prep stages totalMs=18266 stages=workspace-sandbox:1ms,skills:0ms,core-plugin-tools:6142ms,bootstrap-context:2ms,bundle-tools:1110ms,system-prompt:4999ms,session-resource-loader:1074ms,agent-session:0ms,stream-setup:4938ms
2026-05-02T16:23:49.343+08:00 [trace:embedded-run] prep stages totalMs=18221 stages=workspace-sandbox:1ms,skills:0ms,core-plugin-tools:6170ms,bootstrap-context:3ms,bundle-tools:1068ms,system-prompt:4994ms,session-resource-loader:1067ms,agent-session:0ms,stream-setup:4918ms
2026-05-02T16:28:58.692+08:00 [trace:embedded-run] prep stages totalMs=18869 stages=workspace-sandbox:0ms,skills:0ms,core-plugin-tools:6147ms,bootstrap-context:7ms,bundle-tools:1100ms,system-prompt:4972ms,session-resource-loader:1690ms,agent-session:0ms,stream-setup:4953ms
2026-05-02T16:31:54.072+08:00 [trace:embedded-run] prep stages totalMs=18209 stages=workspace-sandbox:0ms,skills:0ms,core-plugin-tools:6151ms,bootstrap-context:1ms,bundle-tools:1069ms,system-prompt:4983ms,session-resource-loader:1079ms,agent-session:1ms,stream-setup:4925ms
2026-05-02T16:35:51.065+08:00 [trace:embedded-run] prep stages totalMs=18320 stages=workspace-sandbox:1ms,skills:0ms,core-plugin-tools:6213ms,bootstrap-context:2ms,bundle-tools:1071ms,system-prompt:4991ms,session-resource-loader:1088ms,agent-session:0ms,stream-setup:4954ms

---

2026-05-02T16:20:45.871+08:00 [diagnostic] liveness warning: reasons=event_loop_delay,event_loop_utilization,cpu interval=32s eventLoopDelayP99Ms=6727.7 eventLoopDelayMaxMs=7017.1 eventLoopUtilization=0.966 cpuCoreRatio=0.99 active=1
2026-05-02T16:31:56.369+08:00 [diagnostic] liveness warning: reasons=event_loop_delay,cpu interval=34s eventLoopDelayP99Ms=6752.8 eventLoopDelayMaxMs=7021.3 eventLoopUtilization=0.935 cpuCoreRatio=0.959 active=1
RAW_BUFFERClick to expand / collapse

Summary

Follow-up to #75861 (closed as duplicate of #75707) and #75688 (closed, superseded by narrower trackers). This report tracks what was tried, measured results, and whether any improvement occurred on an affected macOS ARM64 machine after applying one of the #75707 workarounds.

Environment (unchanged)

  • OpenClaw: 2026.4.29 (a448042)
  • Node: v25.9.0
  • OS: macOS 26.4.1 (ARM64, Mac Studio M1 Max, 64GB)
  • Channel: Feishu WebSocket
  • Model: DeepSeek V4 Flash / V4 Pro (remote), Ollama qwen30-a3b-128k (local)
  • Gateway PID: 38057, running ~13h
  • Memory: 941MB RSS (peak ~960MB)
  • Plugins: feishu, llm-task, memclaw
  • MCP: mempalace (Python), context-mode (npx)

What Was Tried

Following the #75707 workaround list, the most impactful item was attempted:

"Delete zombie sessions (rm ~/.openclaw/agents/*/sessions/*.jsonl) — CPU 100%+ → 30%"

Action taken at ~2026-05-02 06:45 UTC:

  • Identified 53 session files (26 sessions + trajectories), 41MB total under agents/main/sessions/
  • Classified by content:
    • ~20 sessions: cron auto-tasks (news capture/clean/briefing, token reports, WeChat drafts, GitHub issue checks, NAS backup)
    • ~15 sessions: subagent child tasks
    • ~3 sessions: human direct chat (including the active session)
  • Archived 46 files (23 sessions) to sessions-backup/ — all auto-task and subagent sessions
  • Retained 2 human-chat sessions (1 active: d66a10df, 1 recent: 323ed82f)
  • Sessions directory reduced from 41MB / 53 files → 18MB / ~6 files

Measured Results — Prep Stages (pre-model call overhead)

Before cleanup (#75861 data, ~03:56 UTC):

prep stages totalMs=18325:
  core-plugin-tools:       6216ms
  system-prompt:           4986ms
  stream-setup:            4939ms
  bundle-tools:            1104ms
  session-resource-loader: 1075ms
  bootstrap-context:          5ms
  workspace-sandbox:          0ms

After cleanup (latest 5 runs, 08:20–08:35 UTC):

Run 1: totalMs=18266  core-plugin-tools:6142  system-prompt:4999  stream-setup:4938  bundle-tools:1110  session-resource-loader:1074
Run 2: totalMs=18221  core-plugin-tools:6170  system-prompt:4994  stream-setup:4918  bundle-tools:1068  session-resource-loader:1067
Run 3: totalMs=18869  core-plugin-tools:6147  system-prompt:4972  stream-setup:4953  bundle-tools:1100  session-resource-loader:1690
Run 4: totalMs=18209  core-plugin-tools:6151  system-prompt:4983  stream-setup:4925  bundle-tools:1069  session-resource-loader:1079
Run 5: totalMs=18320  core-plugin-tools:6213  system-prompt:4991  stream-setup:4954  bundle-tools:1071  session-resource-loader:1088

No measurable improvement in prep stages. All values within ±2% of pre-cleanup baseline.

Measured Results — Event Loop Blocking (liveness warnings)

Before:

eventLoopDelayMaxMs: 7017–10502ms
eventLoopUtilization: 0.78–0.91
interval: 30–36s

After:

eventLoopDelayMaxMs: 5763–8015ms  (marginal ~20% reduction, still 10× above normal <500ms)
eventLoopUtilization: 0.23–0.97  (still widely fluctuating)
interval: 31–36s  (unchanged)

Marginal improvement, far from resolved.

Measured Results — Gateway Process

MetricBeforeAfter
CPU53.7% (under load)8.4% (idle moment)
RSS940MB941MB
node.list latency67ms–8428msunchanged pattern

Persistent Issues (still present after cleanup)

  1. agent.wait peaks: 315,808ms (5min 16s) observed
  2. trajectory-flush timeouts: ≥10s, occurred twice
  3. API timeouts (AxiosError 10000ms): continuing
  4. Startup auth stage: 4.5–5.0s (tracked at #75782, no fix yet)

Correlation with Other Reports

IssueOverlapStatus
#75707Same symptoms, different OS (Ubuntu)OPEN
#75290core-plugin-tools latencyOPEN, PR by @hexsprite pending
#75782auth stage 10–15sOPEN, diagnosed only
#759994.29 regression, ~73s prep stagesOPEN, created today
#75439heartbeat exec-event runawayOPEN, PR by @hexsprite pending

Conclusion

The zombie-session workaround from #75707 did NOT resolve the pre-flight overhead on this macOS configuration. The core-plugin-tools (6.2s), system-prompt (5.0s), and stream-setup (5.0s) stages are completely unaffected by session file count. This confirms @adminsystemease's observation on #75861 that the bottleneck is synchronous JS work in the embedded runtime, not I/O or session state.

The machine remains on 2026.4.29. The two pending PRs from @hexsprite (manifest scan cache + heartbeat cooldown) are the most promising near-term fixes, but neither addresses system-prompt or stream-setup directly.

Raw log excerpts

2026-05-02T16:20:43.829+08:00 [trace:embedded-run] prep stages totalMs=18266 stages=workspace-sandbox:1ms,skills:0ms,core-plugin-tools:6142ms,bootstrap-context:2ms,bundle-tools:1110ms,system-prompt:4999ms,session-resource-loader:1074ms,agent-session:0ms,stream-setup:4938ms
2026-05-02T16:23:49.343+08:00 [trace:embedded-run] prep stages totalMs=18221 stages=workspace-sandbox:1ms,skills:0ms,core-plugin-tools:6170ms,bootstrap-context:3ms,bundle-tools:1068ms,system-prompt:4994ms,session-resource-loader:1067ms,agent-session:0ms,stream-setup:4918ms
2026-05-02T16:28:58.692+08:00 [trace:embedded-run] prep stages totalMs=18869 stages=workspace-sandbox:0ms,skills:0ms,core-plugin-tools:6147ms,bootstrap-context:7ms,bundle-tools:1100ms,system-prompt:4972ms,session-resource-loader:1690ms,agent-session:0ms,stream-setup:4953ms
2026-05-02T16:31:54.072+08:00 [trace:embedded-run] prep stages totalMs=18209 stages=workspace-sandbox:0ms,skills:0ms,core-plugin-tools:6151ms,bootstrap-context:1ms,bundle-tools:1069ms,system-prompt:4983ms,session-resource-loader:1079ms,agent-session:1ms,stream-setup:4925ms
2026-05-02T16:35:51.065+08:00 [trace:embedded-run] prep stages totalMs=18320 stages=workspace-sandbox:1ms,skills:0ms,core-plugin-tools:6213ms,bootstrap-context:2ms,bundle-tools:1071ms,system-prompt:4991ms,session-resource-loader:1088ms,agent-session:0ms,stream-setup:4954ms
2026-05-02T16:20:45.871+08:00 [diagnostic] liveness warning: reasons=event_loop_delay,event_loop_utilization,cpu interval=32s eventLoopDelayP99Ms=6727.7 eventLoopDelayMaxMs=7017.1 eventLoopUtilization=0.966 cpuCoreRatio=0.99 active=1
2026-05-02T16:31:56.369+08:00 [diagnostic] liveness warning: reasons=event_loop_delay,cpu interval=34s eventLoopDelayP99Ms=6752.8 eventLoopDelayMaxMs=7021.3 eventLoopUtilization=0.935 cpuCoreRatio=0.959 active=1

extent analysis

TL;DR

The zombie-session workaround from #75707 did not resolve the pre-flight overhead issue on the macOS configuration, suggesting that the bottleneck is synchronous JS work in the embedded runtime.

Guidance

  • Review the core-plugin-tools, system-prompt, and stream-setup stages to identify potential synchronous JS work that may be causing the bottleneck.
  • Investigate the pending PRs from @hexsprite (manifest scan cache + heartbeat cooldown) as potential near-term fixes.
  • Analyze the raw log excerpts to gain further insight into the prep stages and liveness warning issues.
  • Consider testing the system with a reduced workload or in a controlled environment to isolate the root cause of the issue.

Example

No code snippet is provided as the issue does not contain specific code-related information.

Notes

The issue is complex and may require a multi-faceted approach to resolve. The provided guidance is based on the information available in the issue and may not be exhaustive.

Recommendation

Apply the pending PRs from @hexsprite (manifest scan cache + heartbeat cooldown) as they may address some of the underlying issues, although they do not directly address the system-prompt or stream-setup stages.

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 [Bug]: Session cleanup per #75707 workaround has no effect on ~18s prep-stage overhead (macOS ARM64, v2026.4.29) [1 comments, 2 participants]