openclaw - 💡(How to fix) Fix Agent prep takes >40s: system-prompt building regression (30-35s spent in resolvePromptBuildSystemPrompt) [3 comments, 4 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#75329Fetched 2026-05-01 05:35:07
View on GitHub
Comments
3
Participants
4
Timeline
5
Reactions
3
Timeline (top)
commented ×3cross-referenced ×2

Code Example

totalMs=41088 system-prompt:30606ms (74%) core-plugin-tools:6357ms
totalMs=42444 system-prompt:33470ms (78%) core-plugin-tools:5725ms
totalMs=43250 system-prompt:34099ms (78%) core-plugin-tools:5496ms
totalMs=46183 system-prompt:34531ms (74%) core-plugin-tools:5611ms
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

Every agent start takes over 40 seconds. The system-prompt stage alone consumes 30-35 seconds (74-78% of total prep time). This was <5 seconds in v2026.4.23.

Measured Data (4 consecutive runs, same session)

totalMs=41088 system-prompt:30606ms (74%) core-plugin-tools:6357ms
totalMs=42444 system-prompt:33470ms (78%) core-plugin-tools:5725ms
totalMs=43250 system-prompt:34099ms (78%) core-plugin-tools:5496ms
totalMs=46183 system-prompt:34531ms (74%) core-plugin-tools:5611ms

Full stage breakdown (typical run)

StageDuration%
system-prompt30,606 ms74.6%
core-plugin-tools6,357 ms15.5%
stream-setup2,255 ms5.5%
session-resource-loader1,404 ms3.4%
bundle-tools454 ms1.1%
bootstrap-context8 ms0.0%
workspace-sandbox1 ms0.0%
skills0 ms0.0%
Total41,088 ms

Context Size

  • 7 workspace files (AGENTS.md, SOUL.md, USER.md, etc.): ~10 KB total
  • 9 SKILL.md skill files: ~71 KB total
  • Memory (today + yesterday): ~10-20 KB
  • Dynamic runtime context: variable
  • Total: ~80-100 KB

For processing ~80-100 KB of text, 30+ seconds is not normal.

Processing Path

The system prompt is built in: dist/agent-harness-runtime-CZhqA2px.jsresolvePromptBuildSystemPrompt()

This function processes workspace context, skill manifests, memory files, and assembles the final system prompt string.

Additional Observation

core-plugin-tools also increased significantly: 5-6s in v2026.4.29 vs <1s in v2026.4.23. This could be related to the json5 import issue (#75328) if frontmatter parsing is happening synchronously and blocking.

session-resource-loader duration is highly variable (0.5s to 2.5s) - also a potential sub-issue.

Impact

  • Every agent response is delayed by 40+ seconds
  • User experience severely degraded
  • Combined with event loop blocking (#75330), the gateway is barely usable

Regression

Version 2026.4.23: agent prep took ~5-8 seconds total.

extent analysis

TL;DR

Downgrade to version 2026.4.23 or investigate the resolvePromptBuildSystemPrompt() function for potential bottlenecks.

Guidance

  • Investigate the resolvePromptBuildSystemPrompt() function in dist/agent-harness-runtime-CZhqA2px.js to identify potential causes for the slowdown.
  • Review the changes made between versions 2026.4.23 and 2026.4.29 to determine if any updates could be contributing to the issue.
  • Consider asynchronous processing for frontmatter parsing in core-plugin-tools to prevent blocking.
  • Monitor the session-resource-loader duration to determine if it's a separate issue that needs to be addressed.

Notes

The issue seems to be related to the processing of the system prompt, but without more information about the changes made between versions, it's difficult to provide a more specific solution.

Recommendation

Apply workaround: Downgrade to version 2026.4.23, as it has been confirmed to have a significantly faster agent prep time. This will allow for further investigation into the cause of the slowdown in version 2026.4.29.

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 Agent prep takes >40s: system-prompt building regression (30-35s spent in resolvePromptBuildSystemPrompt) [3 comments, 4 participants]