From 0388e50d0e8300b281d69e98f2fbc55cf74f75ab Mon Sep 17 00:00:00 2001 From: OG T Date: Fri, 17 Apr 2026 11:09:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(p1-backlog):=20=E4=BF=AE=E5=BE=A9=E3=80=8C?= =?UTF-8?q?=E5=BE=85=E5=88=86=E6=9E=90=E3=80=8D=E6=AD=BB=E7=B5=90=E8=88=87?= =?UTF-8?q?=20Telegram=20=E8=A8=8A=E6=81=AF=E6=88=AA=E6=96=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 問題 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 --- apps/api/src/agents/coordinator_agent.py | 21 ++++++++++++++++++++- apps/api/src/services/decision_manager.py | 4 ++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/apps/api/src/agents/coordinator_agent.py b/apps/api/src/agents/coordinator_agent.py index ad21d908..739172e7 100644 --- a/apps/api/src/agents/coordinator_agent.py +++ b/apps/api/src/agents/coordinator_agent.py @@ -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), diff --git a/apps/api/src/services/decision_manager.py b/apps/api/src/services/decision_manager.py index 3deb040f..5fb4811a 100644 --- a/apps/api/src/services/decision_manager.py +++ b/apps/api/src/services/decision_manager.py @@ -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,