@@ -577,7 +577,6 @@ function deriveTurnFolds(input: {
577577 terminalAssistantMessageIds : ReadonlySet < string > ;
578578 latestTurn : TimelineLatestTurn | null ;
579579 unfoldedTurnIds : ReadonlySet < TurnId > ;
580- liveAgentTaskIds : ReadonlySet < string > | undefined ;
581580} ) : ReadonlyMap < string , TurnFold > {
582581 interface TurnGroup {
583582 entries : Array < TimelineEntry > ;
@@ -658,27 +657,13 @@ function deriveTurnFolds(input: {
658657 if ( ! isCompaction && index > terminalEntryIndex && ! isSingleTrailingActivity ) {
659658 continue ;
660659 }
661- // User input stays visible after the surrounding work settles.
662- if ( entry . kind === "work" && entry . entry . questionAnswer !== undefined ) {
660+ // User input and subagent batches stay visible after their turn settles.
661+ if (
662+ entry . kind === "work" &&
663+ ( entry . entry . questionAnswer !== undefined || entry . entry . agentSpawn !== undefined )
664+ ) {
663665 continue ;
664666 }
665- // Workflows outlive their launching turn (dynamic spawns, background
666- // execution), so a spawn row with a live member or coordinator stays
667- // outside the fold instead of hiding a still-running fleet. Settled
668- // spawns fold with the rest of the turn. Without a live set (no agent
669- // panel model, as in the held paint during a thread switch) every
670- // spawn row stays out.
671- if ( entry . kind === "work" && entry . entry . agentSpawn !== undefined ) {
672- const live = input . liveAgentTaskIds ;
673- const { workflowId, agentTaskIds } = entry . entry . agentSpawn ;
674- if (
675- live === undefined ||
676- ( workflowId !== null && live . has ( workflowId ) ) ||
677- agentTaskIds . some ( ( taskId ) => live . has ( taskId ) )
678- ) {
679- continue ;
680- }
681- }
682667 hiddenEntryIds . add ( entry . id ) ;
683668 }
684669 if ( hiddenEntryIds . size === 0 ) {
@@ -870,13 +855,8 @@ export function deriveMessagesTimelineRows(input: {
870855 activeTurnStartedAt : string | null ;
871856 turnDiffSummaries : ReadonlyArray < TurnDiffSummary > ;
872857 supportsConversationRollback : boolean ;
873- /**
874- * Task ids of subagents still working; their spawn row stays outside turn
875- * folds. Undefined means unknown, which keeps every spawn row out.
876- */
858+ /** Task ids of subagents still working, used by the active tool indicator. */
877859 liveAgentTaskIds ?: ReadonlySet < string > | undefined ;
878- /** Spawn rows the user opened stay visible while their turn fold is collapsed. */
879- expandedSpawnEntryIds ?: ReadonlySet < string > | undefined ;
880860} ) : MessagesTimelineRow [ ] {
881861 const turnDiffSummaryByAssistantMessageId = new Map < MessageId , TurnDiffSummary > ( ) ;
882862 for ( const summary of input . turnDiffSummaries ) {
@@ -911,15 +891,11 @@ export function deriveMessagesTimelineRows(input: {
911891 terminalAssistantMessageIds,
912892 latestTurn : input . latestTurn ?? null ,
913893 unfoldedTurnIds : activeVisualResponseTurnIds ,
914- liveAgentTaskIds : input . liveAgentTaskIds ,
915894 } ) ;
916895 const collapsedEntryIds = new Set < string > ( ) ;
917896 for ( const fold of foldsByAnchorEntryId . values ( ) ) {
918897 if ( ! input . expandedTurnIds ?. has ( fold . turnId ) ) {
919898 for ( const entryId of fold . hiddenEntryIds ) {
920- // An opened spawn row keeps its fold membership but is not pulled
921- // away mid-read when its last member settles.
922- if ( input . expandedSpawnEntryIds ?. has ( entryId ) ) continue ;
923899 collapsedEntryIds . add ( entryId ) ;
924900 }
925901 }
0 commit comments