@@ -1376,39 +1376,89 @@ describe("deriveMessagesTimelineRows", () => {
13761376 } ) ;
13771377
13781378 it . each ( [
1379- [ "mixed" , [ "failed" , "completed" ] , false ] ,
1379+ [ "recovered" , [ "failed" , "completed" ] , false ] ,
1380+ [ "ending in failure" , [ "completed" , "failed" ] , true ] ,
13801381 [ "failed" , [ "failed" , "failed" ] , true ] ,
1381- ] as const ) (
1382- "marks %s tool groups failed only when every call fails" ,
1383- ( _ , statuses , hasFailure ) => {
1384- const timelineEntries = statuses . map ( ( status , index ) => ( {
1385- id : `work-entry-${ index } ` ,
1386- kind : "work" as const ,
1382+ ] as const ) ( "uses the final call for %s tool groups" , ( _ , statuses , hasFailure ) => {
1383+ const timelineEntries = statuses . map ( ( status , index ) => ( {
1384+ id : `work-entry-${ index } ` ,
1385+ kind : "work" as const ,
1386+ createdAt : `2026-01-01T00:00:0${ index } Z` ,
1387+ entry : {
1388+ id : `work-${ index } ` ,
13871389 createdAt : `2026-01-01T00:00:0${ index } Z` ,
1388- entry : {
1389- id : `work-${ index } ` ,
1390- createdAt : `2026-01-01T00:00:0${ index } Z` ,
1391- label : "Ran command" ,
1392- tone : "tool" as const ,
1393- itemType : "command_execution" as const ,
1394- toolLifecycleStatus : status ,
1395- } ,
1396- } ) ) ;
1390+ label : "Ran command" ,
1391+ tone : "tool" as const ,
1392+ itemType : "command_execution" as const ,
1393+ toolLifecycleStatus : status ,
1394+ } ,
1395+ } ) ) ;
13971396
1398- const rows = deriveMessagesTimelineRows ( {
1399- timelineEntries,
1400- isWorking : false ,
1401- activeTurnStartedAt : null ,
1402- turnDiffSummaryByAssistantMessageId : new Map ( ) ,
1403- revertTurnCountByUserMessageId : new Map ( ) ,
1404- } ) ;
1397+ const rows = deriveMessagesTimelineRows ( {
1398+ timelineEntries,
1399+ isWorking : false ,
1400+ activeTurnStartedAt : null ,
1401+ turnDiffSummaryByAssistantMessageId : new Map ( ) ,
1402+ revertTurnCountByUserMessageId : new Map ( ) ,
1403+ } ) ;
14051404
1406- expect ( rows . find ( ( row ) => row . kind === "work-toggle" ) ) . toMatchObject ( {
1407- hiddenCount : 2 ,
1408- hasFailure,
1409- } ) ;
1410- } ,
1411- ) ;
1405+ expect ( rows . find ( ( row ) => row . kind === "work-toggle" ) ) . toMatchObject ( {
1406+ hiddenCount : 2 ,
1407+ hasFailure,
1408+ } ) ;
1409+ } ) ;
1410+
1411+ it ( "keeps a failure visible when other hidden entries succeeded" , ( ) => {
1412+ const rows = deriveMessagesTimelineRows ( {
1413+ timelineEntries : [
1414+ {
1415+ id : "failed-work-entry" ,
1416+ kind : "work" ,
1417+ createdAt : "2026-01-01T00:00:01Z" ,
1418+ entry : {
1419+ id : "failed-work" ,
1420+ createdAt : "2026-01-01T00:00:01Z" ,
1421+ label : "Ran command" ,
1422+ tone : "tool" ,
1423+ toolLifecycleStatus : "failed" ,
1424+ } ,
1425+ } ,
1426+ {
1427+ id : "completed-work-entry" ,
1428+ kind : "work" ,
1429+ createdAt : "2026-01-01T00:00:02Z" ,
1430+ entry : {
1431+ id : "completed-work" ,
1432+ createdAt : "2026-01-01T00:00:02Z" ,
1433+ label : "Ran command" ,
1434+ tone : "tool" ,
1435+ toolLifecycleStatus : "completed" ,
1436+ } ,
1437+ } ,
1438+ {
1439+ id : "visible-info-entry" ,
1440+ kind : "work" ,
1441+ createdAt : "2026-01-01T00:00:03Z" ,
1442+ entry : {
1443+ id : "visible-info" ,
1444+ createdAt : "2026-01-01T00:00:03Z" ,
1445+ label : "Status updated" ,
1446+ tone : "info" ,
1447+ } ,
1448+ } ,
1449+ ] ,
1450+ isWorking : false ,
1451+ activeTurnStartedAt : null ,
1452+ turnDiffSummaryByAssistantMessageId : new Map ( ) ,
1453+ revertTurnCountByUserMessageId : new Map ( ) ,
1454+ } ) ;
1455+
1456+ expect ( rows . find ( ( row ) => row . kind === "work-toggle" ) ) . toMatchObject ( {
1457+ hiddenCount : 2 ,
1458+ summary : null ,
1459+ hasFailure : true ,
1460+ } ) ;
1461+ } ) ;
14121462} ) ;
14131463
14141464describe ( "computeStableMessagesTimelineRows" , ( ) => {
0 commit comments