@@ -524,7 +524,8 @@ export class StreamableHTTPClientTransport implements Transport {
524524 // `StartSSEOptions`) must honour the per-request abort exactly as the
525525 // original POST did — both as a fetch signal and as a "do not surface
526526 // onerror" gate.
527- const isIntentionalAbort = ( ) : boolean => this . _abortController ?. signal . aborted === true || requestSignal ?. aborted === true ;
527+ const transportSignal = this . _abortController ?. signal ;
528+ const isIntentionalAbort = ( ) : boolean => transportSignal ?. aborted === true || requestSignal ?. aborted === true ;
528529
529530 try {
530531 // Try to open an initial SSE stream with GET to listen for server messages
@@ -683,9 +684,9 @@ export class StreamableHTTPClientTransport implements Transport {
683684 // Honour BOTH the transport-wide abort and the per-request abort
684685 // (a listen subscription closed during the backoff delay): do not
685686 // resurrect a stream the caller already tore down.
686- if ( this . _abortController ? .signal . aborted || options . requestSignal ?. aborted ) return ;
687+ if ( ! this . _abortController || this . _abortController . signal . aborted || options . requestSignal ?. aborted ) return ;
687688 this . _startOrAuthSse ( options ) . catch ( error => {
688- if ( this . _abortController ? .signal . aborted || options . requestSignal ?. aborted ) return ;
689+ if ( ! this . _abortController || this . _abortController . signal . aborted || options . requestSignal ?. aborted ) return ;
689690 this . onerror ?.( new Error ( `Failed to reconnect SSE stream: ${ error instanceof Error ? error . message : String ( error ) } ` ) ) ;
690691 try {
691692 this . _scheduleReconnection ( options , attemptCount + 1 ) ;
@@ -719,7 +720,8 @@ export class StreamableHTTPClientTransport implements Transport {
719720 // a clean shutdown: no misleading "SSE stream disconnected" onerror,
720721 // and no GET+Last-Event-ID reconnect that would resurrect a stream the
721722 // caller just tore down.
722- const isIntentionalAbort = ( ) : boolean => this . _abortController ?. signal . aborted === true || requestSignal ?. aborted === true ;
723+ const transportSignal = this . _abortController ?. signal ;
724+ const isIntentionalAbort = ( ) : boolean => transportSignal ?. aborted === true || requestSignal ?. aborted === true ;
723725
724726 let lastEventId : string | undefined ;
725727 // Track whether we've received a priming event (event with ID)
@@ -914,6 +916,7 @@ export class StreamableHTTPClientTransport implements Transport {
914916 } finally {
915917 this . _cancelReconnection = undefined ;
916918 this . _abortController ?. abort ( ) ;
919+ this . _abortController = undefined ;
917920 this . onclose ?.( ) ;
918921 }
919922 }
0 commit comments