fix(cancel-workflow-exec): move cancellation tracking for multi-task envs to redis#2573
Merged
icecrasher321 merged 2 commits intostagingfrom Dec 24, 2025
Merged
fix(cancel-workflow-exec): move cancellation tracking for multi-task envs to redis#2573icecrasher321 merged 2 commits intostagingfrom
icecrasher321 merged 2 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR addresses a critical limitation in multi-task workflow environments by moving cancellation tracking from local Key Changes
ArchitectureThe implementation uses a hybrid approach:
Minor Issues
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Client Hook
participant API as Execute Route
participant Redis as Redis
participant Engine as Execution Engine
participant LoopOrch as Loop Orchestrator
participant WaitHandler as Wait Handler
Note over Client,WaitHandler: Normal Execution Flow
Client->>API: POST workflows execute
API->>API: Generate executionId
API->>Engine: Start execution with abortController
Engine->>Engine: Initialize useRedisCancellation flag
alt Has Loop Execution
Engine->>LoopOrch: Execute iteration
LoopOrch->>Redis: isExecutionCancelled
Redis-->>LoopOrch: false
LoopOrch->>Engine: Continue iteration
end
alt Has Wait Block
Engine->>WaitHandler: Execute wait block
WaitHandler->>WaitHandler: Start sleep with 500ms interval
WaitHandler->>Redis: isExecutionCancelled
Redis-->>WaitHandler: false
WaitHandler-->>Engine: Wait completed
end
Note over Client,WaitHandler: Cancellation Flow
Client->>Client: User clicks cancel
Client->>API: POST cancel execution
API->>Redis: markExecutionCancelled
Redis-->>API: Success
API-->>Client: success true
Client->>API: AbortController abort
API->>API: Stream cancel callback
API->>Redis: markExecutionCancelled
API->>API: abortController abort
Note over Engine,WaitHandler: Engine Detects Cancellation
alt Engine Main Loop Check
Engine->>Engine: checkCancellation 500ms throttle
Engine->>Redis: isExecutionCancelled
Redis-->>Engine: true
Engine->>Engine: Set cancelledFlag true
Engine-->>API: status cancelled
end
alt During Wait Block
WaitHandler->>Redis: isExecutionCancelled
Redis-->>WaitHandler: true
WaitHandler->>WaitHandler: cleanup and resolve false
WaitHandler-->>Engine: status cancelled
end
alt During Loop Iteration
LoopOrch->>Redis: isExecutionCancelled
Redis-->>LoopOrch: true
LoopOrch-->>Engine: Exit loop result
end
API->>Client: SSE event execution cancelled
Note over Client,WaitHandler: Fallback Without Redis
alt No Redis Available
Client->>API: AbortController abort
API->>API: abortController abort
Engine->>Engine: Check abortSignal aborted
Engine->>Engine: Set cancelledFlag true
Engine-->>API: status cancelled
end
|
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
Move cancellation checking to redis for multi-task envs.
Type of Change
Testing
Tested manually
Checklist