-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(cancel-workflow-exec): move cancellation tracking for multi-task envs to redis #2573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7 files reviewed, 2 comments
Summary
Move cancellation checking to redis for multi-task envs.
Type of Change
Testing
Tested manually
Checklist