From 8b40a89add593108de2594d38f74033e6afeb14c Mon Sep 17 00:00:00 2001 From: "Ethan T." Date: Fri, 13 Mar 2026 15:35:02 +0800 Subject: [PATCH] fix: with_debug_recipient() silently drops debug emails when user_id is None or empty string (#33373) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Crazywoola <100913391+crazywoola@users.noreply.github.com> --- api/dify_graph/nodes/human_input/entities.py | 8 ++++---- api/services/workflow_service.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/dify_graph/nodes/human_input/entities.py b/api/dify_graph/nodes/human_input/entities.py index 82a8f32053..642c2143e5 100644 --- a/api/dify_graph/nodes/human_input/entities.py +++ b/api/dify_graph/nodes/human_input/entities.py @@ -72,8 +72,8 @@ class EmailDeliveryConfig(BaseModel): body: str debug_mode: bool = False - def with_debug_recipient(self, user_id: str) -> "EmailDeliveryConfig": - if not user_id: + def with_debug_recipient(self, user_id: str | None) -> "EmailDeliveryConfig": + if user_id is None: debug_recipients = EmailRecipients(whole_workspace=False, items=[]) return self.model_copy(update={"recipients": debug_recipients}) debug_recipients = EmailRecipients(whole_workspace=False, items=[MemberRecipient(user_id=user_id)]) @@ -141,7 +141,7 @@ def apply_debug_email_recipient( method: DeliveryChannelConfig, *, enabled: bool, - user_id: str, + user_id: str | None, ) -> DeliveryChannelConfig: if not enabled: return method @@ -149,7 +149,7 @@ def apply_debug_email_recipient( return method if not method.config.debug_mode: return method - debug_config = method.config.with_debug_recipient(user_id or "") + debug_config = method.config.with_debug_recipient(user_id) return method.model_copy(update={"config": debug_config}) diff --git a/api/services/workflow_service.py b/api/services/workflow_service.py index ec37fbeb6b..2549cdf180 100644 --- a/api/services/workflow_service.py +++ b/api/services/workflow_service.py @@ -952,7 +952,7 @@ class WorkflowService: delivery_method = apply_debug_email_recipient( delivery_method, enabled=True, - user_id=account.id or "", + user_id=account.id, ) variable_pool = self._build_human_input_variable_pool(