fix(notification): TYPE-1 backup/info 告警不再發審批卡
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
classify_notification() 不知道 alert_category,對 backup 告警 (confidence=0, auto_executed=False)返回 TYPE-3,覆蓋掉 classify_alert_early() 已設好的 notification_type=TYPE-1。 修法:在路由分支前,讓 incident.notification_type 明確值 (TYPE-1 / TYPE-4D / TYPE-8M)覆蓋 classify_notification()。 影響:backup/info/watchdog 告警只發 send_info_notification(), 不再噴帶按鈕的審批卡到 Telegram。 2026-04-12 ogt (ADR-075 bugfix) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -232,6 +232,16 @@ 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-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 路徑
|
||||
if _notification_type == "TYPE-1":
|
||||
_notif_type = NotificationType.TYPE_1
|
||||
elif _notification_type == "TYPE-4D":
|
||||
_notif_type = NotificationType.TYPE_4_DRIFT
|
||||
elif _notification_type == "TYPE-8M":
|
||||
_notif_type = NotificationType.TYPE_8M
|
||||
|
||||
if _notif_type == NotificationType.TYPE_1:
|
||||
# 純資訊通知 — 無按鈕
|
||||
tg_result = await gateway.send_info_notification(
|
||||
|
||||
Reference in New Issue
Block a user