From 683b1a839a431d4839e4f7e7a1986c32d74800b4 Mon Sep 17 00:00:00 2001 From: leozhang2018 Date: Fri, 10 Apr 2026 11:24:22 +0800 Subject: [PATCH] fix: preserve soft-delete flags in workflow task ACK writes. Signed-off-by: leozhang2018 --- .../core/common/service/workflowcontroller/workflow.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/workflow.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/workflow.go index 27bc169d66..635a12fdb4 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/workflow.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/workflow.go @@ -556,6 +556,15 @@ func (c *workflowCtl) updateWorkflowTask() { c.workflowTask.Remark = "" + // Preserve the soft-delete flags from the DB copy. The in-memory task was + // loaded before the workflow could have been deleted, so its IsDeleted / + // IsArchived fields may be stale (false). Blindly writing them back via + // $set would silently undo a soft-delete performed by DeleteWorkflowV4, + // making the task reappear in the UI as "running" even after the workflow + // has been removed. + c.workflowTask.IsDeleted = taskInColl.IsDeleted + c.workflowTask.IsArchived = taskInColl.IsArchived + c.workflowTaskMutex.Lock() if err := commonrepo.NewworkflowTaskv4Coll().Update(c.workflowTask.ID.Hex(), c.workflowTask); err != nil { c.workflowTaskMutex.Unlock()