@@ -36,6 +36,7 @@ import {
3636 createMcpAppTeardownRecorder ,
3737 type McpAppFixtureEvent as FixtureEvent ,
3838 openMcpAppProofContext ,
39+ observeMcpAppHttpResponses ,
3940 observeMcpAppNetwork ,
4041 findAppFrame ,
4142 mountControlUiHost ,
@@ -548,6 +549,7 @@ describeConformance("MCP App Control UI and standalone host conformance", () =>
548549 ) ,
549550 ) ;
550551 const diagnostics : Array < Record < string , unknown > > = [ ] ;
552+ const http = observeMcpAppHttpResponses ( gatewayPort ) ;
551553 const cancellationResults : Array < Record < string , unknown > > = [ ] ;
552554 const timingResults : Array < {
553555 scenario : string ;
@@ -716,6 +718,7 @@ describeConformance("MCP App Control UI and standalone host conformance", () =>
716718 await fixture . configure ( { ...spec , releasePath } ) ;
717719 const startedAtMs = Date . now ( ) ;
718720 const networkStart = diagnostics . length ;
721+ const httpStart = http . responses . length ;
719722 const observation : Record < string , unknown > = { scenario : spec . scenario , startedAtMs } ;
720723 cancellationResults . push ( observation ) ;
721724 try {
@@ -728,6 +731,9 @@ describeConformance("MCP App Control UI and standalone host conformance", () =>
728731 ) . length ,
729732 )
730733 . toBe ( 1 ) ;
734+ const startedResponses = http . responses . slice ( httpStart ) ;
735+ expect ( startedResponses ) . toHaveLength ( 1 ) ;
736+ const response = startedResponses [ 0 ] ! ;
731737 if ( spec . action === "abort" ) {
732738 await app . locator ( "#cancel-call" ) . click ( ) ;
733739 }
@@ -782,14 +788,14 @@ describeConformance("MCP App Control UI and standalone host conformance", () =>
782788 expect ( events . filter ( ( event ) => event . event === "tool-complete" ) ) . toMatchObject (
783789 spec . cooperative ? [ ] : [ { requestId : call . id , aborted : true } ] ,
784790 ) ;
785- // Fixture stdio and Playwright network events arrive independently .
786- await expect
787- . poll ( ( ) =>
788- diagnostics
789- . slice ( networkStart )
790- . filter ( ( event ) => event . event === "requestfailed" && event . method === "POST" ) ,
791- )
792- . toHaveLength ( 1 ) ;
791+ // Chromium may omit requestfailed when navigation destroys the old document .
792+ // Observe the exact Gateway response, not an unrelated teardown/control POST.
793+ await expect . poll ( ( ) => response . destroyed ) . toBe ( true ) ;
794+ observation . transport = {
795+ closed : response . destroyed ,
796+ writableFinished : response . writableFinished ,
797+ } ;
798+ expect ( response . writableFinished ) . toBe ( false ) ;
793799 } finally {
794800 if ( releasePath ) {
795801 await fs . writeFile ( releasePath , "released" ) ;
@@ -837,8 +843,12 @@ describeConformance("MCP App Control UI and standalone host conformance", () =>
837843 scenario : spec . scenario + "-control" ,
838844 callDelayMs : 0 ,
839845 } ) ;
846+ const controlHttpStart = http . responses . length ;
840847 await app . locator ( "#call-app" ) . click ( ) ;
841848 await waitForTextContaining ( app . locator ( "#app-tool" ) , "companion-called" ) ;
849+ const controlResponses = http . responses . slice ( controlHttpStart ) ;
850+ expect ( controlResponses ) . toHaveLength ( 1 ) ;
851+ expect ( controlResponses [ 0 ] ?. writableFinished ) . toBe ( true ) ;
842852 const controlEvents = ( await fixture . readEvents ( ) ) . filter (
843853 ( event ) => event . scenario === spec . scenario + "-control" ,
844854 ) ;
@@ -998,6 +1008,7 @@ describeConformance("MCP App Control UI and standalone host conformance", () =>
9981008 "companion-called" ,
9991009 ) ;
10001010 } finally {
1011+ http . stop ( ) ;
10011012 await fs . writeFile (
10021013 path . join ( proofDir , "browser-diagnostics.json" ) ,
10031014 JSON . stringify ( diagnostics , null , 2 ) ,
0 commit comments