Skip to content

fix:implement workflow task cancellation before deletion in DeleteWorkflowV4 function.#4617

Merged
lilianzhu merged 1 commit intokoderover:mainfrom
leozhang2018:workflow-deletion-check
Apr 27, 2026
Merged

fix:implement workflow task cancellation before deletion in DeleteWorkflowV4 function.#4617
lilianzhu merged 1 commit intokoderover:mainfrom
leozhang2018:workflow-deletion-check

Conversation

@leozhang2018
Copy link
Copy Markdown
Collaborator

@leozhang2018 leozhang2018 commented Apr 10, 2026

What this PR does / Why we need it:

When a user deletes a workflow that has queued or running tasks, the system soft-deletes all associated tasks (setting is_deleted: true, is_archived: true) without sending a cancellation signal to the execution controller. This results in:

Tasks disappear from the UI immediately (all list queries filter by is_deleted: false)
The workflow controller keeps executing the task in memory — it is unaware of the is_deleted flag
Users have no way to find or cancel the "zombie" task from any UI surface
On service restart, InitQueue also skips these tasks (InCompletedTasks filters is_deleted: false), so they are never cleaned up automatically

What is changed and how it works?

Before soft-deleting workflow tasks in DeleteWorkflowV4, query WorkflowQueueColl by workflow name to retrieve all enqueued tasks, then call CancelWorkflowTask for each one. This triggers a DB status update to Cancelled and publishes a Redis cancel signal, allowing the controller to exit gracefully. Cancellation failures are logged as warnings and do not block the deletion.

Does this PR introduce a user-facing change?

  • API change
  • database schema change
  • upgrade assistant change
  • change in non-functional attributes such as efficiency or availability
  • fix of a previous issue

This change is Reviewable

…kflowV4 function.

Signed-off-by: leozhang2018 <leozhang2018@gmail.com>
@leozhang2018 leozhang2018 added the bug Something isn't working label Apr 10, 2026
@lilianzhu lilianzhu merged commit 6e79b59 into koderover:main Apr 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working service/aslan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants