From 786cb6859b0fbd056104d1c67cf47d8fcf517b0f Mon Sep 17 00:00:00 2001 From: Kalo Chin <91766386+fdb02983rhy@users.noreply.github.com> Date: Sat, 21 Dec 2024 16:05:04 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20ensure=20WorkflowRun=20attributes=20are?= =?UTF-8?q?=20refreshed=20in=20WorkflowCycleMana=E2=80=A6=20(#11913)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/core/app/task_pipeline/workflow_cycle_manage.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/core/app/task_pipeline/workflow_cycle_manage.py b/api/core/app/task_pipeline/workflow_cycle_manage.py index e2fa12b1cd..0e6425fa14 100644 --- a/api/core/app/task_pipeline/workflow_cycle_manage.py +++ b/api/core/app/task_pipeline/workflow_cycle_manage.py @@ -505,6 +505,12 @@ class WorkflowCycleManage: :param workflow_run: workflow run :return: """ + # Attach WorkflowRun to an active session so "created_by_role" can be accessed. + workflow_run = db.session.merge(workflow_run) + + # Refresh to ensure any expired attributes are fully loaded + db.session.refresh(workflow_run) + created_by = None if workflow_run.created_by_role == CreatedByRole.ACCOUNT.value: created_by_account = workflow_run.created_by_account