Skip to content

Commit b5ca145

Browse files
committed
Revert "fix(parallel): error-sticky block run status to prevent branch success masking failure"
This reverts commit 9c087cd.
1 parent 9c087cd commit b5ca145

File tree

2 files changed

+5
-52
lines changed

2 files changed

+5
-52
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ import {
2020
TriggerUtils,
2121
} from '@/lib/workflows/triggers/triggers'
2222
import { useCurrentWorkflow } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-current-workflow'
23-
import {
24-
resolveBlockRunStatus,
25-
updateActiveBlockRefCount,
26-
} from '@/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils'
23+
import { updateActiveBlockRefCount } from '@/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils'
2724
import { getBlock } from '@/blocks'
2825
import type { SerializableExecutionState } from '@/executor/execution/types'
2926
import type {
@@ -68,8 +65,6 @@ interface BlockEventHandlerConfig {
6865
workflowEdges: Array<{ id: string; target: string; sourceHandle?: string | null }>
6966
activeBlocksSet: Set<string>
7067
activeBlockRefCounts: Map<string, number>
71-
/** Tracks blocks that have errored in any parallel branch — prevents later success from masking errors. */
72-
blockRunErrors: Set<string>
7368
accumulatedBlockLogs: BlockLog[]
7469
accumulatedBlockStates: Map<string, BlockState>
7570
executedBlockIds: Set<string>
@@ -317,7 +312,6 @@ export function useWorkflowExecution() {
317312
workflowEdges,
318313
activeBlocksSet,
319314
activeBlockRefCounts,
320-
blockRunErrors,
321315
accumulatedBlockLogs,
322316
accumulatedBlockStates,
323317
executedBlockIds,
@@ -490,12 +484,7 @@ export function useWorkflowExecution() {
490484
const onBlockCompleted = (data: BlockCompletedData) => {
491485
if (isStaleExecution()) return
492486
updateActiveBlocks(data.blockId, false)
493-
if (workflowId)
494-
setBlockRunStatus(
495-
workflowId,
496-
data.blockId,
497-
resolveBlockRunStatus(blockRunErrors, data.blockId, 'success')
498-
)
487+
if (workflowId) setBlockRunStatus(workflowId, data.blockId, 'success')
499488

500489
executedBlockIds.add(data.blockId)
501490
accumulatedBlockStates.set(data.blockId, {
@@ -526,12 +515,7 @@ export function useWorkflowExecution() {
526515
const onBlockError = (data: BlockErrorData) => {
527516
if (isStaleExecution()) return
528517
updateActiveBlocks(data.blockId, false)
529-
if (workflowId)
530-
setBlockRunStatus(
531-
workflowId,
532-
data.blockId,
533-
resolveBlockRunStatus(blockRunErrors, data.blockId, 'error')
534-
)
518+
if (workflowId) setBlockRunStatus(workflowId, data.blockId, 'error')
535519

536520
executedBlockIds.add(data.blockId)
537521
accumulatedBlockStates.set(data.blockId, {
@@ -1296,7 +1280,6 @@ export function useWorkflowExecution() {
12961280

12971281
const activeBlocksSet = new Set<string>()
12981282
const activeBlockRefCounts = new Map<string, number>()
1299-
const blockRunErrors = new Set<string>()
13001283
const streamedContent = new Map<string, string>()
13011284
const accumulatedBlockLogs: BlockLog[] = []
13021285
const accumulatedBlockStates = new Map<string, BlockState>()
@@ -1310,7 +1293,6 @@ export function useWorkflowExecution() {
13101293
workflowEdges,
13111294
activeBlocksSet,
13121295
activeBlockRefCounts,
1313-
blockRunErrors,
13141296
accumulatedBlockLogs,
13151297
accumulatedBlockStates,
13161298
executedBlockIds,
@@ -1922,7 +1904,6 @@ export function useWorkflowExecution() {
19221904
const executedBlockIds = new Set<string>()
19231905
const activeBlocksSet = new Set<string>()
19241906
const activeBlockRefCounts = new Map<string, number>()
1925-
const blockRunErrors = new Set<string>()
19261907

19271908
try {
19281909
const blockHandlers = buildBlockEventHandlers({
@@ -1931,7 +1912,6 @@ export function useWorkflowExecution() {
19311912
workflowEdges,
19321913
activeBlocksSet,
19331914
activeBlockRefCounts,
1934-
blockRunErrors,
19351915
accumulatedBlockLogs,
19361916
accumulatedBlockStates,
19371917
executedBlockIds,
@@ -2128,7 +2108,6 @@ export function useWorkflowExecution() {
21282108
const workflowEdges = useWorkflowStore.getState().edges
21292109
const activeBlocksSet = new Set<string>()
21302110
const activeBlockRefCounts = new Map<string, number>()
2131-
const blockRunErrors = new Set<string>()
21322111
const accumulatedBlockLogs: BlockLog[] = []
21332112
const accumulatedBlockStates = new Map<string, BlockState>()
21342113
const executedBlockIds = new Set<string>()
@@ -2141,7 +2120,6 @@ export function useWorkflowExecution() {
21412120
workflowEdges,
21422121
activeBlocksSet,
21432122
activeBlockRefCounts,
2144-
blockRunErrors,
21452123
accumulatedBlockLogs,
21462124
accumulatedBlockStates,
21472125
executedBlockIds,

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils.ts

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,6 @@ import { useTerminalConsoleStore } from '@/stores/terminal'
55
import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
66
import { useWorkflowStore } from '@/stores/workflows/workflow/store'
77

8-
/**
9-
* Returns the run status to persist for a block, using an error-sticky policy.
10-
* Once any parallel branch for a block has errored, the block status stays 'error'
11-
* even if a later branch completes successfully — preventing failures from being masked.
12-
*/
13-
export function resolveBlockRunStatus(
14-
erroredBlocks: Set<string>,
15-
blockId: string,
16-
status: 'success' | 'error'
17-
): 'success' | 'error' {
18-
if (status === 'error') {
19-
erroredBlocks.add(blockId)
20-
}
21-
return erroredBlocks.has(blockId) ? 'error' : 'success'
22-
}
23-
248
/**
259
* Updates the active blocks set and ref counts for a single block.
2610
* Ref counting ensures a block stays active until all parallel branches for it complete.
@@ -80,7 +64,6 @@ export async function executeWorkflowWithFullLogging(
8064

8165
const activeBlocksSet = new Set<string>()
8266
const activeBlockRefCounts = new Map<string, number>()
83-
const blockRunErrors = new Set<string>()
8467

8568
const payload: any = {
8669
input: options.workflowInput,
@@ -171,11 +154,7 @@ export async function executeWorkflowWithFullLogging(
171154
)
172155
setActiveBlocks(wfId, new Set(activeBlocksSet))
173156

174-
setBlockRunStatus(
175-
wfId,
176-
event.data.blockId,
177-
resolveBlockRunStatus(blockRunErrors, event.data.blockId, 'success')
178-
)
157+
setBlockRunStatus(wfId, event.data.blockId, 'success')
179158

180159
addConsole({
181160
input: event.data.input || {},
@@ -211,11 +190,7 @@ export async function executeWorkflowWithFullLogging(
211190
)
212191
setActiveBlocks(wfId, new Set(activeBlocksSet))
213192

214-
setBlockRunStatus(
215-
wfId,
216-
event.data.blockId,
217-
resolveBlockRunStatus(blockRunErrors, event.data.blockId, 'error')
218-
)
193+
setBlockRunStatus(wfId, event.data.blockId, 'error')
219194

220195
addConsole({
221196
input: event.data.input || {},

0 commit comments

Comments
 (0)