fix(telegram): BUG-C TYPE-3 排版清洗 + 批准/拒絕永遠置頂(ADR-075 UI 第三波修復)
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
Checkpoint 1 — decision_manager.py TYPE-3 root_cause 清洗: - 舊: root_cause=_smt(reasoning, 500) → debate_summary 全文(診斷/方案/審查/質疑)全部傾倒到 AI 診斷欄 - 新: _parse_debate_summary 只取 diagnosis 欄位 + _smt 截斷 300 字 - 移除 _requires_human 變數(已無用途) Checkpoint 2 — telegram_gateway.py _build_inline_keyboard 按鈕順序重構: - 舊: K8s 類別按鈕置頂,批准/拒絕受 requires_human_approval 控制 → 死卡 - 新: [✅ 批准][❌ 拒絕] 永遠第一行,K8s/DB/Host 操作按鈕置後 - 移除 requires_human_approval 參數(邏輯已簡化為無條件置頂) 修改範圍: decision_manager.py else 路由段 + _build_inline_keyboard + send_approval_card 簽名, telegram_gateway.py 模板/訊息格式零改動。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -398,15 +398,16 @@ async def _push_decision_to_telegram(
|
||||
)
|
||||
else:
|
||||
# TYPE-2 / TYPE-3 / TYPE-4 都走 send_approval_card(按鈕組合由 alert_category 決定)
|
||||
# 2026-04-17 ogt + Claude Sonnet 4.6: 傳入 requires_human_approval + 智能截斷
|
||||
# 根因:① requires_human_approval=True 時動態按鈕卡缺少 [批准][拒絕] → 死卡
|
||||
# ② [:500] 在括號中間切斷 → 幽靈截斷「質疑:無(通」
|
||||
_requires_human = bool(proposal_data.get("requires_human_review", False))
|
||||
# 2026-04-17 ogt + Claude Sonnet 4.6 (BUG-C): TYPE-3 root_cause 清洗
|
||||
# 舊:root_cause=_smt(reasoning, 500) → debate_summary 全文傾倒到 AI 診斷欄位
|
||||
# 新:_parse_debate_summary 只取 diagnosis;方案/審查/質疑不在此卡顯示
|
||||
_parsed_card = _parse_debate_summary(reasoning)
|
||||
_card_root_cause = _smt(_parsed_card.get("diagnosis") or description, 300)
|
||||
tg_result = await gateway.send_approval_card(
|
||||
approval_id=approval_id,
|
||||
risk_level=risk_level,
|
||||
resource_name=target[:50],
|
||||
root_cause=_smt(reasoning, 500) if reasoning else _smt(description, 500),
|
||||
root_cause=_card_root_cause,
|
||||
suggested_action=action[:120] if action else (description[:120] if description else "待分析"),
|
||||
estimated_downtime="5-15 min",
|
||||
primary_responsibility="INFRA",
|
||||
@@ -424,7 +425,6 @@ async def _push_decision_to_telegram(
|
||||
alert_category=_alert_category,
|
||||
notification_type=_notification_type,
|
||||
playbook_name=_playbook_name,
|
||||
requires_human_approval=_requires_human,
|
||||
)
|
||||
|
||||
# 2026-04-09 Claude Sonnet 4.6: 存 message_id → 後續狀態更新在原訊息延續
|
||||
|
||||
Reference in New Issue
Block a user