fix(solver+execution): Checkpoint-1 假成功修復 + Checkpoint-2 K8s 環境感知
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 10m55s
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 10m55s
## Checkpoint-1: 假成功根治 - approval_execution.py: execute_approved_action 改返回 bool (原返回 None,呼叫端無法判斷 K8s 是否接受指令) - decision_manager.py auto-execute 路徑: 用 _exec_success 取代硬編 success=True 修復: K8s 拒絕指令時正確發 ❌ 而非 ✅ 自動修復完成 ## Checkpoint-2: K8s 環境感知 (Inventory Pre-flight) - solver_agent.py: 新增 _fetch_k8s_inventory() — 生成 kubectl 指令前先拉 kubectl get deployments,statefulsets -n awoooi-prod,將真實名稱清單 注入 Solver prompt,LLM 必須從清單選擇,防止幻覺(awooiii-api 三個 i) - 超時 5s 或失敗 → 返回 "",prompt 顯示警示但不中斷主流程 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2040,23 +2040,29 @@ class DecisionManager:
|
||||
incident_id=incident.incident_id, error=str(_mb_err))
|
||||
|
||||
# 執行
|
||||
# 2026-04-17 ogt + Claude Sonnet 4.6 (Checkpoint-1 假成功修復):
|
||||
# 舊 bug: execute_approved_action 返回 None → 此處永遠傳 success=True 給
|
||||
# _push_auto_repair_result → Telegram 顯示 ✅ 自動修復完成,即使 K8s 拒絕了指令
|
||||
# 修復: execute_approved_action 現在返回 bool,正確透傳給通知函數
|
||||
executor = ApprovalExecutionService()
|
||||
await executor.execute_approved_action(approval)
|
||||
_exec_success = await executor.execute_approved_action(approval)
|
||||
|
||||
# 更新狀態
|
||||
token.state = DecisionState.COMPLETED
|
||||
token.proposal_data["auto_executed"] = True
|
||||
token.proposal_data["exec_success"] = _exec_success
|
||||
await self._save_token(token)
|
||||
|
||||
logger.info(
|
||||
"auto_execute_completed",
|
||||
incident_id=incident.incident_id,
|
||||
action=approval.action,
|
||||
exec_success=_exec_success,
|
||||
)
|
||||
|
||||
# 2026-04-09 Claude Sonnet 4.6: 執行成功 → 發 Telegram 結果通知
|
||||
# 2026-04-09 Claude Sonnet 4.6: 執行完成 → 發 Telegram 結果通知(成功或失敗皆發)
|
||||
_fire_and_forget(
|
||||
_push_auto_repair_result(incident, action, success=True)
|
||||
_push_auto_repair_result(incident, action, success=_exec_success)
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user