11import { v4 as uuidv4 } from 'uuid'
2+ import { createLogger } from '@sim/logger'
23import type {
34 BlockCompletedData ,
45 BlockErrorData ,
@@ -12,6 +13,8 @@ import type {
1213 StreamingExecution ,
1314} from '@/executor/types'
1415import { stripCloneSuffixes } from '@/executor/utils/subflow-utils'
16+ const logger = createLogger ( 'workflow-execution-utils' )
17+
1518import { useExecutionStore } from '@/stores/execution'
1619import type { ConsoleEntry , ConsoleUpdate } from '@/stores/terminal'
1720import { useTerminalConsoleStore } from '@/stores/terminal'
@@ -322,7 +325,12 @@ export function createBlockEventHandlers(
322325 if ( isContainerBlockType ( data . blockType ) && ! data . iterationContainerId ) {
323326 const output = data . output as Record < string , any > | undefined
324327 const isEmptySubflow = Array . isArray ( output ?. results ) && output . results . length === 0
325- if ( ! isEmptySubflow ) return
328+ if ( ! isEmptySubflow ) {
329+ if ( includeStartConsoleEntry ) {
330+ updateConsoleEntry ( data )
331+ }
332+ return
333+ }
326334 }
327335
328336 accumulatedBlockLogs . push ( createBlockLogEntry ( data , { success : true , output : data . output } ) )
@@ -334,7 +342,9 @@ export function createBlockEventHandlers(
334342 }
335343
336344 if ( onBlockCompleteCallback ) {
337- onBlockCompleteCallback ( data . blockId , data . output ) . catch ( ( ) => { } )
345+ onBlockCompleteCallback ( data . blockId , data . output ) . catch ( ( error ) => {
346+ logger . error ( 'Error in onBlockComplete callback:' , { blockId : data . blockId , error } )
347+ } )
338348 }
339349 }
340350
0 commit comments