From 2382210867f692d0ff0c88a1fdfb3522cff0526b Mon Sep 17 00:00:00 2001 From: Harry Date: Wed, 17 Dec 2025 17:04:47 +0800 Subject: [PATCH 1/3] docs: clarify delete_subscription should return success if subscription not found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add documentation note that delete_subscription should return success=True when the subscription no longer exists on the external service, as the goal is to ensure removal which is already achieved if it doesn't exist. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- python/dify_plugin/interfaces/trigger/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/dify_plugin/interfaces/trigger/__init__.py b/python/dify_plugin/interfaces/trigger/__init__.py index 197d30ad..42ef9127 100644 --- a/python/dify_plugin/interfaces/trigger/__init__.py +++ b/python/dify_plugin/interfaces/trigger/__init__.py @@ -426,6 +426,11 @@ def delete_subscription( If this method raises an exception, Dify will still remove the subscription but display a warning message to the user. + If the subscription no longer exists on the external service (e.g., already + deleted or expired), this method should return success=True rather than + treating it as an error. The goal is to ensure the subscription is removed, + which is already achieved if it doesn't exist. + Examples: Successful unsubscription: >>> subscription = Subscription( From d404c6a46926d5e0d8dc11e3b26a7caed5f20e1f Mon Sep 17 00:00:00 2001 From: Harry Date: Wed, 17 Dec 2025 17:05:28 +0800 Subject: [PATCH 2/3] fix: return success for non-existent webhooks in unsubscribe process Update the unsubscribe logic to return a success result when a webhook is not found in the repository, aligning with the intended behavior of indicating successful removal when the subscription does not exist. --- python/examples/github_trigger/provider/github.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/python/examples/github_trigger/provider/github.py b/python/examples/github_trigger/provider/github.py index ed28550b..d76aaa0f 100644 --- a/python/examples/github_trigger/provider/github.py +++ b/python/examples/github_trigger/provider/github.py @@ -338,10 +338,8 @@ def _delete_subscription( ) if response.status_code == 404: - raise UnsubscribeError( - message=f"Webhook {external_id} not found in repository {repository}", - error_code="WEBHOOK_NOT_FOUND", - external_response=response.json(), + return UnsubscribeResult( + success=True, message=f"Webhook {external_id} not found in repository {repository}" ) raise UnsubscribeError( From 91b267952572bb8420485ec9957e8082b44f423b Mon Sep 17 00:00:00 2001 From: Maries Date: Thu, 18 Dec 2025 10:20:28 +0800 Subject: [PATCH 3/3] Update python/dify_plugin/interfaces/trigger/__init__.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- python/dify_plugin/interfaces/trigger/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/dify_plugin/interfaces/trigger/__init__.py b/python/dify_plugin/interfaces/trigger/__init__.py index 42ef9127..800910c8 100644 --- a/python/dify_plugin/interfaces/trigger/__init__.py +++ b/python/dify_plugin/interfaces/trigger/__init__.py @@ -427,9 +427,9 @@ def delete_subscription( but display a warning message to the user. If the subscription no longer exists on the external service (e.g., already - deleted or expired), this method should return success=True rather than - treating it as an error. The goal is to ensure the subscription is removed, - which is already achieved if it doesn't exist. + deleted or expired), this method should return `success=True`. This ensures + idempotent behavior, as the desired state (the subscription being absent) + is already met. Examples: Successful unsubscription: