openclaw - 💡(How to fix) Fix core-plugin-tools per-turn cost: #75290 is still valid (5.3-beta.4) [5 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#77180Fetched 2026-05-05 05:51:22
View on GitHub
Comments
5
Participants
4
Timeline
30
Reactions
2
Author
Timeline (top)
mentioned ×12subscribed ×12commented ×5closed ×1

Issue #75290 was closed as "implemented" on 2026-05-01, reopened the same day when testing proved it was not fixed, then closed again on 2026-05-03 based on a single user's report. Our test on 5.3-beta.4 shows the per-turn plugin cost is still present. This issue collates all data points and explains why #75290 remains a valid bug requiring an architectural fix, not incremental optimization.


Root Cause

The root cause remains: resolvePluginTools calls entry.factory(params.context) for every plugin tool on every single embedded run. The factories are invoked every turn, regardless of whether the registry is cached or descriptors are memoized.

Code Example

Turn 1: loaded 92 plugin(s) (66 attempted) in 1389.4ms
Turn 2: loaded 92 plugin(s) (66 attempted) in  993.8ms
Turn 3: loaded 92 plugin(s) (66 attempted) in 1092.2ms
RAW_BUFFERClick to expand / collapse

Summary

Issue #75290 was closed as "implemented" on 2026-05-01, reopened the same day when testing proved it was not fixed, then closed again on 2026-05-03 based on a single user's report. Our test on 5.3-beta.4 shows the per-turn plugin cost is still present. This issue collates all data points and explains why #75290 remains a valid bug requiring an architectural fix, not incremental optimization.


Timeline of #75290

DateEventEvidence
2026-04-30Opened by @thanos-openclawcore-plugin-tools = ~11s every embedded run
2026-05-01@clawsweeper[bot] closes as "implemented"Claims media factory gating + descriptor caching fixed it
2026-05-01@steipete reopensTests origin/main — warm turns still 10.6–11.1s
2026-05-01@sene1337, @crash2kx, @sashadragon pile on4.29 repros: 7–19s, Pi/VPS/Telegram, all affected
2026-05-02@dimasalmin traces to media factoriesimage-gen (3179ms) + video-gen (3849ms) + music (977ms) + web-search (1862ms) per turn
2026-05-02@jasonftl (Pi 500) reports 15–18sLocalizes to 7 built-in tool factories
2026-05-03@sergeyksv tests post-5.2 origin/mainStill 5.7s per turn (core-plugin-tools: 5750ms), pdf-tool alone = 3.7s
2026-05-03@jasonftl: "no longer experience the issue on 5.2"Issue closed again based on this single comment

Our Test: 5.3-beta.4 on Pi 5 (8GB)

Hardware: Raspberry Pi 5, 8GB RAM. OpenClaw 2026.5.3-beta.4.

Status Queries (improved ✅)

RunTime
Cold10.2 s
Warm6.9 s

This aligns with the release notes claim of "lazy-load startup and hot-path work."

Agent Turns — THE CRITICAL TEST ❌

RunTotal Wall TimePlugin Load Time
Turn 138.7 s2.1 s
Turn 229.0 s1.5 s
Turn 337.9 s1.6 s

Plugin loading breakdown per turn:

Turn 1: loaded 92 plugin(s) (66 attempted) in 1389.4ms
Turn 2: loaded 92 plugin(s) (66 attempted) in  993.8ms
Turn 3: loaded 92 plugin(s) (66 attempted) in 1092.2ms

Every single agent turn still reloads all 92 provider plugins from scratch. Zero caching between turns.


The Problem: Incremental Optimization, Not Root-Cause Fix

The progression of "fixes" for #75290 shows a pattern of shaving seconds off different subsystems without ever addressing the architectural flaw:

Release"Fix"What It Actually DidDid It Stop Per-Turn Factory Calls?
4.25Cold persisted registryStopped re-scanning manifests from disk❌ No
4.29Lazy discovery modeAdded toolDiscovery: true❌ No — normal runs still pay
5.2Media factory gatingSkip constructing image/video/music/pdf if unavailable⚠️ Partial — one user went 11s→1s
5.2Plugin descriptor cacheCache prompt descriptors with context keys⚠️ Partial — skips descriptor recompute
5.3-beta.4Lazy-load startupDelay boot loading until first use❌ No — per-turn cost untouched

The root cause remains: resolvePluginTools calls entry.factory(params.context) for every plugin tool on every single embedded run. The factories are invoked every turn, regardless of whether the registry is cached or descriptors are memoized.


Why This Is A Bug, Not Feature Creep

Several comments in #75290 suggested splitting into "narrower trackers" for each factory type. This is incorrect framing. The issue is not:

  • "image-generate-tool is slow"
  • "pdf-tool is slow"
  • "web-search-tool is slow"

The issue is: why are any factories running at all on a warm turn?

A proper fix would be:

  1. One-time construction of the full tool registry at gateway startup
  2. Per-turn: only filter the already-built tool list based on toolsAllow
  3. Factory calls: happen zero times on normal embedded runs

The current architecture invokes factories every turn, then optimizes each factory category to be faster. This is treating symptoms.


Data from Other Users (Still Affected)

  • @sergeyksv on origin/main (post-5.2): 5.7s per turn, pdf-tool = 3.7s
  • @jackiedepp on Linode (7 plugins): 15–21s
  • @Squirbie on macOS: 19s + cascading timeouts causing gateway restarts
  • @crash2kx on VPS: 19.4s core-plugin-tools
  • @sashadragon on Telegram/4.29: 7.1s core-plugin-tools

Suggested Resolution

  1. Reopen #75290 as the canonical tracker for per-turn plugin factory cost
  2. Do not split into narrower per-tool issues — the architectural fix is one change
  3. Implement memoization: Cache factory results per (pluginId, configHash) and only invalidate when plugins.allow / config changes
  4. Add regression test: Any agent turn on a warm gateway should show core-plugin-tools < 100ms

Cross-reference: #75290, #73428, #74240, #75956, #75974, #73039

extent analysis

TL;DR

Implement memoization to cache factory results per plugin and configuration to eliminate per-turn plugin factory cost.

Guidance

  • Identify the root cause of the issue, which is the repeated invocation of factories on every turn, and address it through architectural changes.
  • Implement a caching mechanism to store factory results per (pluginId, configHash) and invalidate the cache only when plugins.allow or configuration changes.
  • Add a regression test to ensure that any agent turn on a warm gateway shows core-plugin-tools < 100ms.
  • Reopen the canonical tracker issue (#75290) to focus on the architectural fix rather than splitting into narrower per-tool issues.

Example

# Pseudocode example of memoization
factory_results_cache = {}

def get_factory_result(plugin_id, config_hash):
    if (plugin_id, config_hash) in factory_results_cache:
        return factory_results_cache[(plugin_id, config_hash)]
    else:
        result = entry.factory(params.context)
        factory_results_cache[(plugin_id, config_hash)] = result
        return result

Notes

The provided solution focuses on addressing the root cause of the issue, which is the repeated invocation of factories on every turn. Implementing memoization and adding a regression test should help eliminate the per-turn plugin factory cost.

Recommendation

Apply the suggested resolution by implementing memoization and reopening the canonical tracker issue (#75290) to focus on the architectural fix. This approach addresses the root cause of the issue and provides a comprehensive solution.

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 per-turn cost: #75290 is still valid (5.3-beta.4) [5 comments, 4 participants]