fix(thread-ownership): cap mention cache and bound forwarder JSON reads#101743
fix(thread-ownership): cap mention cache and bound forwarder JSON reads#101743hugenshen wants to merge 1 commit into
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the newer open Thread Ownership follow-up covers the same cache and bounded-conflict-read work, preserves 409 cancellation when the optional body is unreadable, and has stronger runtime proof, while this branch still has the fail-open 409 regression. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Use #101968 as the canonical Thread Ownership hardening path unless maintainers explicitly prefer to repair this branch instead. So I’m closing this here and keeping the remaining discussion on #101968. Review detailsBest possible solution: Use #101968 as the canonical Thread Ownership hardening path unless maintainers explicitly prefer to repair this branch instead. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main has an uncapped mention map and native Is this the best way to solve the issue? No as submitted: the cache cap uses the right shared helper, but the 409 branch must preserve cancellation when optional owner-body parsing fails. The newer follow-up PR demonstrates the safer shape by catching parse/overflow inside the 409 branch and logging Security review: Security review cleared: The diff adds no dependencies, workflow changes, secret handling, artifact downloads, or supply-chain surface; the blocker is functional message-delivery behavior. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against bf310355387d. |
af45e07 to
f6b138c
Compare
|
@clawsweeper re-review — branch rebased to single commit on latest main, proof scripts removed from repo, PR body updated with Real behavior proof (Vitest regression output). |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Co-authored-by: Cursor <[email protected]>
f6b138c to
0cb28b4
Compare
|
Squashed to a single commit and rebased on latest Test run @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
What Problem This Solves
Fixes two thread-ownership resource bounds in the Slack multi-agent plugin:
mentionedThreads— in-memory mention cache with no size cap under sustained @-mention traffic.resp.json()instead of the shared bounded provider JSON reader.Why This Change Was Made
Routes mention tracking through
pruneMapToMaxSize(cap 1 000 entries) and replaces the 409 handler'sresp.json()call withreadProviderJsonResponsefromopenclaw/plugin-sdk/provider-http.User Impact
Long-lived gateways with high Slack @-mention volume get bounded mention-cache memory. Oversized ownership-conflict JSON bodies fail closed instead of buffering unbounded data.
Evidence
extensions/thread-ownership/index.ts:25–27,59–63—mentionedThreadsMap,MENTIONED_THREADS_MAX_ENTRIES = 1000, prune after each trackextensions/thread-ownership/index.ts:203—readProviderJsonResponseon ownership-conflict responsessrc/infra/map-size.ts— sharedpruneMapToMaxSizehelperindex.ts; regressions inindex.test.tsBehavior proof
1) Node runtime (production cap +
pruneMapToMaxSize, no Vitest)Replays the same key shapes and cap wired in
index.ts:2) Call-site regression tests
After 1 001 tracked mentions the oldest
{channel}:{thread}key is evicted; ownership claim / 409 conflict tests still pass with bounded JSON parsing on the production path.Proof gap: No redacted live Slack forwarder or production gateway logs in this validation environment.