fix(agents): align reports with controlled autonomy
Some checks failed
Code Review / ai-code-review (push) Successful in 20s
CD Pipeline / tests (push) Successful in 1m36s
CD Pipeline / build-and-deploy (push) Successful in 5m46s
CD Pipeline / post-deploy-checks (push) Successful in 1m29s
Ansible / Reboot Recovery Contract / validate (push) Has been cancelled

This commit is contained in:
Your Name
2026-06-26 23:40:24 +08:00
parent aa1e79ba54
commit 4013c6a1ad
15 changed files with 189 additions and 99 deletions

View File

@@ -58,8 +58,10 @@ def load_latest_ai_technology_report_cadence_readback(
raise ValueError(f"{snapshot_path}: unsafe policy flags: {forbidden_true}")
if policy.get("read_only") is not True:
raise ValueError(f"{snapshot_path}: read_only policy must be true")
if policy.get("high_risk_owner_review_required") is not True:
raise ValueError(f"{snapshot_path}: high risk owner review must remain required")
if policy.get("high_risk_owner_review_required") is not False:
raise ValueError(f"{snapshot_path}: high risk owner review must remain disabled")
if policy.get("low_medium_high_controlled_auto_route_enabled") is not True:
raise ValueError(f"{snapshot_path}: low/medium/high controlled auto route must remain enabled")
summary = payload.get("summary") or {}
zero_fields = [

View File

@@ -526,7 +526,7 @@ class FailureWatcherService(IFailureWatcher):
規則:
- 同一資源 5 分鐘內最多修復 3 次
- 超過則升級為 MEDIUM 風險,請求人工授權
- 超過則升級為 MEDIUM 風險,排入 AI 受控重試 / rollback / verifier
Returns:
True 如果可以自動修復False 如果超過限制
@@ -672,7 +672,7 @@ class FailureWatcherService(IFailureWatcher):
return "clear_cache"
if any(kw in action_lower for kw in ["scale", "擴展", "增加"]):
return "scale_up" # 需人工授權
return "scale_up" # 交由受控策略檢查副本上下限與回滾
# 無法自動執行,返回原始建議
return recommended_action[:50]
@@ -719,7 +719,7 @@ class FailureWatcherService(IFailureWatcher):
analysis: dict,
reason: str,
) -> None:
"""請求人工授權 (推送到 Telegram + 前端)"""
"""排入 AI 受控修復後續 (推送到 Telegram + 前端)"""
try:
# 推送到 Redis (前端 WebSocket 訂閱)
redis = get_redis()