fix(channels): prevent metadata caches from growing without bound#101650
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 9:40 AM ET / 13:40 UTC. Summary PR surface: Source +13, Tests +59. Total +72 across 4 files. Reproducibility: yes. Source inspection shows current main can grow both module-level metadata Maps with distinct channel or room keys, and the PR's focused tests exercise the over-cap eviction path. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Next step before merge
Security Review detailsBest possible solution: Land the consolidated bounded-cache fix after exact-head CI and maintainer gates, keeping the cap owner-local and using the shared collection-runtime helper. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main can grow both module-level metadata Maps with distinct channel or room keys, and the PR's focused tests exercise the over-cap eviction path. Is this the best way to solve the issue? Yes. The fix stays inside the owning channel plugin modules, reuses the existing public SDK collection helper, and avoids adding config, persistence, or a new plugin API. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b95b9e448794. Label changesLabel justifications:
Evidence reviewedPR surface: Source +13, Tests +59. Total +72 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
e70523c to
6f5879c
Compare
6f5879c to
4c79e1c
Compare
|
Maintainer repair and landing proof are complete for exact head What changed:
Validation:
The first hosted run exposed an unrelated stale native-i18n sentinel already Known gap: no live Discord gateway or Nextcloud Talk server was required for Land-ready. |
|
Merged via squash.
|
…enclaw#101650) * fix(discord): cap channel info cache size * fix(channels): consolidate bounded metadata caches --------- Co-authored-by: Vincent Koc <[email protected]>
The teamGroupIdCache Map had TTL-based expiry but no size cap. A large Teams workspace with many distinct team IDs could accumulate entries faster than the 10-minute TTL window, allowing unbounded growth. Add a 500-entry cap via pruneMapToMaxSize, matching the pattern from openclaw#101650 (Alix-007). This is a safety net — normal TTL expiry handles most eviction; the cap prevents runaway growth under heavy usage.
…enclaw#101650) * fix(discord): cap channel info cache size * fix(channels): consolidate bounded metadata caches --------- Co-authored-by: Vincent Koc <[email protected]>
|
Thanks @vincentkoc, appreciate the repair and landing pass here. Consolidating the sibling cache-cap fragment and moving both paths onto the shared pruning helper makes sense. I’ll prefer that shared helper for similar metadata cache caps going forward. Respect to OpenClaw’s chief architect. |
Related: #101662
What Problem This Solves
Fixes an issue where long-lived Discord and Nextcloud Talk processes could retain
one metadata-cache entry for every unique channel or room they observed, allowing
those process-local Maps to grow without a fixed upper bound.
Why This Change Was Made
Each channel owner now caps its existing metadata cache at 1000 entries through
the shared
pruneMapToMaxSizeplugin SDK helper. Existing TTL, negative-cache,request, error, and SSRF-policy behavior remains unchanged.
The related same-author Nextcloud Talk fragment from #101662 was consolidated
here so the two small fixes land as one focused review unit, as encouraged by
VISION.md.User Impact
Long-running channel processes keep these metadata caches bounded while retaining
the newest entries. An evicted entry is fetched normally when it is needed again.
Evidence
message-utils.test.ts: 49/49 passed.room-info.test.ts: 8/8 passed.oxfmt --checkandgit diff --check: passed.tbx_01kwybm52cwzvxb4qb6w7hsvar:pnpm check:changedpassed on the byte-identical rebased repair tree.