improvement(executor): faster, more responsive workflow cancellation#4630
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Refactors Reviewed by Cursor Bugbot for commit d5f86b2. Configure here. |
Greptile SummaryThis PR replaces 500 ms Redis-polling cancellation with a unified pub/sub + durable-backstop model, threads
Confidence Score: 5/5Safe to merge; the core cancellation path (pub/sub wake → abortPromise → engine returns) is correct and well-tested. The two observations are bounded edge-cases that don't affect the primary cancellation flow. All three previously-identified issues are confirmed fixed. 125 targeted tests pass and TSC is clean. engine.ts waitForAllExecutions and tools/index.ts retry-sleep signal handling are worth a second look before adding more complex parallel/Response-block workflows. Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant CancelAPI
participant PubSub as PubSubChannel
participant Redis
participant Engine as ExecutionEngine
participant Provider as LLM Provider
participant ET as executeTool
participant Fetch as HTTP Fetch
Client->>CancelAPI: POST /cancel
CancelAPI->>Redis: "SET execution:cancel:{id}"
CancelAPI->>PubSub: "publish({executionId})"
PubSub-->>Engine: subscribe callback fires
Engine->>Engine: signalCancelled()
Note over Engine: abortPromise resolves
Engine->>Engine: waitForAnyExecution wakes
Engine-->>Client: status cancelled
Provider->>ET: executeTool with signal
ET->>Fetch: fetch with chained signal
Fetch--xProvider: AbortError
Reviews (2): Last reviewed commit: "chore(tests): rename stale 'cancellation..." | Re-trigger Greptile |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d5f86b2. Configure here.
Summary
signalCancelled()so every source (abortSignal, pub/sub, backstop) wakes the wait loops immediatelyabortSignalfrom LLM provider tool-call loops throughexecuteTool→ internalfetch/secureFetchWithPinnedIP/ MCP fetch so in-flight tool HTTP aborts instead of orphaningexecution:cancel; keep the Redis key as durable backstop checked once at engine startexecuteToolto an options-object signature across 14 providers, 5 handlers, and copilot integrationType of Change
Testing
Tested manually on a parallel workflow that fans out LLM agents calling Exa tools — Stop now flips state within ~tens of ms and in-flight tool HTTP shows as cancelled. 125 targeted unit tests pass, TSC clean,
check:api-validationpasses.Checklist