From 091db9b6dd432f00737d590a3c31e7715de23f86 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Mon, 14 Sep 2026 00:03:34 -0400 Subject: [PATCH] fix: address Copilot review round 6 on #2318 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RemoteClientTransport tracks open streams only when onFetchStreamUpdate is registered — the bookkeeping serves that callback alone, and without it the set would grow by one entry per reconnect. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01APKSYHGxXBUpnR7ErFiLJn Signed-off-by: cliffhall --- core/mcp/remote/remoteClientTransport.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/mcp/remote/remoteClientTransport.ts b/core/mcp/remote/remoteClientTransport.ts index c8c8c92e..30dff297 100644 --- a/core/mcp/remote/remoteClientTransport.ts +++ b/core/mcp/remote/remoteClientTransport.ts @@ -556,8 +556,11 @@ export class RemoteClientTransport implements Transport { const entry = parsed.data; // Stream bookkeeping runs whether or not the consumer logs // requests: `onFetchStreamUpdate` is documented to work on its - // own, and `close()` needs to know which streams are open. + // own, and `close()` needs to know which streams are open. It + // exists only to serve that callback, though — without one the + // set would only ever grow, one entry per reconnect. if ( + this.options.onFetchStreamUpdate && isLongLivedStreamResponse( entry.method, findHeader(entry.responseHeaders, "content-type"),