fix(workflow) Fix embedded workflow logs#3587
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview The shared handlers now centralize active-block ref counting, edge run status marking, console entry add/update behavior (including Includes a small test mock cleanup in Written by Cursor Bugbot for commit da83159. This will update automatically on new commits. Configure here. |
Greptile SummaryThis PR fixes a bug where embedded workflow views only showed block logs after block completion. It does so by extracting the block event handler logic from Key changes:
Issues found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant SSE as SSE Stream
participant EWF as executeWorkflowWithFullLogging
participant BEH as createBlockEventHandlers
participant Store as Zustand Stores
SSE->>EWF: execution:started
EWF->>Store: setCurrentExecutionId
EWF->>EWF: executionIdRef.current = event.executionId
SSE->>EWF: block:started
EWF->>BEH: onBlockStarted(data)
BEH->>Store: updateActiveBlockRefCount (active=true)
BEH->>Store: addConsole {isRunning: true} [includeStartConsoleEntry=true]
SSE->>EWF: block:completed (regular block)
EWF->>BEH: onBlockCompleted(data)
BEH->>Store: updateActiveBlockRefCount (active=false)
BEH->>Store: setBlockRunStatus success
BEH->>Store: markOutgoingEdgesFromOutput
BEH->>Store: updateConsole {isRunning: false} [consoleMode=update]
SSE->>EWF: block:completed (container block, non-empty)
EWF->>BEH: onBlockCompleted(data)
BEH->>Store: updateActiveBlockRefCount (active=false)
BEH->>Store: setBlockRunStatus success
Note over BEH,Store: ⚠️ Early return — isRunning entry never updated
SSE->>EWF: block:error
EWF->>BEH: onBlockError(data)
BEH->>Store: setBlockRunStatus error
BEH->>Store: updateConsole {isRunning: false, error} [consoleMode=update]
SSE->>EWF: block:childWorkflowStarted
EWF->>BEH: onBlockChildWorkflowStarted(data)
BEH->>Store: updateConsole {childWorkflowInstanceId}
SSE->>EWF: execution:completed
EWF->>Store: setCurrentExecutionId(null)
Last reviewed commit: 9d6a87b |
|
|
||
| accumulatedBlockLogs.push(createBlockLogEntry(data, { success: true, output: data.output })) | ||
|
|
There was a problem hiding this comment.
Silent error swallowing in callback
The original use-workflow-execution.ts logged errors from onBlockCompleteCallback:
onBlockCompleteCallback(data.blockId, data.output).catch((error) => {
logger.error('Error in onBlockComplete callback:', error)
})The refactored version silently discards them with .catch(() => {}). Since workflow-execution-utils.ts doesn't import a logger, callback errors will be completely invisible in logs, making debugging harder when consumers like the copilot tool's onBlockComplete fail silently.
Consider either importing createLogger here and restoring the log, or surfacing the error through a dedicated error handler in BlockEventHandlerDeps.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Summary
Embedded workflows only show logs on block completion. Extract workflow event handling into shared util function so behavior remains the same between full and embedded workflows.
Type of Change
Testing
Validated that workflow logs are shown as soon as block is executing for both full and embedded workflow views
Checklist
Screenshots/Videos