fix(arch-014,arch-020): no contract lazy-resurrect after unregister; event bus dedupes handlers
Check Cross-Plugin Imports / check (push) Has been cancelled

Also fixes ARCH-029/041: none-check before attribute access in trigger dispatcher.
This commit is contained in:
Agent Zero
2026-08-23 15:30:12 +02:00
parent 982b4c9353
commit b04cda774b
3 changed files with 29 additions and 5 deletions
+4 -1
View File
@@ -121,11 +121,14 @@ class TriggerDispatcher:
"""Query DB for active automations matching *event_name* and dispatch."""
from app.core.db import get_session_factory
from app.plugins.builtins.contracts import get_contract
# None-check FIRST — accessing attributes on the contract before the
# check crashed with AttributeError when automation was inactive
# (ARCH-029/041).
automation_contract = get_contract("automation")
AutomationDefinition = automation_contract.Automation # noqa: N806
if automation_contract is None:
logger.debug("Automation plugin not available — trigger skipped")
return
AutomationDefinition = automation_contract.Automation # noqa: N806
factory = get_session_factory()
tenant_id = payload.get("tenant_id")