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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix(api): preserve published triggers on draft sync (#44068)
mika5dff24671d7e
diff --git a/api/events/event_handlers/sync_plugin_trigger_when_app_created.py b/api/events/event_handlers/sync_plugin_trigger_when_app_created.pyindex cc6e851ad87..19b8b263faa 100644--- a/api/events/event_handlers/sync_plugin_trigger_when_app_created.py+++ b/api/events/event_handlers/sync_plugin_trigger_when_app_created.py@@ -1,6 +1,6 @@import logging-from events.app_event import app_draft_workflow_was_synced, app_published_workflow_was_updated+from events.app_event import app_published_workflow_was_updatedfrom models.model import App, AppModefrom models.workflow import Workflowfrom services.trigger.trigger_service import TriggerService@@ -8,27 +8,24 @@ from services.trigger.trigger_service import TriggerServicelogger = logging.getLogger(__name__)-@app_draft_workflow_was_synced.connect@app_published_workflow_was_updated.connectdef handle(sender,- synced_draft_workflow: Workflow | None = None,published_workflow: Workflow | None = None,**kwargs,):"""- Sync plugin trigger relationships when a draft changes or is published.+ Sync plugin trigger relationships when a workflow is published.- The published workflow must be reconciled as well because production trigger- dispatch relies on these relationships, while debug dispatch does not.+ Production trigger dispatch relies on these relationships; debug dispatch+ uses the workflow graph directly."""app: App = senderif app.mode != AppMode.WORKFLOW.value:# only handle workflow app, chatflow is not supported yetreturn- workflow = published_workflow if published_workflow is not None else synced_draft_workflow- if workflow is None:+ if published_workflow is None:return- TriggerService.sync_plugin_trigger_relationships(app, workflow)+ TriggerService.sync_plugin_trigger_relationships(app, published_workflow)diff --git a/api/tests/unit_tests/events/event_handlers/test_sync_plugin_trigger_when_app_created.py b/api/tests/unit_tests/events/event_handlers/test_sync_plugin_trigger_when_app_created.pyindex a9d631cf7dd..c5542161a25 100644--- a/api/tests/unit_tests/events/event_handlers/test_sync_plugin_trigger_when_app_created.py+++ b/api/tests/unit_tests/events/event_handlers/test_sync_plugin_trigger_when_app_created.py@@ -2,6 +2,7 @@ from types import SimpleNamespacefrom typing import castfrom unittest.mock import patch+from events.app_event import app_draft_workflow_was_synced, app_published_workflow_was_updatedfrom events.event_handlers.sync_plugin_trigger_when_app_created import handlefrom models.model import AppModefrom models.workflow import Workflow@@ -19,13 +20,8 @@ def test_syncs_plugin_trigger_relationships_from_published_workflow() -> None:sync_relationships.assert_called_once_with(app, published_workflow)-def test_keeps_draft_workflow_relationship_sync() -> None:- app = SimpleNamespace(mode=AppMode.WORKFLOW.value)- draft_workflow = cast(Workflow, object())-- with patch(- "events.event_handlers.sync_plugin_trigger_when_app_created.TriggerService.sync_plugin_trigger_relationships"- ) as sync_relationships:- handle(app, synced_draft_workflow=draft_workflow)+def test_draft_workflow_sync_does_not_register_plugin_trigger_handler() -> None:+ sender = object()- sync_relationships.assert_called_once_with(app, draft_workflow)+ assert handle not in app_draft_workflow_was_synced.receivers_for(sender)+ assert handle in app_published_workflow_was_updated.receivers_for(sender)