fix(mothership): mothership-ran workflows show workflow validation errors#3634
fix(mothership): mothership-ran workflows show workflow validation errors#3634TheodoreSpeaks wants to merge 6 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Refactors execution-level console logging into shared helpers in Unifies SSE parsing by exporting Written by Cursor Bugbot for commit 5751bc2. This will update automatically on new commits. Configure here. |
Greptile SummaryThis PR fixes a bug where workflow validation errors from mothership-triggered runs were silently swallowed and never surfaced to the developer console. The change is isolated to Key changes:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[executeWorkflowWithFullLogging called] --> B[fetch /api/workflows/:id/execute]
B --> C{response.ok?}
C -- No --> D[Parse error JSON]
D --> E[addConsole: blockId='execution-error', blockType='error']
E --> F[throw new Error]
C -- Yes --> G[Read SSE stream]
G --> H{event.type}
H -- execution:started --> I[setCurrentExecutionId]
H -- block:started / completed / error --> J[blockHandlers\n accumulatedBlockLogs updated]
H -- execution:completed --> K[Set executionResult success]
H -- execution:error --> L[cancelRunningEntries]
L --> M{accumulatedBlockLogs\n.length === 0?}
M -- Yes isPreExecutionError --> N[addConsole\nblockId='validation'\nblockType='validation']
M -- No --> O{any log has error?}
O -- No hasBlockError=false --> P{error includes\n'timed out'?}
P -- Yes --> Q[addConsole\nblockId='timeout-error'\nblockType='error']
P -- No --> R[addConsole\nblockId='execution-error'\nblockType='error']
O -- Yes --> S[Skip: block-level\nerror already logged]
Last reviewed commit: 6caa79b |
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils.ts
Outdated
Show resolved
Hide resolved
| error: errorMessage, | ||
| durationMs: event.data.duration || 0, | ||
| startedAt: now, | ||
| executionOrder: isPreExecutionError ? 0 : Number.MAX_SAFE_INTEGER, |
There was a problem hiding this comment.
Number.MAX_SAFE_INTEGER as sentinel executionOrder
Using Number.MAX_SAFE_INTEGER (9,007,199,254,740,991) as the executionOrder for a non-pre-execution error entry is a rough sentinel that could cause unexpected sorting behavior if any downstream consumer adds to, compares, or serialises this value. A named constant or a derivation from the actual accumulated log count would be safer and clearer:
| executionOrder: isPreExecutionError ? 0 : Number.MAX_SAFE_INTEGER, | |
| executionOrder: accumulatedBlockLogs.length, |
This naturally places the error entry after all completed block logs without relying on an extreme sentinel value.
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
Mothership ran workflows didn't show validation failure. Routed the error message so it also adds to console.
Type of Change
Testing
Checklist
Screenshots/Videos