Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: ensure WorkflowRun attributes are refreshed in WorkflowCycleMana… (#11913)

Kalo Chin786cb6859b0f
diff --git a/api/core/app/task_pipeline/workflow_cycle_manage.py b/api/core/app/task_pipeline/workflow_cycle_manage.py
index e2fa12b1cdd..0e6425fa14e 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