fix: address Copilot review round 2 on #2318

- fetchTracking: media types and HTTP methods compare case-insensitively;
  a `Request` input's own method is honoured; the SSE line scanner
  accepts LF, CRLF and a bare CR, holding a trailing CR until the next
  chunk decides whether it is half of a CRLF.
- MessageTrackingTransport does not report a send failure for a request
  the caller aborted through `requestSignal`, and InspectorClient keeps a
  request whose send failed with a request timeout — both are sent,
  unanswered requests, which is the state to keep reporting.
- createTransportNode builds a fetch tracker when any tracking callback
  is supplied, not only `onFetchRequest`.
- RemoteClientTransport's relay wait expires with the SDK's own timeout
  shape, so the web client's relay timeout is annotated like every other.

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 22:27:54 -04:00
commit c565b56fcd

View file

@ -29,7 +29,11 @@ export interface MessageTrackingCallbacks {
* closed, the fetch failed before the frame reached the wire). Fires after
* `trackRequest` already recorded it, so a consumer keeping "requests still
* awaiting a response" can roll that entry back — a request that never went
* out is not unanswered (#2318).
* out is not unanswered (#2318). Not fired when the caller aborted the
* request through `requestSignal`: the modern transport aborts an in-flight
* request's own stream to cancel it (and the SDK does the same on a
* per-request timeout), and a request that was sent and then given up on
* is exactly the unanswered kind.
*/
trackSendFailure?: (message: JSONRPCRequest, error: unknown) => void;
}
@ -106,7 +110,9 @@ export class MessageTrackingTransport implements Transport {
const request = message as JSONRPCRequest;
this.callbacks.trackRequest?.(request, "client");
return this.baseTransport.send(message, options).catch((err) => {
this.callbacks.trackSendFailure?.(request, err);
if (!options?.requestSignal?.aborted) {
this.callbacks.trackSendFailure?.(request, err);
}
throw err;
});
}