openclaw - 💡(How to fix) Fix core-plugin-tools prep stage takes ~11s on every embedded run (cached registry, per-run factory cost) [2 comments, 3 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#75290Fetched 2026-05-01 05:35:42
View on GitHub
Comments
2
Participants
3
Timeline
4
Reactions
2
Timeline (top)
commented ×2cross-referenced ×2

In runEmbeddedAttempt, the prep stage core-plugin-tools consistently takes ~10–12 s on every embedded run, dominating startup latency. The cost is paid even when the plugin registry is fully cached (no manifest scan), so it's not a discovery/IO cost — it's coming from per-run plugin tool factory invocations.

Subagent runs that pass disablePluginTools: true (e.g. skill-workshop-review) take ~0 ms in the same stage, which isolates the cost squarely to plugin tool resolution.

Running v2026.4.27. The cold persisted registry change in v2026.4.25 (per CHANGELOG) helped manifest scans but did not affect this per-run cost.

Root Cause

In runEmbeddedAttempt, the prep stage core-plugin-tools consistently takes ~10–12 s on every embedded run, dominating startup latency. The cost is paid even when the plugin registry is fully cached (no manifest scan), so it's not a discovery/IO cost — it's coming from per-run plugin tool factory invocations.

Subagent runs that pass disablePluginTools: true (e.g. skill-workshop-review) take ~0 ms in the same stage, which isolates the cost squarely to plugin tool resolution.

Running v2026.4.27. The cold persisted registry change in v2026.4.25 (per CHANGELOG) helped manifest scans but did not affect this per-run cost.

Fix Action

Fix / Workaround

  1. Build core coding tools (read/write/edit/exec/applyPatch) — millisecond range.
  2. Call createOpenClawTools (dist/openclaw-tools-BnZyM43Q.js) which instantiates ~15 native tools (canvas, cron, message, tts, image-generate, music-generate, video-generate, gateway, sessions-list/history/send/spawn/yield, agents-list, web-search, web-fetch, image, pdf). Each factory is light.
  3. Call resolvePluginTools (dist/tools-B9flTjj3.js), which iterates the cached registry and invokes entry.factory(params.context) for every plugin tool, every run.

Happy to run more traces / patch a debug build if useful.

Code Example

core-plugin-tools:11675ms@13819ms  totalMs=48374
core-plugin-tools:11891ms@11899ms  totalMs=20845
core-plugin-tools:11153ms@11510ms  totalMs=21709
core-plugin-tools:11963ms@12732ms  totalMs=22326
core-plugin-tools:11643ms@11648ms  totalMs=20972
core-plugin-tools:11682ms@13445ms  totalMs=27994
core-plugin-tools:11891ms@11897ms  totalMs=48471
core-plugin-tools:11901ms@13514ms  totalMs=31357
core-plugin-tools:11103ms@12708ms  totalMs=42552
core-plugin-tools:10691ms@12258ms  totalMs=47577
core-plugin-tools:11153ms@12827ms  totalMs=47542
core-plugin-tools:11212ms@11220ms  totalMs=21667
core-plugin-tools:12753ms@14439ms  totalMs=51442
core-plugin-tools:12958ms@13014ms  totalMs=24531
core-plugin-tools:11699ms@13794ms  totalMs=52099
core-plugin-tools:12261ms@13810ms  totalMs=58969
core-plugin-tools:11993ms@13831ms  totalMs=32672
core-plugin-tools:11911ms@13671ms  totalMs=55732
core-plugin-tools:12330ms@14310ms  totalMs=57267
core-plugin-tools:11572ms@11758ms  totalMs=43813
core-plugin-tools:11768ms@11824ms  totalMs=26290
core-plugin-tools:11808ms@11816ms  totalMs=20907
core-plugin-tools:11363ms@13310ms  totalMs=48191
core-plugin-tools:10828ms@10834ms  totalMs=45231
core-plugin-tools:11671ms@13261ms  totalMs=44933
core-plugin-tools:11444ms@13069ms  totalMs=30574
core-plugin-tools:11974ms@11986ms  totalMs=20772
core-plugin-tools:11600ms@13016ms  totalMs=34062

---

core-plugin-tools:0ms@207ms     totalMs=10468
core-plugin-tools:1ms@379ms     totalMs=15345

---

toolsRaw = applyEmbeddedAttemptToolsAllow(createOpenClawCodingTools({...}))
RAW_BUFFERClick to expand / collapse

Summary

In runEmbeddedAttempt, the prep stage core-plugin-tools consistently takes ~10–12 s on every embedded run, dominating startup latency. The cost is paid even when the plugin registry is fully cached (no manifest scan), so it's not a discovery/IO cost — it's coming from per-run plugin tool factory invocations.

Subagent runs that pass disablePluginTools: true (e.g. skill-workshop-review) take ~0 ms in the same stage, which isolates the cost squarely to plugin tool resolution.

Running v2026.4.27. The cold persisted registry change in v2026.4.25 (per CHANGELOG) helped manifest scans but did not affect this per-run cost.

Reproducible trace

[trace:embedded-run] prep stages lines from ~/.openclaw/logs over a few hours, six agents, single gateway process:

core-plugin-tools:11675ms@13819ms  totalMs=48374
core-plugin-tools:11891ms@11899ms  totalMs=20845
core-plugin-tools:11153ms@11510ms  totalMs=21709
core-plugin-tools:11963ms@12732ms  totalMs=22326
core-plugin-tools:11643ms@11648ms  totalMs=20972
core-plugin-tools:11682ms@13445ms  totalMs=27994
core-plugin-tools:11891ms@11897ms  totalMs=48471
core-plugin-tools:11901ms@13514ms  totalMs=31357
core-plugin-tools:11103ms@12708ms  totalMs=42552
core-plugin-tools:10691ms@12258ms  totalMs=47577
core-plugin-tools:11153ms@12827ms  totalMs=47542
core-plugin-tools:11212ms@11220ms  totalMs=21667
core-plugin-tools:12753ms@14439ms  totalMs=51442
core-plugin-tools:12958ms@13014ms  totalMs=24531
core-plugin-tools:11699ms@13794ms  totalMs=52099
core-plugin-tools:12261ms@13810ms  totalMs=58969
core-plugin-tools:11993ms@13831ms  totalMs=32672
core-plugin-tools:11911ms@13671ms  totalMs=55732
core-plugin-tools:12330ms@14310ms  totalMs=57267
core-plugin-tools:11572ms@11758ms  totalMs=43813
core-plugin-tools:11768ms@11824ms  totalMs=26290
core-plugin-tools:11808ms@11816ms  totalMs=20907
core-plugin-tools:11363ms@13310ms  totalMs=48191
core-plugin-tools:10828ms@10834ms  totalMs=45231
core-plugin-tools:11671ms@13261ms  totalMs=44933
core-plugin-tools:11444ms@13069ms  totalMs=30574
core-plugin-tools:11974ms@11986ms  totalMs=20772
core-plugin-tools:11600ms@13016ms  totalMs=34062

Compare to the same field on a skill-workshop-review subagent run (which passes disablePluginTools: true):

core-plugin-tools:0ms@207ms     totalMs=10468
core-plugin-tools:1ms@379ms     totalMs=15345

i.e. the entire core-plugin-tools cost vanishes when plugin tool resolution is skipped.

What I traced in the bundle

In dist/selection-O4IbJwaT.js the core-plugin-tools mark wraps a single expression:

toolsRaw = applyEmbeddedAttemptToolsAllow(createOpenClawCodingTools({...}))

Inside createOpenClawCodingTools (dist/pi-tools-BS_IGzoH.js):

  1. Build core coding tools (read/write/edit/exec/applyPatch) — millisecond range.
  2. Call createOpenClawTools (dist/openclaw-tools-BnZyM43Q.js) which instantiates ~15 native tools (canvas, cron, message, tts, image-generate, music-generate, video-generate, gateway, sessions-list/history/send/spawn/yield, agents-list, web-search, web-fetch, image, pdf). Each factory is light.
  3. Call resolvePluginTools (dist/tools-B9flTjj3.js), which iterates the cached registry and invokes entry.factory(params.context) for every plugin tool, every run.

The third step is the suspect. The registry itself is cached by cacheKey (dist/loader-SnjzoVJ_.js:3490), but the entry.factory calls are not — they receive params.context (sandbox / sessionKey / workspaceDir / delivery context) which legitimately varies per run, but the body of those factories appears to do enough fixed work to add up to ~11 s consistently.

The constancy (always 10.7–13.0 s, never lower, never much higher) suggests the cost is fixed per run rather than scaling with plugin count or workspace size.

Setup

  • 13 plugins in plugins.allow: acpx, brave, google, llm-router-sync, mattermost, memory-core, memory-wiki, minimax, openrouter, skill-workshop, telegram, webhooks, zai
  • Of those, 7 are onStartup: true (acpx, mattermost, memory-core, memory-wiki, skill-workshop, telegram, webhooks)
  • 6 active agents, one shared gateway process
  • 122 bundled extensions in dist/extensions/

Asks

  1. Is this expected on v2026.4.27, or is there a regression vs. earlier versions?
  2. Are factory results memoizable per (pluginId, sandboxKey) to amortize across runs that share workspace?
  3. Is there a config knob to opt agents out of plugin tools (the equivalent of disablePluginTools: true exposed at the agent or run level), for agents/sessions that don't need plugin tools?
  4. Could core-plugin-tools be split into per-plugin sub-marks so we can tell which plugin's factory is the heaviest?

Happy to run more traces / patch a debug build if useful.

extent analysis

TL;DR

The likely fix involves optimizing or memoizing the resolvePluginTools function to reduce the constant ~10-12s overhead per run.

Guidance

  1. Investigate memoization: Explore the possibility of memoizing the results of entry.factory calls in resolvePluginTools to avoid redundant computations across runs.
  2. Optimize plugin tool factories: Analyze the plugin tool factories to identify potential optimizations, focusing on the fixed work done within each factory.
  3. Consider config options: Investigate the existence of config options or knobs that could allow opting agents out of plugin tools or adjusting the plugin tool resolution process.
  4. Split core-plugin-tools mark: Split the core-plugin-tools mark into per-plugin sub-marks to better understand which plugin's factory is contributing the most to the overhead.

Example

No specific code example is provided due to the lack of explicit code snippets in the issue that can be directly modified or optimized.

Notes

The provided information suggests that the issue is related to the resolvePluginTools function and the constant overhead it introduces. However, without more detailed information about the implementation of this function and the surrounding code, it's challenging to provide a precise solution.

Recommendation

Apply a workaround by investigating memoization options for the resolvePluginTools function or optimizing the plugin tool factories to reduce the overhead. This approach is recommended because it directly addresses the identified root cause of the issue.

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 core-plugin-tools prep stage takes ~11s on every embedded run (cached registry, per-run factory cost) [2 comments, 3 participants]