openclaw - 💡(How to fix) Fix Default DEFAULT_PLUGIN_DISCOVERY_CACHE_MS / DEFAULT_PLUGIN_MANIFEST_CACHE_MS of 1 second is too short for gateway use [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#73728Fetched 2026-04-29 06:15:52
View on GitHub
Comments
2
Participants
3
Timeline
5
Reactions
0
Author
Timeline (top)
cross-referenced ×3commented ×2

Both \DEFAULT_PLUGIN_DISCOVERY_CACHE_MS\ and \DEFAULT_PLUGIN_MANIFEST_CACHE_MS\ default to \1e3\ (1 second). This makes the \capabilityProviderPluginIdCache\ and related snapshot caches effectively useless for any conversation-paced workload — a second message arriving >1s after the first always misses.

Root Cause

Both \DEFAULT_PLUGIN_DISCOVERY_CACHE_MS\ and \DEFAULT_PLUGIN_MANIFEST_CACHE_MS\ default to \1e3\ (1 second). This makes the \capabilityProviderPluginIdCache\ and related snapshot caches effectively useless for any conversation-paced workload — a second message arriving >1s after the first always misses.

Fix Action

Workaround

Set both env vars to \300000\ in the gateway startup script.

RAW_BUFFERClick to expand / collapse

Environment

  • openclaw \2026.4.26\
  • File: \src/plugins/cache-controls.ts\

Summary

Both \DEFAULT_PLUGIN_DISCOVERY_CACHE_MS\ and \DEFAULT_PLUGIN_MANIFEST_CACHE_MS\ default to \1e3\ (1 second). This makes the \capabilityProviderPluginIdCache\ and related snapshot caches effectively useless for any conversation-paced workload — a second message arriving >1s after the first always misses.

Current Code

\\ s const DEFAULT_PLUGIN_DISCOVERY_CACHE_MS = 1e3; const DEFAULT_PLUGIN_MANIFEST_CACHE_MS = 1e3;

function resolvePluginSnapshotCacheTtlMs(env) { const discoveryCacheMs = resolvePluginCacheMs(env.OPENCLAW_PLUGIN_DISCOVERY_CACHE_MS, DEFAULT_PLUGIN_DISCOVERY_CACHE_MS); const manifestCacheMs = resolvePluginCacheMs(env.OPENCLAW_PLUGIN_MANIFEST_CACHE_MS, DEFAULT_PLUGIN_MANIFEST_CACHE_MS); return Math.min(discoveryCacheMs, manifestCacheMs); } \\

Suggested Fix

Either: (a) Raise defaults to something like \60_000\ (1 min) or \300_000\ (5 min) for gateway mode, keeping \1e3\ only for one-shot CLI invocations; (b) Auto-detect gateway context (long-running process) and use a longer default there.

Impact

Setting \OPENCLAW_PLUGIN_DISCOVERY_CACHE_MS=300000\ and \OPENCLAW_PLUGIN_MANIFEST_CACHE_MS=300000\ in the gateway launcher already provides the performance benefit — so the current defaults are the only blocker.

Workaround

Set both env vars to \300000\ in the gateway startup script.

extent analysis

TL;DR

Increase the default cache timeout values to a higher value, such as 1 minute or 5 minutes, to improve performance in conversation-paced workloads.

Guidance

  • Consider raising the DEFAULT_PLUGIN_DISCOVERY_CACHE_MS and DEFAULT_PLUGIN_MANIFEST_CACHE_MS values to 60,000 (1 minute) or 300,000 (5 minutes) for gateway mode.
  • Alternatively, explore auto-detecting the gateway context and using a longer default cache timeout in that case.
  • To verify the fix, set OPENCLAW_PLUGIN_DISCOVERY_CACHE_MS and OPENCLAW_PLUGIN_MANIFEST_CACHE_MS environment variables to 300,000 in the gateway startup script and measure the performance improvement.
  • Review the resolvePluginSnapshotCacheTtlMs function to ensure it correctly handles the updated default values.

Example

const DEFAULT_PLUGIN_DISCOVERY_CACHE_MS = 60_000; // 1 minute
const DEFAULT_PLUGIN_MANIFEST_CACHE_MS = 60_000; // 1 minute

Notes

The current default cache timeout of 1 second may not be suitable for conversation-paced workloads, leading to missed cache hits. Increasing the default timeout values can improve performance, but may also increase memory usage.

Recommendation

Apply workaround: Set OPENCLAW_PLUGIN_DISCOVERY_CACHE_MS and OPENCLAW_PLUGIN_MANIFEST_CACHE_MS environment variables to 300,000 in the gateway startup script, as this has already been shown to provide a performance benefit.

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 Default DEFAULT_PLUGIN_DISCOVERY_CACHE_MS / DEFAULT_PLUGIN_MANIFEST_CACHE_MS of 1 second is too short for gateway use [2 comments, 3 participants]