-
Notifications
You must be signed in to change notification settings - Fork 3.2k
improvement(executor): upgraded abort controller to handle aborts for loops and parallels #2880
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
base: staging
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
… loops and parallels
6606006 to
fa54d99
Compare
Greptile Summaryupgraded abort controller implementation to handle mid-loop and mid-parallel cancellations by introducing a cached abort promise pattern that enables immediate cancellation without waiting for all executing nodes to complete Key changes:
The implementation properly handles edge cases like pre-aborted signals, preserves partial outputs, and maintains metadata on cancellation. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant AbortController
participant Engine
participant AbortPromise
participant ProcessQueue
participant NodeExecution
User->>AbortController: abort()
AbortController->>Engine: abort event
Engine->>Engine: set cancelledFlag = true
Engine->>AbortPromise: resolve()
alt During Queue Processing
ProcessQueue->>Engine: checkCancellation()
Engine-->>ProcessQueue: true (cancelled)
ProcessQueue->>ProcessQueue: break queue loop
end
alt During Parallel Execution
NodeExecution->>NodeExecution: executing parallel branches
Engine->>Engine: waitForAnyExecution()
Engine->>Engine: Promise.race([...executing, abortPromise])
AbortPromise-->>Engine: resolves first
Engine-->>ProcessQueue: returns immediately
Note over NodeExecution: unfinished executions continue<br/>but won't be awaited
end
alt During Loop Iteration
ProcessQueue->>Engine: checkCancellation()
Engine-->>ProcessQueue: true (cancelled)
ProcessQueue->>ProcessQueue: break loop
Engine->>Engine: skip waitForAllExecutions()
end
Engine->>Engine: build result with status='cancelled'
Engine-->>User: ExecutionResult (cancelled)
|
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.
2 files reviewed, 1 comment
Summary
Type of Change
Testing
Tested manually, added unit tests
Checklist