@@ -869,7 +869,7 @@ describe("buildThreadFeed", () => {
869869 "message" ,
870870 "message" ,
871871 "run-fold" ,
872- "work-toggle " ,
872+ "activity-group " ,
873873 "message" ,
874874 "message" ,
875875 ] ) ;
@@ -995,7 +995,7 @@ describe("buildThreadFeed", () => {
995995 expect ( expanded . map ( ( entry ) => entry . type ) ) . toEqual ( [
996996 "message" ,
997997 "run-fold" ,
998- "work-toggle " ,
998+ "activity-group " ,
999999 "message" ,
10001000 ] ) ;
10011001 } ) ;
@@ -1018,11 +1018,8 @@ describe("buildThreadFeed", () => {
10181018 ) ;
10191019
10201020 expect ( presented . some ( ( entry ) => entry . type === "run-fold" ) ) . toBe ( false ) ;
1021- expect ( presented . find ( ( entry ) => entry . type === "work-toggle" ) ) . toMatchObject ( {
1022- summary : "vp check" ,
1023- hiddenCount : 1 ,
1024- hasFailure : true ,
1025- live : false ,
1021+ expect ( presented . find ( ( entry ) => entry . type === "activity-group" ) ) . toMatchObject ( {
1022+ activities : [ { status : "failure" , live : false , groupStandIn : { label : "vp check" } } ] ,
10261023 } ) ;
10271024 } ) ;
10281025
@@ -1086,7 +1083,7 @@ describe("buildThreadFeed", () => {
10861083 ) . toEqual ( [
10871084 "user:launch" ,
10881085 "fold:Worked for 8.0s" ,
1089- "work-toggle " ,
1086+ "activity-group " ,
10901087 "assistant:launch-answer" ,
10911088 "user:resume" ,
10921089 "fold:Worked for 8.0s" ,
@@ -1110,7 +1107,7 @@ describe("buildThreadFeed", () => {
11101107 "fold:Worked for 8.0s" ,
11111108 "assistant:launch-answer" ,
11121109 "user:resume" ,
1113- "work-toggle " ,
1110+ "activity-group " ,
11141111 ] ) ;
11151112 } ) ;
11161113
@@ -1193,10 +1190,9 @@ describe("buildThreadFeed", () => {
11931190 startedAt ,
11941191 true ,
11951192 ) ;
1196- expect ( presented . find ( ( entry ) => entry . type === "work-toggle" ) ) . toMatchObject ( {
1197- summary : "Running vp" ,
1198- live : true ,
1199- shimmer : true ,
1193+ expect ( presented . find ( ( entry ) => entry . type === "activity-group" ) ) . toMatchObject ( {
1194+ id : "live-activity-row" ,
1195+ activities : [ { live : true , groupStandIn : { label : "Running vp" } } ] ,
12001196 } ) ;
12011197 expect ( presented . some ( ( entry ) => entry . type === "thinking" ) ) . toBe ( false ) ;
12021198 } ) ;
@@ -1334,6 +1330,112 @@ describe("buildThreadFeed", () => {
13341330 } ) ;
13351331 } ) ;
13361332
1333+ describe ( "a lone call" , ( ) => {
1334+ const wait = ( overrides : Partial < OrchestrationV2TurnItem > = { } ) =>
1335+ ( {
1336+ ...base ( "wait" , "2026-06-20T00:00:02.000Z" , 1 ) ,
1337+ type : "dynamic_tool" ,
1338+ toolName : "t3-code.t3_thread_wait" ,
1339+ input : { threadId : "thread-child" , timeoutMs : 50_000 } ,
1340+ output : { threadId : "thread-child" , status : "timeout" } ,
1341+ ...overrides ,
1342+ } ) as OrchestrationV2TurnItem ;
1343+ const read = ( overrides : Partial < OrchestrationV2TurnItem > = { } ) =>
1344+ ( {
1345+ ...base ( "read" , "2026-06-20T00:00:03.000Z" , 2 ) ,
1346+ type : "dynamic_tool" ,
1347+ toolName : "t3-code.t3_thread_read" ,
1348+ input : { threadId : "thread-child" } ,
1349+ output : { messages : [ ] } ,
1350+ ...overrides ,
1351+ } ) as OrchestrationV2TurnItem ;
1352+ const running = { status : "running" , completedAt : null , output : null } as const ;
1353+ const startedAt = "2026-06-20T00:00:01.000Z" ;
1354+ const liveRows = ( items : ReadonlyArray < OrchestrationV2TurnItem > , groupIds : string [ ] = [ ] ) =>
1355+ deriveThreadFeedPresentation (
1356+ buildThreadFeed ( items . map ( ( item , position ) => projected ( item , position ) ) ) ,
1357+ { runId, status : "running" , startedAt, completedAt : null } ,
1358+ new Set ( ) ,
1359+ new Set ( groupIds ) ,
1360+ startedAt ,
1361+ ) ;
1362+ const standIn = ( rows : ReadonlyArray < ThreadFeedEntry > ) => {
1363+ const row = rows . find ( ( entry ) => entry . type === "activity-group" ) ;
1364+ if ( row ?. type !== "activity-group" ) throw new Error ( "Expected the call's own row" ) ;
1365+ return row . activities [ 0 ] ?. groupStandIn ;
1366+ } ;
1367+
1368+ it ( "is its own row, with no group header to open first" , ( ) => {
1369+ // The second call never finished, so only one call is visible.
1370+ for ( const items of [ [ wait ( ) ] , [ wait ( ) , read ( running ) ] ] ) {
1371+ const feed = buildThreadFeed (
1372+ [ userMessage ( ) , ...items , assistantMessage ( "2026-06-20T00:00:04.000Z" ) ] . map (
1373+ ( item , position ) => projected ( item , position ) ,
1374+ ) ,
1375+ ) ;
1376+ const rows = deriveThreadFeedPresentation ( feed , null , new Set ( [ runId ] ) ) ;
1377+ expect ( rows . map ( ( entry ) => entry . type ) ) . toEqual ( [
1378+ "message" ,
1379+ "run-fold" ,
1380+ "activity-group" ,
1381+ "message" ,
1382+ ] ) ;
1383+ expect ( rows [ 2 ] ) . toMatchObject ( {
1384+ activities : [ { canExpand : true , groupStandIn : { label : "Waited for a T3 thread" } } ] ,
1385+ } ) ;
1386+ expect ( rows [ 2 ] ) . not . toMatchObject ( { activities : [ { groupedToolDetail : true } ] } ) ;
1387+ // The group's own disclosure adds nothing while the call is alone.
1388+ expect (
1389+ deriveThreadFeedPresentation (
1390+ feed ,
1391+ null ,
1392+ new Set ( [ runId ] ) ,
1393+ new Set ( [ standIn ( rows ) ! . groupId ] ) ,
1394+ ) . map ( ( entry ) => entry . id ) ,
1395+ ) . toEqual ( rows . map ( ( entry ) => entry . id ) ) ;
1396+ }
1397+ } ) ;
1398+
1399+ it ( "offers no disclosure when it has nothing to show" , ( ) => {
1400+ const rows = deriveThreadFeedPresentation (
1401+ buildThreadFeed ( [ projected ( wait ( { toolName : "example" , input : { } , output : null } ) , 0 ) ] ) ,
1402+ null ,
1403+ new Set ( [ runId ] ) ,
1404+ ) ;
1405+ expect ( rows . map ( ( entry ) => entry . type ) ) . toEqual ( [ "run-fold" , "activity-group" ] ) ;
1406+ expect ( rows [ 1 ] ) . toMatchObject ( { activities : [ { canExpand : false } ] } ) ;
1407+ } ) ;
1408+
1409+ it ( "holds the live slot until a second call makes it a group" , ( ) => {
1410+ for ( const item of [ wait ( running ) , wait ( ) ] ) {
1411+ const rows = liveRows ( [ item ] ) ;
1412+ expect ( rows . map ( ( entry ) => entry . type ) ) . toEqual ( [ "activity-group" ] ) ;
1413+ expect ( rows [ 0 ] ) . toMatchObject ( {
1414+ id : "live-activity-row" ,
1415+ activities : [ { live : true , groupStandIn : { label : "Waiting for a T3 thread" } } ] ,
1416+ } ) ;
1417+ }
1418+
1419+ const groupId = standIn ( liveRows ( [ wait ( ) ] ) ) ! . groupId ;
1420+ const grouped = liveRows ( [ wait ( ) , read ( running ) ] , [ groupId ] ) ;
1421+ expect ( grouped . map ( ( entry ) => entry . type ) ) . toEqual ( [ "work-toggle" , "activity-group" ] ) ;
1422+ expect ( grouped [ 0 ] ) . toMatchObject ( {
1423+ id : "live-activity-row" ,
1424+ groupId,
1425+ hiddenCount : 2 ,
1426+ expanded : true ,
1427+ summary : "Reading a T3 thread" ,
1428+ } ) ;
1429+ expect ( grouped [ 1 ] ) . toMatchObject ( {
1430+ activities : [
1431+ { groupedToolDetail : true , live : false } ,
1432+ { groupedToolDetail : true , live : true } ,
1433+ ] ,
1434+ } ) ;
1435+ expect ( standIn ( grouped ) ) . toBeUndefined ( ) ;
1436+ } ) ;
1437+ } ) ;
1438+
13371439 it ( "retains Claude Read image previews without tool output" , ( ) => {
13381440 const item = {
13391441 ...base ( "image-read" , "2026-06-20T00:00:04.000Z" , 3 ) ,
@@ -1702,11 +1804,11 @@ describe("retained v2 feed presentation", () => {
17021804 } ) ;
17031805
17041806 it . each ( [
1705- [ "failed" , "Failed to click in the preview browser" , true ] ,
1706- [ "cancelled" , "Stopped clicking in the preview browser" , false ] ,
1807+ [ "failed" , "Failed to click in the preview browser" , "failure" ] ,
1808+ [ "cancelled" , "Stopped clicking in the preview browser" , "neutral" ] ,
17071809 ] as const ) (
17081810 "keeps %s calls terminal while the parent run remains live" ,
1709- ( status , summary , hasFailure ) => {
1811+ ( status , label , activityStatus ) => {
17101812 const feed = buildThreadFeed ( [
17111813 projected (
17121814 {
@@ -1727,7 +1829,11 @@ describe("retained v2 feed presentation", () => {
17271829 new Set ( ) ,
17281830 "2026-06-20T00:00:01.000Z" ,
17291831 ) ;
1730- expect ( rows [ 0 ] ) . toMatchObject ( { type : "work-toggle" , summary, hasFailure, shimmer : false } ) ;
1832+ expect ( rows [ 0 ] ) . toMatchObject ( {
1833+ type : "activity-group" ,
1834+ activities : [ { status : activityStatus , live : false , groupStandIn : { label } } ] ,
1835+ } ) ;
1836+ expect ( rows . at ( - 1 ) ?. type ) . toBe ( "thinking" ) ;
17311837 } ,
17321838 ) ;
17331839
0 commit comments