Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/sim/app/api/workflows/[id]/execute/route.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -1165,6 +1165,7 @@ async function handleExecutePost(
data: {
error: timeoutErrorMessage,
duration: result.metadata?.duration || 0,
finalBlockLogs: result.logs,
},
})
finalMetaStatus = 'error'
Expand All@@ -1178,6 +1179,7 @@ async function handleExecutePost(
workflowId,
data: {
duration: result.metadata?.duration || 0,
finalBlockLogs: result.logs,
},
})
finalMetaStatus = 'cancelled'
Expand DownExpand Up@@ -1242,6 +1244,7 @@ async function handleExecutePost(
data: {
error: executionResult?.error || errorMessage,
duration: executionResult?.metadata?.duration || 0,
finalBlockLogs: executionResult?.logs,
},
})
finalMetaStatus = 'error'
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -216,25 +216,31 @@ export function useWorkflowExecution() {
durationMs?: number
blockLogs: BlockLog[]
isPreExecutionError?: boolean
finalBlockLogs?: BlockLog[]
}) => {
if (!params.workflowId) return
sharedHandleExecutionErrorConsole(addConsole, cancelRunningEntries, {
...params,
workflowId: params.workflowId,
})
sharedHandleExecutionErrorConsole(
{ addConsole, updateConsole, cancelRunningEntries },
{ ...params, workflowId: params.workflowId }
)
},
[addConsole, cancelRunningEntries]
[addConsole, cancelRunningEntries, updateConsole]
)

const handleExecutionCancelledConsole = useCallback(
(params: { workflowId?: string; executionId?: string; durationMs?: number }) => {
(params: {
workflowId?: string
executionId?: string
durationMs?: number
finalBlockLogs?: BlockLog[]
}) => {
if (!params.workflowId) return
sharedHandleExecutionCancelledConsole(addConsole, cancelRunningEntries, {
...params,
workflowId: params.workflowId,
})
sharedHandleExecutionCancelledConsole(
{ addConsole, updateConsole, cancelRunningEntries },
{ ...params, workflowId: params.workflowId }
)
},
[addConsole, cancelRunningEntries]
[addConsole, cancelRunningEntries, updateConsole]
)

const buildBlockEventHandlers = useCallback(
Expand DownExpand Up@@ -1226,6 +1232,7 @@ export function useWorkflowExecution() {
durationMs: data.duration,
blockLogs: accumulatedBlockLogs,
isPreExecutionError,
finalBlockLogs: data.finalBlockLogs,
})

if (activeWorkflowId && !isExecutingFromChat) {
Expand All@@ -1252,6 +1259,7 @@ export function useWorkflowExecution() {
workflowId: activeWorkflowId,
executionId: executionIdRef.current,
durationMs: data?.duration,
finalBlockLogs: data?.finalBlockLogs,
})

if (activeWorkflowId && !isExecutingFromChat) {
Expand DownExpand Up@@ -1739,6 +1747,7 @@ export function useWorkflowExecution() {
error: data.error,
durationMs: data.duration,
blockLogs: accumulatedBlockLogs,
finalBlockLogs: data.finalBlockLogs,
})

setCurrentExecutionId(workflowId, null)
Expand All@@ -1751,6 +1760,7 @@ export function useWorkflowExecution() {
workflowId,
executionId: executionIdRef.current,
durationMs: data?.duration,
finalBlockLogs: data?.finalBlockLogs,
})

setCurrentExecutionId(workflowId, null)
Expand DownExpand Up@@ -1999,9 +2009,10 @@ export function useWorkflowExecution() {
executionId: capturedExecutionId,
error: data.error,
blockLogs: accumulatedBlockLogs,
finalBlockLogs: data.finalBlockLogs,
})
},
onExecutionCancelled: () => {
onExecutionCancelled: (data) => {
reconnectionComplete = true
activeReconnections.delete(reconnectWorkflowId)
if (!activated) {
Expand All@@ -2018,6 +2029,8 @@ export function useWorkflowExecution() {
handleExecutionCancelledConsole({
workflowId: reconnectWorkflowId,
executionId: capturedExecutionId,
durationMs: data?.duration,
finalBlockLogs: data?.finalBlockLogs,
Comment thread
waleedlatif1 marked this conversation as resolved.
})
},
},
Expand Down
Loading
Loading