@@ -261,6 +261,9 @@ function buildEntryTree(entries: ConsoleEntry[]): EntryNode[] {
261261 ...allBlocks . map ( ( b ) => new Date ( b . endedAt || b . timestamp ) . getTime ( ) )
262262 )
263263 const totalDuration = allBlocks . reduce ( ( sum , b ) => sum + ( b . durationMs || 0 ) , 0 )
264+ // Parallel branches run concurrently — use wall-clock time. Loop iterations run serially — use sum.
265+ const subflowDuration =
266+ iterationType === 'parallel' ? subflowEndMs - subflowStartMs : totalDuration
264267
265268 // Create synthetic subflow parent entry
266269 // Use the minimum executionOrder from all child blocks for proper ordering
@@ -276,7 +279,7 @@ function buildEntryTree(entries: ConsoleEntry[]): EntryNode[] {
276279 startedAt : new Date ( subflowStartMs ) . toISOString ( ) ,
277280 executionOrder : subflowExecutionOrder ,
278281 endedAt : new Date ( subflowEndMs ) . toISOString ( ) ,
279- durationMs : totalDuration ,
282+ durationMs : subflowDuration ,
280283 success : ! allBlocks . some ( ( b ) => b . error ) ,
281284 }
282285
@@ -291,6 +294,9 @@ function buildEntryTree(entries: ConsoleEntry[]): EntryNode[] {
291294 ...iterBlocks . map ( ( b ) => new Date ( b . endedAt || b . timestamp ) . getTime ( ) )
292295 )
293296 const iterDuration = iterBlocks . reduce ( ( sum , b ) => sum + ( b . durationMs || 0 ) , 0 )
297+ // Parallel branches run concurrently — use wall-clock time. Loop iterations run serially — use sum.
298+ const iterDisplayDuration =
299+ iterationType === 'parallel' ? iterEndMs - iterStartMs : iterDuration
294300
295301 // Use the minimum executionOrder from blocks in this iteration
296302 const iterExecutionOrder = Math . min ( ...iterBlocks . map ( ( b ) => b . executionOrder ) )
@@ -305,7 +311,7 @@ function buildEntryTree(entries: ConsoleEntry[]): EntryNode[] {
305311 startedAt : new Date ( iterStartMs ) . toISOString ( ) ,
306312 executionOrder : iterExecutionOrder ,
307313 endedAt : new Date ( iterEndMs ) . toISOString ( ) ,
308- durationMs : iterDuration ,
314+ durationMs : iterDisplayDuration ,
309315 success : ! iterBlocks . some ( ( b ) => b . error ) ,
310316 iterationCurrent : iterGroup . iterationCurrent ,
311317 iterationTotal : iterGroup . iterationTotal ,
0 commit comments