@@ -512,6 +512,7 @@ export function reconcileFinalBlockLogs(
512512 reconcileChildTraceSpans (
513513 updateConsole ,
514514 workflowId ,
515+ log . blockId ,
515516 childWorkflowInstanceId ,
516517 executionId ,
517518 log . childTraceSpans
@@ -523,20 +524,21 @@ export function reconcileFinalBlockLogs(
523524function reconcileChildTraceSpans (
524525 updateConsole : UpdateConsoleFn ,
525526 workflowId : string ,
527+ childWorkflowBlockId : string ,
526528 childWorkflowInstanceId : string ,
527529 executionId : string ,
528530 spans : TraceSpan [ ]
529531) : void {
530532 for ( const span of spans ) {
531533 const matchingEntry = span . blockId
532- ? findConsoleEntryForSpan ( workflowId , executionId , childWorkflowInstanceId , span )
534+ ? findConsoleEntryForSpan ( workflowId , executionId , childWorkflowBlockId , span )
533535 : undefined
534536 if ( span . blockId ) {
535537 const errorMessage = normalizeSpanError ( span . output ?. error )
536538 updateConsole (
537539 span . blockId ,
538540 {
539- ...spanConsoleIdentity ( span , childWorkflowInstanceId ) ,
541+ ...spanConsoleIdentity ( span , childWorkflowBlockId ) ,
540542 replaceOutput : ( span . output ?? { } ) as Record < string , unknown > ,
541543 success : span . status !== 'error' ,
542544 ...( errorMessage !== undefined ? { error : errorMessage } : { } ) ,
@@ -553,6 +555,7 @@ function reconcileChildTraceSpans(
553555 reconcileChildTraceSpans (
554556 updateConsole ,
555557 workflowId ,
558+ matchingEntry ?. blockId ?? childWorkflowBlockId ,
556559 matchingEntry ?. childWorkflowInstanceId ?? childWorkflowInstanceId ,
557560 executionId ,
558561 span . children
@@ -561,7 +564,7 @@ function reconcileChildTraceSpans(
561564 }
562565}
563566
564- function spanConsoleIdentity ( span : TraceSpan , childWorkflowInstanceId : string ) : ConsoleUpdate {
567+ function spanConsoleIdentity ( span : TraceSpan , childWorkflowBlockId : string ) : ConsoleUpdate {
565568 const iterationContainerId = span . loopId ?? span . parallelId
566569 const iterationType = span . loopId ? 'loop' : span . parallelId ? 'parallel' : undefined
567570 return {
@@ -570,18 +573,18 @@ function spanConsoleIdentity(span: TraceSpan, childWorkflowInstanceId: string):
570573 ...( iterationType !== undefined && { iterationType } ) ,
571574 ...( iterationContainerId !== undefined && { iterationContainerId } ) ,
572575 ...( span . parentIterations !== undefined && { parentIterations : span . parentIterations } ) ,
573- childWorkflowBlockId : childWorkflowInstanceId ,
576+ childWorkflowBlockId,
574577 }
575578}
576579
577580function findConsoleEntryForSpan (
578581 workflowId : string ,
579582 executionId : string ,
580- childWorkflowInstanceId : string ,
583+ childWorkflowBlockId : string ,
581584 span : TraceSpan
582585) : ConsoleEntry | undefined {
583586 if ( ! span . blockId ) return undefined
584- const identity = spanConsoleIdentity ( span , childWorkflowInstanceId )
587+ const identity = spanConsoleIdentity ( span , childWorkflowBlockId )
585588 return useTerminalConsoleStore
586589 . getState ( )
587590 . getWorkflowEntries ( workflowId )
@@ -615,6 +618,13 @@ function matchesConsoleIdentity(entry: ConsoleEntry, identity: ConsoleUpdate): b
615618 ) {
616619 return false
617620 }
621+ if (
622+ identity . childWorkflowInstanceId !== undefined &&
623+ entry . childWorkflowInstanceId !== undefined &&
624+ entry . childWorkflowInstanceId !== identity . childWorkflowInstanceId
625+ ) {
626+ return false
627+ }
618628 return true
619629}
620630
0 commit comments