@@ -293,27 +293,30 @@ it.effect("bounds the session handshake, not a tool call that waits longer", ()
293293 Effect . gen ( function * ( ) {
294294 const index = requests ++ ;
295295 yield * Queue . offer ( arrived , index ) ;
296- // The first initialize never answers; the next session's tool call answers late.
297- if ( index === 0 ) return yield * Effect . never ;
298- if ( index === 3 ) yield * Deferred . await ( answer ) ;
296+ // The first initialize, then the next initialized notification, never answer;
297+ // the third session's tool call answers late.
298+ if ( index === 0 || index === 2 ) return yield * Effect . never ;
299+ if ( index === 5 ) yield * Deferred . await ( answer ) ;
299300 return HttpClientResponse . fromWeb (
300301 request ,
301- new Response ( index === 3 ? probeResult : "" , {
302- status : index === 2 ? 202 : 200 ,
303- headers : index === 1 ? { "mcp-session-id" : "session" } : { } ,
302+ new Response ( index === 5 ? probeResult : "" , {
303+ status : index === 4 ? 202 : 200 ,
304+ headers : { "mcp-session-id" : "session" } ,
304305 } ) ,
305306 ) ;
306307 } ) ,
307308 ) ;
308309 const probe = yield * probeThrough ( http ) ;
309310
310- const stalled = yield * probe . pipe ( Effect . flip , Effect . forkScoped ) ;
311- yield * Queue . take ( arrived ) ;
312- yield * TestClock . adjust ( Duration . seconds ( 10 ) ) ;
313- expect ( yield * Fiber . join ( stalled ) ) . toMatchObject ( {
314- code : "orchestration_error" ,
315- message : "The linked environment stopped answering." ,
316- } ) ;
311+ for ( const requestsBeforeStall of [ 1 , 2 ] ) {
312+ const stalled = yield * probe . pipe ( Effect . flip , Effect . forkScoped ) ;
313+ yield * Queue . takeN ( arrived , requestsBeforeStall ) ;
314+ yield * TestClock . adjust ( Duration . seconds ( 10 ) ) ;
315+ expect ( yield * Fiber . join ( stalled ) ) . toMatchObject ( {
316+ code : "orchestration_error" ,
317+ message : "The linked environment stopped answering." ,
318+ } ) ;
319+ }
317320
318321 const waiting = yield * Effect . forkScoped ( probe ) ;
319322 yield * Queue . takeN ( arrived , 3 ) ;
0 commit comments