fix: address Copilot review round 5 on #2318

RemoteClientTransport keeps its open-stream bookkeeping whether or not
the consumer logs requests, so onFetchStreamUpdate works on its own and
close() can synthesize the terminal update.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APKSYHGxXBUpnR7ErFiLJn
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-09-13 23:40:03 -04:00
commit a38f1322c1

View file

@ -552,11 +552,11 @@ export class RemoteClientTransport implements Transport {
this.resetSseResponseWait(progressToken);
}
this.onmessage?.(msg, undefined);
} else if (
parsed.type === "fetch_request" &&
this.options.onFetchRequest
) {
} else if (parsed.type === "fetch_request") {
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.
if (
isLongLivedStreamResponse(
entry.method,
@ -565,7 +565,7 @@ export class RemoteClientTransport implements Transport {
) {
this.openStreams.set(entry.id, 0);
}
this.options.onFetchRequest({
this.options.onFetchRequest?.({
...entry,
timestamp:
typeof entry.timestamp === "string"