fix(telegram): separate ssh diagnosis from repair failures
All checks were successful
Code Review / ai-code-review (push) Successful in 11s
CD Pipeline / tests (push) Successful in 1m27s
CD Pipeline / build-and-deploy (push) Successful in 4m19s
CD Pipeline / post-deploy-checks (push) Successful in 1m25s

This commit is contained in:
Your Name
2026-05-06 22:03:19 +08:00
parent 53994e75f0
commit 9dfecc4d1b
5 changed files with 107 additions and 8 deletions

View File

@@ -215,6 +215,7 @@ class TelegramMessage:
# 2026-04-16 ogt + Claude Sonnet 4.6: 告警分類與修復鏈路顯示 (ADR-076)
alert_category: str = "" # host/k8s/database/service/external_site/secops 等
playbook_name: str = "" # 匹配到的 Playbook 名稱(空字串=規則匹配)
automation_state: str = "" # diagnosis_collected_manual_required / diagnosis_failed_manual_required
# ==========================================================================
# Phase 22: Nemotron 協作欄位 (ADR-044)
@@ -273,7 +274,12 @@ class TelegramMessage:
mode = self._automation_mode()
action = (self.suggested_action or "").upper()
text = f"{self.root_cause} {self.suggested_action}".lower()
state = (self.automation_state or "").lower()
if state == "diagnosis_collected_manual_required":
return "🔎 AI 已完成只讀診斷,需人工判斷"
if state == "diagnosis_failed_manual_required":
return "🔴 AI 診斷工具失敗,需人工排查"
if mode == "llm_timeout_manual_gate":
return "🔴 AI 分析超時,需人工排查"
if action in {"NO_ACTION", "待分析", ""} or "invalid_target" in text:
@@ -1874,6 +1880,7 @@ class TelegramGateway:
notification_type: str = "",
# 2026-04-16 ogt + Claude Sonnet 4.6: 修復鏈路顯示 (ADR-076)
playbook_name: str = "",
automation_state: str = "",
) -> dict:
"""
推送待簽核卡片到 Telegram (v7.0 含 SignOz 整合)
@@ -1950,6 +1957,7 @@ class TelegramGateway:
# 2026-04-16 ogt + Claude Sonnet 4.6: 修復鏈路顯示 (ADR-076)
alert_category=alert_category,
playbook_name=playbook_name,
automation_state=automation_state,
)
# 格式化訊息 — Phase 22: 如果 Nemotron 啟用,使用雙軌格式