@@ -1105,18 +1105,25 @@ function SubAgentThinkingContent({
11051105 )
11061106}
11071107
1108+ /**
1109+ * Subagents that should collapse when done streaming.
1110+ * Default behavior is to NOT collapse (stay expanded like edit).
1111+ * Only these specific subagents collapse into "Planned for Xs >" style headers.
1112+ */
1113+ const COLLAPSIBLE_SUBAGENTS = new Set ( [ 'plan' , 'debug' , 'research' , 'info' ] )
1114+
11081115/**
11091116 * SubagentContentRenderer handles the rendering of subagent content.
11101117 * - During streaming: Shows content at top level
1111- * - When done (not streaming): Collapses everything under a header like "Explored for 20s >"
1112- * - Exception: "edit" subagent always stays at top level, never collapses
1118+ * - When done (not streaming): Most subagents stay expanded, only specific ones collapse
1119+ * - Exception: plan, debug, research, info subagents collapse into a header
11131120 */
11141121function SubagentContentRenderer ( {
11151122 toolCall,
1116- isEditSubagent ,
1123+ shouldCollapse ,
11171124} : {
11181125 toolCall : CopilotToolCall
1119- isEditSubagent : boolean
1126+ shouldCollapse : boolean
11201127} ) {
11211128 const [ isExpanded , setIsExpanded ] = useState ( true )
11221129 const [ duration , setDuration ] = useState ( 0 )
@@ -1143,12 +1150,12 @@ function SubagentContentRenderer({
11431150 return ( ) => clearInterval ( interval )
11441151 } , [ isStreaming ] )
11451152
1146- // Auto-collapse when streaming ends (except for edit subagent )
1153+ // Auto-collapse when streaming ends (only for collapsible subagents )
11471154 useEffect ( ( ) => {
1148- if ( ! isStreaming && ! isEditSubagent ) {
1155+ if ( ! isStreaming && shouldCollapse ) {
11491156 setIsExpanded ( false )
11501157 }
1151- } , [ isStreaming , isEditSubagent ] )
1158+ } , [ isStreaming , shouldCollapse ] )
11521159
11531160 // Build segments: each segment is either text content or a tool call
11541161 const segments : Array < { type : 'text' ; content : string } | { type : 'tool' ; block : SubAgentContentBlock } > = [ ]
@@ -1213,7 +1220,7 @@ function SubagentContentRenderer({
12131220 }
12141221 if ( segment . type === 'tool' && segment . block . toolCall ) {
12151222 // For edit subagent's edit_workflow tool: only show the diff summary, skip the tool call header
1216- if ( isEditSubagent && segment . block . toolCall . name === 'edit_workflow' ) {
1223+ if ( toolCall . name === 'edit' && segment . block . toolCall . name === 'edit_workflow' ) {
12171224 return (
12181225 < div key = { `tool-${ segment . block . toolCall . id || index } ` } className = 'mt-2' >
12191226 < WorkflowEditSummary toolCall = { segment . block . toolCall } />
@@ -1231,7 +1238,8 @@ function SubagentContentRenderer({
12311238 </ >
12321239 )
12331240
1234- if ( isEditSubagent || isStreaming ) {
1241+ // During streaming OR for non-collapsible subagents: show content at top level
1242+ if ( isStreaming || ! shouldCollapse ) {
12351243 return (
12361244 < div className = 'w-full' >
12371245 { renderCollapsibleContent ( ) }
@@ -1240,7 +1248,7 @@ function SubagentContentRenderer({
12401248 )
12411249 }
12421250
1243- // Completed non-edit subagent: show collapsible header
1251+ // Completed collapsible subagent (plan, debug, research, info) : show collapsible header
12441252 // Plan artifact stays outside the collapsible
12451253 return (
12461254 < div className = 'w-full' >
@@ -1927,7 +1935,7 @@ export function ToolCall({ toolCall: toolCallProp, toolCallId, onStateChange }:
19271935 return (
19281936 < SubagentContentRenderer
19291937 toolCall = { toolCall }
1930- isEditSubagent = { toolCall . name === 'edit' }
1938+ shouldCollapse = { COLLAPSIBLE_SUBAGENTS . has ( toolCall . name ) }
19311939 />
19321940 )
19331941 }
0 commit comments