fix(telegram): 移除 7 個 ghost button (3-part/無handler)

違規 buttons 一覽:
- flywheel_diag / flywheel_dashboard (META告警卡)
- pause_1h / ignore (業務告警卡)
- postmortem / escalation_ack / dr_manual (升級通知卡)
- secops_block_ip / secops_evict (SecOps 卡,spec=nonce 但用 2-part)

所有 buttons 均無 callback handler,點擊無回應 = 鬼魂按鈕
鐵律: 寧可沒按鈕,不可有死按鈕 (feedback_no_ghost_buttons.md)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-16 03:29:41 +08:00
parent cd1c0ffdb8
commit 9ea1f77e41

View File

@@ -1951,13 +1951,11 @@ class TelegramGateway:
if probable_cause:
text += f"└─ 可能根因:{html.escape(probable_cause[:100])}\n"
# 2026-04-16 ogt: 移除 flywheel_diag / flywheel_dashboard (3-part ghost button無 handler)
# 鐵律: 寧可沒按鈕,不可有死按鈕 (feedback_no_ghost_buttons.md)
silence_nonce = self._security.generate_callback_nonce(approval_id, "silence")
keyboard = {
"inline_keyboard": [
[
{"text": "🔄 觸發診斷", "callback_data": f"action:flywheel_diag:{incident_id}"},
{"text": "📊 查看面板", "callback_data": f"action:flywheel_dashboard:{incident_id}"},
],
[
{"text": "🔕 靜默 1h", "callback_data": silence_nonce},
],
@@ -2011,6 +2009,9 @@ class TelegramGateway:
if defense_action:
text += f"\n🛡️ <b>建議防禦動作</b>\n<code>{html.escape(defense_action[:200])}</code>\n"
# 2026-04-16 ogt: 移除 secops_block_ip / secops_evict (spec=nonce 但用了 2-part格式無 handler)
# secops 高危操作需 multi-sig現階段無多簽機制暫移除等補齊
# 鐵律: 寧可沒按鈕,不可有死按鈕 (feedback_no_ghost_buttons.md)
isolate_nonce = self._security.generate_callback_nonce(approval_id, "secops_isolate")
auth_nonce = self._security.generate_callback_nonce(approval_id, "secops_authorize")
@@ -2018,10 +2019,6 @@ class TelegramGateway:
"inline_keyboard": [
[
{"text": "🚫 隔離資源", "callback_data": isolate_nonce},
{"text": "⛔ 封鎖來源 IP", "callback_data": f"secops_block_ip:{incident_id}"},
],
[
{"text": "🔄 強制驅逐 Pod", "callback_data": f"secops_evict:{incident_id}"},
{"text": "✅ 確認授權操作", "callback_data": auth_nonce},
],
]
@@ -2068,14 +2065,9 @@ class TelegramGateway:
if loss_rate:
text += f"└─ 損失速率:{html.escape(loss_rate)}\n"
keyboard = {
"inline_keyboard": [
[
{"text": "⏸️ 暫停 1h", "callback_data": f"action:pause_1h:{incident_id}"},
{"text": "❌ 忽略", "callback_data": f"action:ignore:{incident_id}"},
],
]
}
# 2026-04-16 ogt: 移除 pause_1h / ignore (3-part ghost button無 handler)
# 鐵律: 寧可沒按鈕,不可有死按鈕 (feedback_no_ghost_buttons.md)
keyboard = {"inline_keyboard": []}
target_chat = group_chat_id or settings.OPENCLAW_TG_CHAT_ID
return await self._send_request(
@@ -2125,17 +2117,9 @@ class TelegramGateway:
if current_impact:
text += f"└─ 目前影響:{html.escape(current_impact[:100])}\n"
keyboard = {
"inline_keyboard": [
[
{"text": "📄 產生 Postmortem 草稿", "callback_data": f"action:postmortem:{incident_id}"},
],
[
{"text": "✅ 確認已接手處理", "callback_data": f"action:escalation_ack:{incident_id}"},
{"text": "📖 DR 手冊", "callback_data": f"action:dr_manual:{incident_id}"},
],
]
}
# 2026-04-16 ogt: 移除 postmortem / escalation_ack / dr_manual (3-part ghost button無 handler)
# 鐵律: 寧可沒按鈕,不可有死按鈕 (feedback_no_ghost_buttons.md)
keyboard = {"inline_keyboard": []}
results = []
# 發個人 DM