From c8d299ec8d2e33b61446b5b8cd401ad38df10ba9 Mon Sep 17 00:00:00 2001 From: AIOSAI Date: Fri, 10 Apr 2026 12:12:23 -0700 Subject: [PATCH] feat(trigger): add wake_branch() to error dispatch for autonomous handling After delivering error notification email, now calls wake_branch() to spawn an agent in the target branch immediately. Changes reply_to from @trigger to @devpulse so resolution reports go to devpulse. 370 tests passing. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../trigger/apps/handlers/events/error_detected.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/aipass/trigger/apps/handlers/events/error_detected.py b/src/aipass/trigger/apps/handlers/events/error_detected.py index a5e58170..3e3c4d29 100644 --- a/src/aipass/trigger/apps/handlers/events/error_detected.py +++ b/src/aipass/trigger/apps/handlers/events/error_detected.py @@ -516,10 +516,17 @@ def handle_error_detected( subject=email_subject, message=notification_message, auto_execute=True, - reply_to='@trigger', + reply_to='@devpulse', from_branch='@trigger' ) + # Wake the target branch so the email is processed immediately + try: + from aipass.ai_mail.apps.handlers.dispatch.wake import wake_branch + wake_branch(recipient, fresh=False, sender='@trigger') + except Exception: + pass # Silent — email in inbox as fallback + json_handler.log_operation("dispatch_sent", {"recipient": recipient}) # Record dispatch for tracking