fix(telegram): separate ssh diagnosis from repair failures
All checks were successful
Code Review / ai-code-review (push) Successful in 11s
CD Pipeline / tests (push) Successful in 1m27s
CD Pipeline / build-and-deploy (push) Successful in 4m19s
CD Pipeline / post-deploy-checks (push) Successful in 1m25s

This commit is contained in:
Your Name
2026-05-06 22:03:19 +08:00
parent 53994e75f0
commit 9dfecc4d1b
5 changed files with 107 additions and 8 deletions

View File

@@ -576,6 +576,7 @@ async def _push_decision_to_telegram(
alert_category=_alert_category,
notification_type=_notification_type,
playbook_name=_playbook_name,
automation_state=proposal_data.get("automation_state", ""),
)
# 2026-04-09 Claude Sonnet 4.6: 存 message_id → 後續狀態更新在原訊息延續
@@ -3519,6 +3520,8 @@ class DecisionManager:
token.proposal_data["decision_state"] = DecisionState.READY.value
token.proposal_data["auto_executed"] = False
token.proposal_data["mcp_all_failed"] = True
if _tool == "ssh_diagnose":
token.proposal_data["automation_state"] = "diagnosis_failed_manual_required"
await self._save_token(token)
_fire_and_forget(
_escalate_decision_auto_repair_unavailable(
@@ -3528,14 +3531,15 @@ class DecisionManager:
attempted_actions=f"decision_manager._ssh_execute -> {_tool}",
)
)
_fire_and_forget(
_push_auto_repair_result(
incident,
action,
success=False,
error=token.error,
if _tool != "ssh_diagnose":
_fire_and_forget(
_push_auto_repair_result(
incident,
action,
success=False,
error=token.error,
)
)
)
_fire_and_forget(_push_decision_to_telegram(incident, token.proposal_data))
return
@@ -3545,6 +3549,7 @@ class DecisionManager:
token.proposal_data["auto_executed"] = False
token.proposal_data["ssh_diagnosis_collected"] = True
token.proposal_data["ssh_diagnosis_preview"] = output_preview
token.proposal_data["automation_state"] = "diagnosis_collected_manual_required"
await self._save_token(token)
_fire_and_forget(
_escalate_decision_auto_repair_unavailable(