diff --git a/apps/api/src/api/v1/webhooks.py b/apps/api/src/api/v1/webhooks.py index 9656ddfd..87f70ad3 100644 --- a/apps/api/src/api/v1/webhooks.py +++ b/apps/api/src/api/v1/webhooks.py @@ -1105,6 +1105,7 @@ async def alertmanager_webhook( # Q9: auto_repair flag — Rule=false 強制 HITL(不觸發自動修復背景任務) _can_auto_repair_by_rule = _alert_labels.get("auto_repair", "true").lower() == "true" try: + from src.repositories.alert_operation_log_repository import get_alert_operation_log_repository _op_log = get_alert_operation_log_repository() await _op_log.append( "ALERT_RECEIVED", @@ -1377,6 +1378,7 @@ async def alertmanager_webhook( ) else: # auto_repair=false → 記錄 GUARDRAIL_BLOCKED,不觸發自動修復 + from src.repositories.alert_operation_log_repository import get_alert_operation_log_repository _op_log_rule = get_alert_operation_log_repository() background_tasks.add_task( _op_log_rule.append,