From 92b39ab840fb04824de3eac9a1bd17d0f2308383 Mon Sep 17 00:00:00 2001 From: OG T Date: Thu, 16 Apr 2026 22:37:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(no-action-notify):=20YAML=20NO=5FACTION=20?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=94=B9=E7=82=BA=20TYPE-1=20=E8=B3=87?= =?UTF-8?q?=E8=A8=8A=E9=80=9A=E7=9F=A5=EF=BC=88=E7=A7=BB=E9=99=A4=E7=84=A1?= =?UTF-8?q?=E6=84=8F=E7=BE=A9=E5=AF=A9=E6=A0=B8=E6=8C=89=E9=88=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: - host_resource/postgresql_disk_monitoring YAML 規則設 NO_ACTION - 但 classify_notification() 不知道 NO_ACTION - confidence=0.2(感應器無資料)→ 判為 TYPE-4(信心不足需人工審核) - SRE 看到「審核批准/拒絕」按鈕,卻沒有任何自動修復動作可執行 → 毫無意義 修復: - _push_decision_to_telegram 偵測 blocked_reason 含 "NO_ACTION" - 強制 _notif_type = TYPE-1(純資訊通知,無審核按鈕) - SRE 看到資訊卡「主機 CPU/負載/磁碟告警 (觀察即可)」而非假的審核請求 2026-04-16 ogt + Claude Sonnet 4.6 (台北時區) Co-Authored-By: Claude Sonnet 4.6 --- apps/api/src/services/decision_manager.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/api/src/services/decision_manager.py b/apps/api/src/services/decision_manager.py index 1d1d99495..5917de298 100644 --- a/apps/api/src/services/decision_manager.py +++ b/apps/api/src/services/decision_manager.py @@ -263,6 +263,15 @@ async def _push_decision_to_telegram( _notification_type = getattr(incident, "notification_type", "") or (_notif_type.value if _notif_type else "") _alertname = incident.signals[0].labels.get("alertname", "MetaSystemAlert") if incident.signals else "MetaSystemAlert" + # 2026-04-16 ogt + Claude Sonnet 4.6: YAML NO_ACTION → TYPE-1(資訊通知,無按鈕) + # 根因:YAML 規則標記 NO_ACTION(如 host_resource/postgresql_disk_monitoring) + # 但 classify_notification() 不知道 NO_ACTION → 判為 TYPE-4(confidence 不足) + # → SRE 看到審核按鈕卻沒有任何可執行動作,完全無意義 + # 修復:偵測 blocked_reason 含 "NO_ACTION" → 強制 TYPE-1(純資訊,告知 SRE 即可) + _blocked_reason = proposal_data.get("blocked_reason", "") + if "NO_ACTION" in _blocked_reason: + _notif_type = NotificationType.TYPE_1 + # 2026-04-12 ogt: classify_alert_early() 設的 notification_type 優先於 classify_notification() # 場景:backup/info 告警被 classify_notification() 誤判為 TYPE-3(confidence=0, 無 auto_executed) # 規則:incident.notification_type 明確為 TYPE-1 → 強制走 info 路徑