@@ -459,6 +459,13 @@ function monitorQaGatewayChildFailure(child: ChildProcess, output: { push(chunk:
459459 return ( ) => childFailure ;
460460}
461461
462+ const QA_GATEWAY_PROCESS_BOUNDARY_LOG_TAIL_CHARS = 8_192 ;
463+
464+ function formatQaGatewayProcessBoundaryStartupFailure ( error : unknown , logs : string ) {
465+ const logTail = redactQaGatewayDebugText ( logs ) . slice ( - QA_GATEWAY_PROCESS_BOUNDARY_LOG_TAIL_CHARS ) ;
466+ return `${ formatErrorMessage ( error ) } ${ formatQaGatewayLogsForError ( logTail ) } ` ;
467+ }
468+
462469async function fetchLocalGatewayHealth ( params : {
463470 baseUrl : string ;
464471 healthPath : "/readyz" | "/healthz" ;
@@ -549,6 +556,7 @@ export const testing = {
549556 createQaGatewayChildLogCollector,
550557 monitorQaGatewayChildFailure,
551558 throwQaGatewayChildFailure,
559+ formatQaGatewayProcessBoundaryStartupFailure,
552560 createQaBundledPluginsDir,
553561 signalQaGatewayChildProcessTree,
554562 stopQaGatewayChildProcessTree,
@@ -1098,14 +1106,22 @@ export async function startQaGatewayChild(params: {
10981106 cleanupErrors . push ( cleanupError ) ;
10991107 }
11001108 }
1109+ const boundaryFailure = preparedBoundary
1110+ ? formatQaGatewayProcessBoundaryStartupFailure ( error , logs ( ) )
1111+ : null ;
11011112 if ( cleanupErrors . length > 0 ) {
11021113 const cleanupFailure = new AggregateError (
11031114 [ error , ...cleanupErrors ] ,
1104- "qa gateway failed before verified process cleanup completed" ,
1115+ boundaryFailure
1116+ ? `qa gateway failed before verified process cleanup completed: ${ boundaryFailure } `
1117+ : "qa gateway failed before verified process cleanup completed" ,
11051118 { cause : error } ,
11061119 ) ;
11071120 throw cleanupFailure ;
11081121 }
1122+ if ( boundaryFailure ) {
1123+ throw new Error ( boundaryFailure , { cause : error } ) ;
1124+ }
11091125 throw error ;
11101126 }
11111127 } ;
0 commit comments