fix(p1-backlog): 修復「待分析」死結與 Telegram 訊息截斷
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 30m25s

問題 1:REQUEST_REVISION → 待分析
  根因:safe_candidates=[] → selected=None → recommended_action=None
        → decision_manager action="" → TG 卡顯示「待分析」(資訊流斷裂)
  修復 coordinator_agent.py:
    無安全候選時回退至 Solver 原始最優方案
    標記「[Reviewer 未核准,僅供參考] {action}」
    SRE 永遠能看到 AI 建議,資訊流絕不中斷

問題 2:debate_summary 在 (blast_radius... 中間截斷顯示 (bl
  根因:root_cause=reasoning[:150] — 150 字元對中文 debate_summary 過短
  修復 decision_manager.py:
    root_cause 截斷 150 → 300
    suggested_action 截斷 80 → 120

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-17 11:09:41 +08:00
parent 00e9fb8d4b
commit 0388e50d0e
2 changed files with 22 additions and 3 deletions

View File

@@ -133,9 +133,28 @@ class CoordinatorAgent(BaseAgent):
if c.action not in verdict.blocked_actions
]
selected = safe_candidates[0] if safe_candidates else None
# 2026-04-17 ogt + Claude Sonnet 4.6: 無安全候選 → 回退 Solver 原始最優方案
# 根因safe_candidates=[] → selected=None → recommended_action=None
# → decision_manager action="" → TG 卡顯示「待分析」(資訊流斷裂)
# 修復:強制輸出 Solver 原始最優建議(標記 [Reviewer 未核准,僅供參考]
# 資訊流絕不可斷SRE 永遠需要看到 AI 的建議作為參考依據
_all_blocked = (selected is None and bool(plan.candidates))
if selected is None and plan.top_candidate:
selected = plan.top_candidate
base_confidence = selected.confidence if selected else 0.0
if selected:
_recommended = (
f"[Reviewer 未核准,僅供參考] {selected.action}"
if _all_blocked
else selected.action
)
else:
_recommended = "(無可用方案,請人工研判根因後執行)"
return DecisionPackage(
recommended_action=selected.action if selected else None,
recommended_action=_recommended,
confidence=base_confidence,
requires_human_approval=True,
debate_summary=_build_summary(diagnosis, plan, verdict, critic),

View File

@@ -353,8 +353,8 @@ async def _push_decision_to_telegram(
approval_id=approval_id,
risk_level=risk_level,
resource_name=target[:50],
root_cause=reasoning[:150] if reasoning else description[:150],
suggested_action=action[:80] if action else "待分析",
root_cause=reasoning[:300] if reasoning else description[:300],
suggested_action=action[:120] if action else "待分析",
estimated_downtime="5-15 min",
primary_responsibility="INFRA",
confidence=confidence,