diff --git a/apps/api/src/api/v1/webhooks.py b/apps/api/src/api/v1/webhooks.py index e7313538..dc4deef2 100644 --- a/apps/api/src/api/v1/webhooks.py +++ b/apps/api/src/api/v1/webhooks.py @@ -1156,7 +1156,14 @@ async def alertmanager_webhook( ) # I1 整合 ADR-064 Rule Engine 2026-04-11: YAML 規則動態推斷,ALERTNAME_TO_TYPE 為 fallback + # 2026-04-12 ogt: AlertPayload.alert_type 只接受 8 個 Literal,超範圍的改為 "custom" + _ALERT_TYPE_ALLOWED = { + "k8s_node_failure", "k8s_pod_crash", "db_connection_timeout", "service_404", + "high_cpu", "high_memory", "disk_full", "ssl_expiry", "custom", + } alert_type = get_incident_type(alertname) + if alert_type not in _ALERT_TYPE_ALLOWED: + alert_type = "custom" # ADR-073 Phase 2-2: 早期分診 — 在 LLM 前決定 alert_category + notification_type # 2026-04-12 ogt: 防止 HostBackupFailed 等被誤路由到 K8s executor