fix(executor): workflow abort has to send abort signal to route for correct state update#2571
Merged
icecrasher321 merged 1 commit intostagingfrom Dec 24, 2025
Merged
Conversation
…orrect state update
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR refactors the workflow cancellation mechanism from a callback-based pattern ( Key changes:
Benefits:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as SSE Client
participant Route as Execute Route
participant AC as AbortController
participant Core as ExecutionCore
participant Executor as DAGExecutor
participant Engine as ExecutionEngine
participant Handler as BlockHandler
Client->>Route: POST /api/workflows/[id]/execute
Route->>AC: new AbortController()
Route->>Core: executeWorkflowCore({..., abortSignal})
Core->>Executor: new DAGExecutor({contextExtensions: {abortSignal}})
Executor->>Engine: new ExecutionEngine(context)
Note over Engine: context.abortSignal = signal
Engine->>Engine: while (hasWork())
Engine->>Engine: check abortSignal?.aborted
Engine->>Handler: execute block
Handler->>Handler: check ctx.abortSignal?.aborted
Handler-->>Engine: block result
Client->>Route: disconnect (SSE cancel)
Route->>AC: abortController.abort()
AC->>Engine: signal.aborted = true
Engine->>Engine: check abortSignal?.aborted
Engine->>Engine: break execution loop
Engine-->>Core: {status: 'cancelled'}
Core-->>Route: ExecutionResult
Route-->>Client: execution:cancelled event
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
To work with app running on multiple tasks + executor implementation the abort signal to execute route is the correct pattern to properly pause execution after current block finishes running.
Type of Change
Testing
Tested manually
Checklist