-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
mcp/channel-bridge: pendingClaudePermissions / pendingApprovals leak — no TTL, no close-clear, no cap #71646
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Summary
OpenClawChannelBridge(src/mcp/channel-bridge.ts) holds two instance-bound pending Maps that lack the same three guards their siblings already have, so a long-runningopenclaw mcp serveprocess accumulates entries monotonically.queue(Array, L48)QUEUE_LIMIT=1000while-shift (L355)pendingWaiters(Set, L49)close()clears (L148)setTimeoutfallback (L265)pendingClaudePermissions(Map, L50)pendingApprovals(Map, L51)expiresAtMsis stored at L382 but never drives a timer/sweeperWhy it matters
pendingClaudePermissions: Claude SDK sends anotifications/claude/channel/permission_requestfor every tool call (channel-server.ts:42-49). The entry is only removed when the operator replies withyes <id>/no <id>matching/^(yes|no)\s+([a-km-z]{5})$/i(channel-bridge.ts:455-459). Missed/typo'd/cross-channel responses leave the entry forever.requestIdis fresh per request so there is no overwrite.pendingApprovals:trackApproval(L369-) sets the entry onexec.approval.requested/plugin.approval.requestedand only deletes on the matching*.resolvedevent (L389). A gateway WebSocket drop (channel-bridge.ts:122-124onCloseis reject-only) silently loses the resolved frame and the entry persists.close()(L136-152) clearspendingWaitersbut does not clear either pending Map.In a long-running
openclaw mcp serveprocess (operator hours-units,claudeChannelMode != 'off'busy automation), both Maps grow monotonically.Affected paths
src/mcp/channel-bridge.ts:50(pendingClaudePermissionsdecl)src/mcp/channel-bridge.ts:51(pendingApprovalsdecl)src/mcp/channel-bridge.ts:136-152(close()body — pending Map clears missing)src/mcp/channel-bridge.ts:273-295(handleClaudePermissionRequestset without TTL)src/mcp/channel-bridge.ts:369-391(trackApprovalstoresexpiresAtMsbut no expiry mechanism)Severity
P2 — slow memory-growth leak in opt-in long-running CLI path. Not an immediate OOM, but unbounded over time. Maintainer-priority axes hit: memory + reliability + plugin loading (MCP).
Notes
channel-bridge.tscommits all refactor/seam-split (no leak axis); PR fix: bind Claude permission replies to session #56420 (sessionKey binding, OPEN) is orthogonal.