fix(plugins): default web-provider runtime cache to true#75992
fix(plugins): default web-provider runtime cache to true#75992DmitryPogodaev wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Restores the fix originally landed in openclaw#61854 (issue openclaw#61756). runtimeSubagentMode does not influence which plugins are loaded or how they are configured — it is metadata stored alongside the active registry state. Including it in the cache key causes redundant register() calls when call sites in the message processing pipeline pass inconsistent allowGatewaySubagentBinding values, resulting in repeated full plugin reloads on every message dispatch. Observed symptom: bundled provider plugin (e.g. "openai") imported 9-10 times per single message dispatch (~120ms each = ~1.2s wasted), even on a fully warm gateway with stable config.
resolveWebProviderLoadOptions and the setup-mode loadOpenClawPlugins call in resolvePluginWebProviders default to cache: false. Every dispatch that resolves bundled web search/fetch providers (e.g. brave, google, ollama, etc.) repeats the full module-import sequence even when the plugin set is unchanged. Symptom on a stable config: the 12-plugin web search batch (brave, duckduckgo, exa, firecrawl, google, minimax, moonshot, ollama, perplexity, searxng, tavily, xai) is re-imported on every message dispatch, ~1.5s per dispatch. Cache key already correctly varies by onlyPluginIds, activate, and other relevant inputs, so flipping the default to true is safe and produces correct cache hits for repeated calls.
|
Codex review: found issues before merge. Summary Reproducibility: yes. The code-level reproduction is to apply the cache-key removal and run the existing runtime-registry compatibility case that expects explicit subagent requests not to reuse a gateway-bindable registry. Next step before merge Security Review findings
Review detailsBest possible solution: Keep Do we have a high-confidence way to reproduce the issue? Yes. The code-level reproduction is to apply the cache-key removal and run the existing runtime-registry compatibility case that expects explicit subagent requests not to reuse a gateway-bindable registry. Is this the best way to solve the issue? No. Defaulting web-provider cache use may be the right narrow fix, but removing the subagent-mode discriminator is not the safest way because current main already has a narrower default-to-gateway-bindable reuse path. Full review comments:
Overall correctness: patch is incorrect Security concerns:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 93e2d90af174. |
|
Thanks for tracking this down. I landed the safe part directly on main in d13a206. What landed:
I did not take the Verification:
|
|
Superseded by d13a206. |
Summary
resolveWebProviderLoadOptionsand the setup-modeloadOpenClawPluginscall insideresolvePluginWebProvidersdefault tocache: false. Every dispatch that resolves bundled web search/fetch providers (brave, google, ollama, etc.) re-imports the same plugin modules even when the requested set has not changed.Repro
[plugins]debug logs:This repeats verbatim on every dispatch, even on a fully warm gateway with stable config.
Fix
Flip the default from
falsetotrue. The cache key already varies byonlyPluginIds,activate, and the other relevant inputs (seebuildCacheKey), so subsequent calls with the same effective inputs correctly hit the cached registry.Affected lines:
Callers that explicitly pass
cache: false(auth-choice catalog warning, etc.) keep their existing override.Test plan
🤖 Patch authored after debugging slow message dispatch on a personal VPS.