Revert "fix(auto-repair): 中低風險+無kubectl_command → TYPE-1 純資訊,不顯示審核按鈕"

This reverts commit abf1ffa91e7327a36af93be2742d53dac1933f0d.
This commit is contained in:
OG T
2026-04-14 13:33:15 +08:00
parent 2df4945880
commit c0ba1000f3
3 changed files with 1 additions and 19 deletions

View File

@@ -225,18 +225,12 @@ async def _push_decision_to_telegram(
_auto_executed = proposal_data.get("auto_executed", False)
_decision_state = proposal_data.get("decision_state", "")
_mcp_all_failed = proposal_data.get("mcp_all_failed", False)
_suggested_action_for_classify = proposal_data.get("suggested_action", "")
_risk_level_for_classify = proposal_data.get("risk_level", "medium")
_has_kubectl = bool(proposal_data.get("kubectl_command", ""))
_notif_type = classify_notification(
incident=incident,
confidence=confidence,
auto_executed=_auto_executed,
mcp_all_failed=_mcp_all_failed,
decision_state=_decision_state,
suggested_action=_suggested_action_for_classify,
risk_level=_risk_level_for_classify,
has_kubectl_command=_has_kubectl,
)
# 2026-04-12 ogt: ADR-075 — 從 Incident 提取 alert_category/notification_type各分支共用

View File

@@ -367,8 +367,7 @@ class OpenClawService:
"action": data.get("action_title", "AI 分析"),
"description": data.get("description", ""),
"kubectl_command": data.get("kubectl_command") or "",
"suggested_action": data.get("suggested_action", ""),
"target_resource": data.get("target_resource") or "",
"target_resource": data.get("target_resource", "unknown"),
"namespace": data.get("namespace", "awoooi-prod"),
"risk_level": data.get("risk_level", "medium"),
"reasoning": data.get("reasoning", ""),

View File

@@ -1133,9 +1133,6 @@ def classify_notification(
auto_executed: bool,
mcp_all_failed: bool = False,
decision_state: str = "",
suggested_action: str = "",
risk_level: str = "",
has_kubectl_command: bool = True,
) -> NotificationType:
"""
告警通知分類器 — 決定要送哪種類型的 Telegram 卡片
@@ -1191,14 +1188,6 @@ def classify_notification(
if confidence < 0.5 or mcp_all_failed or decision_state == "ERROR":
return NotificationType.TYPE_4
# TYPE-1無 kubectl 動作 + 低/中風險 → 純資訊通知(無按鈕)
# 場景:主機層告警 suggested_action=investigateLLM 無法生成有效 kubectl 指令
# 2026-04-14 ogt (ADR-075): 中/低風險 + 無 kubectl_command → 不應發帶按鈕卡片
if (not has_kubectl_command
and risk_level in ("low", "medium")
and suggested_action in ("investigate", "no_action", "alert_team", "")):
return NotificationType.TYPE_1
# TYPE-3預設需人工審核
return NotificationType.TYPE_3