fix(alerts): 補齊審批終局處置結論
Some checks failed
CD Pipeline / tests (push) Successful in 1m27s
Code Review / ai-code-review (push) Successful in 13s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled

This commit is contained in:
Your Name
2026-05-31 16:13:26 +08:00
parent ff9c939278
commit 921af1c4c2
8 changed files with 236 additions and 0 deletions

View File

@@ -406,6 +406,14 @@ def _truth_status(
stage_status = "waiting"
needs_human = True
blockers.append("pending_human_approval")
elif "EXPIRED" in approval_statuses and not has_execution_records:
stage = "approval_expired"
stage_status = "expired"
needs_human = True
blockers.append("approval_expired_without_operator_decision")
elif "REJECTED" in approval_statuses and not has_execution_records:
stage = "approval_rejected"
stage_status = "closed"
elif "EXECUTION_FAILED" in approval_statuses and not has_execution_records:
stage = "execution_failed"
stage_status = "error"
@@ -546,6 +554,10 @@ def build_automation_quality(
if any(status in {"PENDING", "WAITING_APPROVAL"} for status in approval_statuses):
gate("approval_state", "warning", "waiting_approval")
elif "EXPIRED" in approval_statuses and not has_execution:
gate("approval_state", "warning", "expired_without_execution")
elif "REJECTED" in approval_statuses and not has_execution:
gate("approval_state", "passed", "rejected_no_execution")
elif approval_statuses and approval_suppressed and not has_execution:
gate("approval_state", "warning", "approved_diagnostic_or_observe_only")
elif approval_statuses and (approval_no_action or "NO_ACTION" in approval_actions) and not has_execution:
@@ -588,6 +600,10 @@ def build_automation_quality(
verdict = "auto_repaired_verification_degraded"
elif has_execution:
verdict = "execution_unverified"
elif "EXPIRED" in approval_statuses:
verdict = "approval_expired_manual_review"
elif "REJECTED" in approval_statuses:
verdict = "approval_rejected_no_execution"
elif approval_suppressed:
verdict = "manual_required_diagnostic_only"
elif approval_statuses and (approval_no_action or "NO_ACTION" in approval_actions):

View File

@@ -142,6 +142,20 @@ def build_operator_outcome(
next_action = "manual_review_no_action_decision"
summary = "AI 選擇不執行修復,需人工判斷是否接手"
reason = first_blocker or "no_action_or_observe"
elif verdict == "approval_rejected_no_execution" or stage == "approval_rejected":
state = "approval_rejected_no_execution"
severity = "info"
needs_human = False
next_action = "monitor_or_reopen_if_alert_recurs"
summary = "已拒絕處置,未執行修復"
reason = first_blocker or "approval_rejected"
elif verdict == "approval_expired_manual_review" or stage == "approval_expired":
state = "approval_expired_manual_review"
severity = "warning"
needs_human = True
next_action = "reopen_close_or_escalate_expired_approval"
summary = "審批已逾期,需人工重新審查"
reason = first_blocker or "approval_expired"
elif remediation_state == "read_only":
state = "read_only_dry_run_manual_gate"
severity = "warning"

View File

@@ -3533,6 +3533,12 @@ def _build_awooop_status_chain(
if verdict == "auto_repaired_verified":
repair_state = "auto_repaired_verified"
next_step = "monitor_for_regression"
elif verdict == "approval_rejected_no_execution":
repair_state = "approval_rejected_no_execution"
next_step = "monitor_or_reopen_if_alert_recurs"
elif verdict == "approval_expired_manual_review":
repair_state = "approval_expired_manual_review"
next_step = "reopen_close_or_escalate_expired_approval"
elif has_repair_execution:
repair_state = (
"executed_pending_verification"