@@ -517,6 +517,36 @@ describe("readSubagentOutput", () => {
517517} ) ;
518518
519519describe ( "buildChildCompletionFindings" , ( ) => {
520+ it . each ( [
521+ {
522+ name : "timeout with its preserved failure cause" ,
523+ outcome : { status : "timeout" , error : " provider rejected the request " } ,
524+ expected : "timeout: provider rejected the request" ,
525+ } ,
526+ {
527+ name : "timeout without a failure cause" ,
528+ outcome : { status : "timeout" } ,
529+ expected : "timeout" ,
530+ } ,
531+ {
532+ name : "ordinary failure with its cause" ,
533+ outcome : { status : "error" , error : " provider rejected the request " } ,
534+ expected : "error: provider rejected the request" ,
535+ } ,
536+ ] as const ) ( "describes a $name in parent-visible findings" , ( { outcome, expected } ) => {
537+ const findings = buildChildCompletionFindings ( [
538+ {
539+ childSessionKey : "agent:main:subagent:child" ,
540+ task : "child task" ,
541+ createdAt : 1 ,
542+ completion : { resultText : "captured findings" } ,
543+ execution : { outcome } ,
544+ } ,
545+ ] ) ;
546+
547+ expect ( findings ) . toContain ( `status: ${ expected } ` ) ;
548+ } ) ;
549+
520550 it ( "hard-bounds each child result and the aggregate parent prompt" , ( ) => {
521551 const findings = buildChildCompletionFindings (
522552 Array . from ( { length : 8 } , ( _ , index ) => ( {
@@ -711,21 +741,27 @@ describe("buildChildCompletionFindings", () => {
711741 expect ( findings ) . toContain ( "(no output)" ) ;
712742 } ) ;
713743
714- it ( "uses captured fallback output when a resumed completion returns NO_REPLY" , ( ) => {
744+ it . each ( [
745+ { name : "successful NO_REPLY" , status : "ok" , resultText : "NO_REPLY" } ,
746+ { name : "blank failed" , status : "error" , resultText : "" } ,
747+ { name : "whitespace timed-out" , status : "timeout" , resultText : " \n\t " } ,
748+ { name : "blank unknown" , status : "unknown" , resultText : "" } ,
749+ ] as const ) ( "uses captured fallback output for a $name completion" , ( { status, resultText } ) => {
715750 const findings = buildChildCompletionFindings ( [
716751 {
717752 childSessionKey : "agent:main:subagent:child" ,
718753 task : "child task" ,
719754 createdAt : 1 ,
720755 completion : {
721- resultText : "NO_REPLY" ,
756+ resultText,
722757 fallbackResultText : "findings captured before the wake" ,
723758 } ,
724- execution : { outcome : { status : "ok" } } ,
759+ execution : { outcome : { status } } ,
725760 } ,
726761 ] ) ;
727762
728763 expect ( findings ) . toContain ( "findings captured before the wake" ) ;
764+ expect ( findings ) . not . toContain ( "(no output)" ) ;
729765 expect ( findings ) . not . toContain ( "NO_REPLY" ) ;
730766 } ) ;
731767
0 commit comments