fix(executor): stop condition/router erroring when downstream blocks are disabled - #6079
fix(executor): stop condition/router erroring when downstream blocks are disabled#6079waleedlatif1 wants to merge 1 commit into
Conversation
…are disabled Manual editor runs built the executor payload from blocks-minus-disabled but sent every edge, so the server received edges pointing at blocks absent from workflow.blocks. Condition and router are the only handlers that resolve their target out of workflow.blocks, so only they threw "Target block <id> not found"; every other block type ignores a dangling edge. Deployed, scheduled, webhook and run-from-block executions always sent full state, so the editor was the only outlier — the DAG builder already excludes disabled blocks and their edges. - keep disabled blocks in the payload; filter only for trigger resolution - condition: a disabled or missing target dead-ends the branch instead of throwing - router: exclude disabled/missing targets from the candidate list, and dead-end without calling the model when none remain (previously these runs succeeded after picking a disabled block, so throwing would have failed live workflows) - serializer: drop connections that reference a block that does not exist
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Editor execution ( Condition and legacy router handlers treat missing or disabled branch targets as a dead end ( Serializer drops connections that reference blocks absent from the serialized graph (while still serializing disabled blocks and their edges). Tests cover the client payload invariant and the new dead-end / filtering behavior. Reviewed by Cursor Bugbot for commit e1b58c1. Configure here. |
Greptile SummaryFixes manual-run condition/router failures when downstream blocks are disabled by keeping blocks and edges consistent and treating non-executable branch targets as dead ends.
Confidence Score: 5/5This PR appears safe to merge; the payload, handler, and serializer changes align with existing DAG dead-end behavior and are covered by targeted tests. Disabled blocks stay in the client payload so edges remain consistent; condition and legacy router dead-end on non-executable targets instead of throwing; the serializer drops dangling connections; and EdgeManager already treats routed null paths as completion.
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts | Stops filtering disabled blocks from the execution override; trigger discovery still uses enabled-only state. |
| apps/sim/executor/handlers/condition/condition-handler.ts | Missing/disabled selected targets return a dead-end result with selectedOption set for edge routing. |
| apps/sim/executor/handlers/router/router-handler.ts | Legacy router filters non-executable targets and short-circuits with null route when the candidate list is empty. |
| apps/sim/serializer/index.ts | Connection filter now requires both endpoints to exist in serialized blocks, not only non-dropped custom blocks. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Manual run payload] --> B[Include disabled blocks + all edges]
B --> C[Serializer]
C --> D[SerializedWorkflow with enabled flags]
D --> E[DAG builder drops disabled nodes/edges]
E --> F{Condition / legacy router}
F -->|Executable target| G[Activate selected path]
F -->|Missing or disabled target| H[selectedPath null dead-end]
H --> I[EdgeManager cascades / completes run]
Reviews (1): Last reviewed commit: "fix(executor): stop condition/router err..." | Re-trigger Greptile
Summary
Target block <id> not found. Manual editor runs built the payload from blocks-minus-disabled but sent every edge, so the server got edges pointing at blocks absent fromworkflow.blocks.workflow.blocks, so only they threw — every other block type ignores a dangling edge. Hence it looked random.Changes:
use-workflow-execution.ts: keep disabled blocks in the payload so blocks and edges stay consistent; filter to enabled only for trigger resolution, so a disabled trigger still can't be selected.condition-handler.ts: a disabled or missing target dead-ends (selectedPath: null,selectedOptionset) instead of throwing.edge-manageralready treats that as a routed dead end — a path covered by existing tests, including inside loops and nested conditions.router-handler.ts: exclude disabled/missing targets from the legacy router's candidate list so the model is never offered a route the DAG can't execute. When none remain it dead-ends without calling the model — those runs succeed today (the model picks a disabled block, the DAG dead-ends), so throwing would have failed live deployed workflows.serializer/index.ts: drop connections referencing a block that doesn't exist, so a dangling edge can never reach the executor again.Router V2 is deliberately untouched: its routes are user-declared ports, so silently removing one from the model's options is a bigger change than for the legacy router, where the target block is the route. It already dead-ends gracefully.
Type of Change
Testing
4258 tests pass across
executor,serializer,stores,lib/workflowsand the editor hooks; typecheck andcheck:api-validationclean.New coverage:
Also verified by hand: a loop whose only inner block is disabled still builds a DAG (the existing "all inner blocks disabled" test has no loop container, so it never reaches the validation it claims to cover), and disabled blocks skip required-field validation so a half-configured disabled block can't fail a run.
Not live-verified in a browser.
Checklist