fix(gateway): memoize plugin descriptor config keys#76240
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. The related issue provides a high-confidence report-level reproduction with Windows, Feishu/Lark persistent connection, MiniMax, and Next step before merge Security Review detailsBest possible solution: Land this per-resolution descriptor config-key memo with the added regression coverage once exact-head checks and maintainer review are clean. Do we have a high-confidence way to reproduce the issue? Yes. The related issue provides a high-confidence report-level reproduction with Windows, Feishu/Lark persistent connection, MiniMax, and Is this the best way to solve the issue? Yes. A WeakMap scoped to one What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 10448a0ad14c. |
8edc048 to
ba0123e
Compare
ba0123e to
28bc96c
Compare
* 'main' of https://github.com/openclaw/openclaw: Wizard: bound hatch TUI timeout (#76241) fix(cli): reject codex simple-completion probes fix: memoize plugin descriptor config keys (#76240) fix(heartbeat): make phase scheduling active-hours-aware (#75487) (#75597)
* 'main' of https://github.com/openclaw/openclaw: Wizard: bound hatch TUI timeout (openclaw#76241) fix(cli): reject codex simple-completion probes fix: memoize plugin descriptor config keys (openclaw#76240) fix(heartbeat): make phase scheduling active-hours-aware (openclaw#75487) (openclaw#75597)
* 'main' of https://github.com/openclaw/openclaw: Wizard: bound hatch TUI timeout (openclaw#76241) fix(cli): reject codex simple-completion probes fix: memoize plugin descriptor config keys (openclaw#76240) fix(heartbeat): make phase scheduling active-hours-aware (openclaw#75487) (openclaw#75597)
* 'main' of https://github.com/openclaw/openclaw: Wizard: bound hatch TUI timeout (openclaw#76241) fix(cli): reject codex simple-completion probes fix: memoize plugin descriptor config keys (openclaw#76240) fix(heartbeat): make phase scheduling active-hours-aware (openclaw#75487) (openclaw#75597)
* 'main' of https://github.com/openclaw/openclaw: Wizard: bound hatch TUI timeout (openclaw#76241) fix(cli): reject codex simple-completion probes fix: memoize plugin descriptor config keys (openclaw#76240) fix(heartbeat): make phase scheduling active-hours-aware (openclaw#75487) (openclaw#75597)
Summary
core-plugin-toolsstall pattern reported in [Bug]: After enabling the gateway, it keeps timing out and reconnecting repeatedly #75944.resolvePluginToolsWeakMap memo for descriptor config cache keys and thread it through cached descriptor reads/writes.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
resolveRuntimeConfigCacheKeyrepeatedly for the same cloned config object. Clones returned from the active secrets runtime are semantically equivalent to the active runtime snapshot, but they do not satisfy the object-identity fast path inresolveRuntimeConfigCacheKey, so each descriptor key could re-stringify and hash the whole config.core-plugin-toolsstages and event-loop/cpu saturation on Windows. This patch targets that concrete hot path, not every later stage in the reporter's trace.Regression Test Plan (if applicable)
src/plugins/tool-descriptor-cache.test.tsUser-visible / Behavior Changes
Large gateway configs should spend far less synchronous CPU time during plugin tool descriptor setup, reducing reply-startup event-loop stalls and downstream WebSocket timeouts/reconnects for this path.
Diagram (if applicable)
Security Impact (required)
Yes, explain risk + mitigation: N/ARepro + Verification
Environment
Steps
Expected
Actual
Evidence
Focused tests:
Formatting:
macOS deterministic probe:
{"useMemo":false,"keys":50,"entries":10000,"workMs":4089.8,"timerDelayMs":4090.5} {"useMemo":true,"keys":50,"entries":10000,"workMs":31.4,"timerDelayMs":34.4}Windows 11 Parallels live before/after hot-path proof:
{"node":"v24.15.0","platform":"win32","arch":"arm64"} {"label":"clone/current-main","useMemo":false,"entries":2000,"keys":50,"workMs":3441.6,"timerDelayMs":3442.9,"hashCalls":150} {"label":"clone/patched-memo","useMemo":true,"entries":2000,"keys":50,"workMs":58.5,"timerDelayMs":58.7,"hashCalls":1}Changed gate:
Human Verification (required)
core-plugin-toolscloned-config hashing hot path, not every symptom in the reporter's environment.Review Conversations
Compatibility / Migration
Risks and Mitigations
resolvePluginToolspass, not global descriptor cache state.