@@ -1161,31 +1161,53 @@ export function useWorkflowExecution() {
11611161 cancelRunningEntries ( activeWorkflowId )
11621162 }
11631163
1164- if ( accumulatedBlockLogs . length === 0 ) {
1165- // No blocks executed yet - this is a pre-execution error
1166- // Use 0 for executionOrder so validation errors appear first
1164+ const isPreExecutionError = accumulatedBlockLogs . length === 0
1165+ // Check if any block already has this error - don't duplicate block errors
1166+ const blockAlreadyHasError = accumulatedBlockLogs . some ( ( log ) => log . error )
1167+
1168+ // Only add workflow-level error entry for:
1169+ // 1. Pre-execution errors (validation) - no blocks ran
1170+ // 2. Timeout errors - no block has the error
1171+ if ( isPreExecutionError || ! blockAlreadyHasError ) {
11671172 addConsole ( {
11681173 input : { } ,
11691174 output : { } ,
11701175 success : false ,
11711176 error : data . error ,
11721177 durationMs : data . duration || 0 ,
11731178 startedAt : new Date ( Date . now ( ) - ( data . duration || 0 ) ) . toISOString ( ) ,
1174- executionOrder : 0 ,
1179+ executionOrder : isPreExecutionError ? 0 : Number . MAX_SAFE_INTEGER ,
11751180 endedAt : new Date ( ) . toISOString ( ) ,
11761181 workflowId : activeWorkflowId ,
1177- blockId : 'validation' ,
1182+ blockId : isPreExecutionError ? 'validation' : 'timeout-error ',
11781183 executionId,
1179- blockName : 'Workflow Validation' ,
1180- blockType : 'validation' ,
1184+ blockName : isPreExecutionError ? 'Workflow Validation' : 'Timeout Error ',
1185+ blockType : isPreExecutionError ? 'validation' : 'error ',
11811186 } )
11821187 }
11831188 } ,
11841189
1185- onExecutionCancelled : ( ) => {
1190+ onExecutionCancelled : ( data ) => {
11861191 if ( activeWorkflowId ) {
11871192 cancelRunningEntries ( activeWorkflowId )
11881193 }
1194+
1195+ // Add console entry for cancellation
1196+ addConsole ( {
1197+ input : { } ,
1198+ output : { } ,
1199+ success : false ,
1200+ error : 'Execution was cancelled' ,
1201+ durationMs : data ?. duration || 0 ,
1202+ startedAt : new Date ( Date . now ( ) - ( data ?. duration || 0 ) ) . toISOString ( ) ,
1203+ executionOrder : Number . MAX_SAFE_INTEGER ,
1204+ endedAt : new Date ( ) . toISOString ( ) ,
1205+ workflowId : activeWorkflowId ,
1206+ blockId : 'cancelled' ,
1207+ executionId,
1208+ blockName : 'Execution Cancelled' ,
1209+ blockType : 'cancelled' ,
1210+ } )
11891211 } ,
11901212 } ,
11911213 } )
@@ -1736,21 +1758,27 @@ export function useWorkflowExecution() {
17361758
17371759 cancelRunningEntries ( workflowId )
17381760
1739- addConsole ( {
1740- input : { } ,
1741- output : { } ,
1742- success : false ,
1743- error : data . error ,
1744- durationMs : data . duration || 0 ,
1745- startedAt : new Date ( Date . now ( ) - ( data . duration || 0 ) ) . toISOString ( ) ,
1746- executionOrder : Number . MAX_SAFE_INTEGER ,
1747- endedAt : new Date ( ) . toISOString ( ) ,
1748- workflowId,
1749- blockId : 'workflow-error' ,
1750- executionId,
1751- blockName : 'Workflow Error' ,
1752- blockType : 'error' ,
1753- } )
1761+ // Check if any block already has an error - don't duplicate block errors
1762+ const blockAlreadyHasError = accumulatedBlockLogs . some ( ( log ) => log . error )
1763+
1764+ // Only add timeout error entry if no block has the error
1765+ if ( ! blockAlreadyHasError ) {
1766+ addConsole ( {
1767+ input : { } ,
1768+ output : { } ,
1769+ success : false ,
1770+ error : data . error ,
1771+ durationMs : data . duration || 0 ,
1772+ startedAt : new Date ( Date . now ( ) - ( data . duration || 0 ) ) . toISOString ( ) ,
1773+ executionOrder : Number . MAX_SAFE_INTEGER ,
1774+ endedAt : new Date ( ) . toISOString ( ) ,
1775+ workflowId,
1776+ blockId : 'timeout-error' ,
1777+ executionId,
1778+ blockName : 'Timeout Error' ,
1779+ blockType : 'error' ,
1780+ } )
1781+ }
17541782 } ,
17551783
17561784 onExecutionCancelled : ( ) => {
0 commit comments