fix(api): 移除 Consensus Engine 假信心分數

🔴 違反鐵律: feedback_confidence_truthfulness.md
Expert System 必須 confidence = 0.0,禁止假裝 AI 仲裁

修正:
- SREAgent: 0.85/0.80/0.75/0.60 → 0.0
- SecurityAgent: 0.70/0.85 → 0.0
- CostAgent: 0.75 → 0.0
- PerformanceAgent: 0.80/0.70 → 0.0

所有規則匹配現在正確顯示為「⚙️ 規則匹配」而非「🤖 AI 仲裁」

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-03-29 15:57:04 +08:00
parent 89a2339796
commit 19b00a1ca0

View File

@@ -196,22 +196,22 @@ class SREAgent(ExpertAgent):
if any(kw in alert_names for kw in ["crash", "restart", "oom", "killed"]):
action = "重新啟動服務以恢復穩定性"
kubectl = f"kubectl rollout restart deployment/{target} -n awoooi-prod"
confidence = 0.85
confidence = 0.0 # 🔴 規則匹配,非 AI 分析
risk = "medium"
elif any(kw in alert_names for kw in ["latency", "slow", "timeout"]):
action = "擴展副本數以分散負載"
kubectl = f"kubectl scale deployment/{target} --replicas=3 -n awoooi-prod"
confidence = 0.80
confidence = 0.0 # 🔴 規則匹配,非 AI 分析
risk = "low"
elif any(kw in alert_names for kw in ["cpu", "memory", "resource"]):
action = "調整資源限制或擴展副本"
kubectl = f"kubectl scale deployment/{target} --replicas=2 -n awoooi-prod"
confidence = 0.75
confidence = 0.0 # 🔴 規則匹配,非 AI 分析
risk = "medium"
else:
action = "進行安全重啟以排除未知問題"
kubectl = f"kubectl rollout restart deployment/{target} -n awoooi-prod"
confidence = 0.60
confidence = 0.0 # 🔴 規則匹配,非 AI 分析
risk = "medium"
return AgentOpinion(
@@ -250,11 +250,11 @@ class SecurityAgent(ExpertAgent):
if security_concerns:
action = "建議先隔離受影響服務,啟用 NetworkPolicy 限制"
confidence = 0.70
confidence = 0.0 # 🔴 規則匹配,非 AI 分析
risk = "critical"
else:
action = "無明顯資安風險,建議 SRE 處理"
confidence = 0.85
confidence = 0.0 # 🔴 規則匹配,非 AI 分析
risk = "low"
return AgentOpinion(
@@ -289,7 +289,7 @@ class CostAgent(ExpertAgent):
agent_type=self.agent_type,
action=action,
reasoning="FinOps 分析: 使用 HPA 可在負載降低後自動縮減,相比固定擴容可節省約 40% 成本",
confidence=0.75,
confidence=0.0, # 🔴 規則匹配,非 AI 分析
risk_assessment="成本風險: low使用 HPA 可自動調節",
kubectl_command=kubectl,
priority=4,
@@ -313,11 +313,11 @@ class PerformanceAgent(ExpertAgent):
if any(kw in alert_names for kw in ["latency", "p99", "slow"]):
action = "建議增加資源限制並啟用 PodDisruptionBudget"
kubectl = f"kubectl patch deployment/{target} -n awoooi-prod -p '{{\"spec\":{{\"template\":{{\"spec\":{{\"containers\":[{{\"name\":\"{target}\",\"resources\":{{\"limits\":{{\"cpu\":\"2\",\"memory\":\"2Gi\"}}}}}}]}}}}}}}}'"
confidence = 0.80
confidence = 0.0 # 🔴 規則匹配,非 AI 分析
else:
action = "當前效能指標正常,建議觀察"
kubectl = None
confidence = 0.70
confidence = 0.0 # 🔴 規則匹配,非 AI 分析
return AgentOpinion(
agent_type=self.agent_type,