-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
Plugin loader LRU cache key includes workspaceDir unnecessarily, causing redundant cold loads across workspaces #77347
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
buildCacheKey()inloader-CLyHx60E.jsincludesworkspaceDiras part of the LRU cache key forPluginLoaderCacheState. However,workspaceDirdoes not affect which plugins are loaded or how they are configured — the plugin trust list,onlyPluginIds,runtimeSubagentMode, andinstallRecordsare all derived from the global openclaw config, not the workspace directory.The result: on a host with multiple agent workspaces (e.g.
main,debug-agent,haiku-utility,bug-fixer), each workspace generates a separate LRU cache entry even when their plugin configurations are identical. Withmainrunning at high frequency, it displaces secondary workspace entries, causing 12–16s synchronous cold loads on every secondary workspace spawn.Root cause
In
resolvePluginLoadCacheContext(), the cache key is built with:The plugin registry construction (
loadOpenClawPlugins) does not vary by workspace — all enabled plugins register identically regardless of which workspace triggered the load. The LRU is the only protection layer; Node module cache and jiti cache do not help across cache-key transitions.Impact
Each cache miss reruns the full
register()pipeline for all enabled plugins: 12–16s synchronous event loop block measured in thecore-plugin-toolsstage of thepreptrace. Top contributors:Proposed fix
Remove
workspaceDirfrombuildCacheKey()inputs, or only include it when a plugin factory actually readsworkspaceDirfrom its activation context. Alternatively, expose a first-class config fieldgateway.plugins.loaderCacheSizeso operators can tune the LRU size.Workaround applied
Patched
loader-CLyHx60E.js:3287to make the LRU size env-configurable and running withOPENCLAW_PLUGIN_LOADER_CACHE_SIZE=512, which prevents eviction on our host. Temporary workaround — root cause is the key granularity.