fix(agent99): gate reboot recovery on full SOP

This commit is contained in:
ogt
2026-07-11 15:43:08 +08:00
parent 276410fbb6
commit dbbf651f0a
13 changed files with 864 additions and 91 deletions

View File

@@ -1,6 +1,6 @@
# Agent99 全域 AI 自動化主計畫
> 建立時間2026-07-10 15:05 CST最近更新2026-07-11 10:12 CST
> 建立時間2026-07-10 15:05 CST最近更新2026-07-11 15:35 CST
> 狀態P0 執行中,尚未達成全域 AI 自動化
> 機器可讀總帳:`docs/operations/agent99-enterprise-ai-automation-work-items.snapshot.json`
> 歷史需求來源:`docs/workplans/2026-07-02-commander-inserted-requirements-priority-ledger.md`
@@ -34,7 +34,7 @@
| --- | --- | --- |
| 192.168.0.99 | Windows、VMware Workstation、Task Scheduler、PowerShell/OpenSSH、Agent99 | Windows/VMware 狀態、VM inventory/autostart、Windows Update 政策、桌面與命令入口、全程 audit |
| 192.168.0.110 | Gitea、Gitea Actions runner、Docker、Harbor/Registry、Prometheus、Alertmanager、Sentry、backup | Source/CD/registry/observability 恢復、CPU/queue 降載、備份與 restore verifier |
| 192.168.0.111 | 必要 VMware guest目前角色與 verified VMX inventory 未完整 | 補 role manifest、VMX、boot/uptime/SSH/exporter、autostart 與服務 verifier |
| 192.168.0.111 | M1 Pro MacBook / Local Ollama 實體節點,不是 VMware guest | 由 110 restricted forced-command 讀回 Darwin boot/uptime、LaunchAgent 與 Ollama不得要求 VMX 或 VM power |
| 192.168.0.112 | Kali / IWOOOS 安全節點 | 開機、SSH、安全工具健康、受控調查與 AISOC evidence禁止外部攻擊型掃描自動化 |
| 192.168.0.120 | K3s control plane、VIP、AWOOOI workloads | node/pod/rollout/image-pull/cron/Velero 恢復與 verifier |
| 192.168.0.121 | K3s peer、DR drill | peer readiness、workload balance、DR/Velero drill 與 verifier |
@@ -87,12 +87,14 @@
## 5. 更新後的唯一執行順序
2026-07-11 事故優先序覆寫後,機器可讀執行順序固定為:`AG99-P0-007 → P0-008 → P0-009 → P0-010 → P0-003 → P0-004 → P0-005 → P0-006 → P0-011 → P0-012 → P0-013 → P0-014`。下表的數字是穩定 work-item ID不再被誤當目前執行順位`next_execution_order` 才是 runtime projection 的唯一順位來源,且必須包含每個未完成 P0 恰好一次。
### Wave 0先修正 AI 決策真相
| 順序 | ID | 工作 | 狀態 | 驗收 |
| --- | --- | --- | --- | --- |
| 1 | AG99-P0-001 | 修正 `exitCode=0 => resolved` 假綠,對齊 99 runtime script 與 Gitea source SHA | **完成** | Production 99 outcome self-test 通過runtime manifest `7/7` matched、drift `0`operator replay 為 verified resolvedalert replay 缺 source-event resolved 時維持 verifying |
| 2 | AG99-P0-002 | 修正 alert taxonomy、wrong-domain routing、bridge-before-grouping、actionable Telegram card 漏接與重複事件 | **進行中current P0source/test 綠99 runtime 待部署** | Alertmanager、AI card、ACTION REQUIRED、CI/CD failure 共用 dispatcher`suggestedMode`/kind 優先5 分鐘先 group同 fingerprint 只建立一個 active incident保留 acceptance receipt |
| 2 | AG99-P0-002 | 修正 alert taxonomy、wrong-domain routing、bridge-before-grouping、actionable Telegram card 漏接與重複事件 | **完成99 runtime `34e32f6e`、14/14 matched** | Alertmanager、AI card、ACTION REQUIRED、CI/CD failure 共用 dispatcher`suggestedMode`/kind 優先5 分鐘先 group同 fingerprint 只建立一個 active incident保留 acceptance receipt |
| 3 | AG99-P0-003 | 強化 ingressrelay token 必填、Telegram chat+sender allowlist、idempotency/single consumer | 待辦 | 未認證 LAN request 拒絕producer `auto_repair`/policy 被保留;所有 request 可追 trace |
| 4 | AG99-P0-004 | 新增 EvidenceCollect / RepairCandidate / MCP lane | 待辦 | 缺 evidence 的事件會建立可查 candidate不再錯送 Perf/AwoooRepair`INC-*` 可從收件追到 candidate |
@@ -102,8 +104,8 @@
| --- | --- | --- | --- | --- |
| 5 | AG99-P0-005 | 模式專屬 verifier、真 rollback、cooldown/circuit-breaker | 待辦 | Recover/Perf/LoadShed/Harbor/AWOOOI/backup/provider 各有 post-condition失敗不寫成功 cooldown |
| 6 | AG99-P0-006 | Agent99 → AWOOOI/AwoooP/IWOOOS completion callback | 待辦 | incident/Run/Work Item/Verifier/recurrence 同一 trace 收斂Telegram 可讀回報只從結果物件產生 |
| 7 | AG99-P0-007 | 全主機 10 分鐘 reboot state machine | 進行中,live readiness 60% | boot_id/uptime/VM power 建立 reboot event依 dependency DAG 恢復;首可用/全綠時間與 blocker/ETA 可查 |
| 8 | AG99-P0-008 | 99 VMware/VMX/autostart/lock 與 Windows Update no-auto-reboot | 進行中 | 111/112/120/121/188 VMX inventory、開機順序、lock repair、guest running、政策 drift 全部 verifier green |
| 7 | AG99-P0-007 | 全主機 10 分鐘 reboot state machine | **進行中,current P0Agent99 coordinator source/test 綠、99 runtime 待 promote** | boot_id/uptime/VM power 建立 reboot eventAgent99 必須關聯 110 同輪 full-SOP scorecard;首可用/全綠時間與 blocker/ETA 可查 |
| 8 | AG99-P0-008 | 99 VMware/VMX/autostart/lock 與 Windows Update no-auto-reboot | **baseline live green真實 reboot 驗收併入 P0-007** | 110/188/112/120/121 VMX、autostart task、guest running 與 no-auto-reboot verifier green111 由實體 Mac readback 驗證 |
### Wave 2擴至所有產品與運維面
@@ -162,6 +164,15 @@
- Production health 仍為 `degraded`API/PostgreSQL/Redis/OpenClaw 可用SignOz downGCP-A Ollama timeoutGCP-B/local fallback 可用。
- Reboot SLO live scorecard 為 `blocked_reboot_auto_recovery_slo_not_ready`、readiness 33%、24 blockers不得宣稱全主機 10 分鐘恢復完成。
### 2026-07-11 15:35 Agent99 × reboot SOP 優先序校正
- Windows 99 live preflight 回傳 `9/9` 核心 scheduled tasks healthy、SRE relay `8787` listening、alert incoming `0`、command pending `0`、7 類必要 evidence freshruntime manifest 是 `sourceRevision=34e32f6ed6f29952181cd7aa43ca19210d25339b``runtimeMatched=true``14/14` matched。這關閉 AG99-P0-002 的 runtime 部署缺口,但不代表 Agent99 全自動化完成。
- 最新 live `Recover` evidence 原本只含 `vm_start / host_reachability / harbor_registry / k3s_workloads / public_routes` 五階段10.4 秒即寫 `withinSlo=true`;它未納入 111、fresh reboot event、產品資料、備份、188 hygiene、edge fallback 與 full scorecard屬於 false-completion 設計缺口。
- 新 source 已加入 `recoveryCoordinator`:直接讀 110 最新 bounded artifact 的 `summary.txt``host-probe.txt`、maintenance/VMware readback 與 scorecard safe fields。一般服務修復必須通過 7 host、service/data/backup、188 hygiene、edge fallback、VMware/Windows policy若 99 剛開機,還必須 artifact fresh、fresh reboot window、active blocker `0``can_claim_slo=true`
- 新 PowerShell staged validation、contract 與 synthetic fixture 已通過fresh 7-host fixture 可 verified`can_claim_slo` 改成 `0` 或 blocker 改成 `3` 會 fail-closed。Python focused contract `6 passed`、Agent99 API contract `45 passed`、完整 reboot-recovery suite `131 passed`
- 110 最新 direct artifact `/home/wooo/reboot-recovery/reboot-auto-recovery-slo-20260711-151841` 顯示 7 host reachable、`GREEN_WITH_EVIDENCE_WARNINGS`、service/data/backup/188 hygiene/edge/VMware green目前唯三 scorecard blockers 是尚未發生新一輪全主機 reboot window。Production API 仍混入舊 111 snapshot因此 Agent99 verifier 固定以 110 direct artifact 優先API 只作次級投影。
- current P0 改為 `AG99-P0-007`。下一步固定為:建立 local commit、原子 promote 到 99、跑 production-principal `Recover` baseline 與 live preflight、確認舊五階段不能再單獨 resolved然後執行已獲批准的真實全主機 reboot drill。main push 仍服從單一 writer slot。
## 7. 工作項強制欄位與治理
每個工作項必須先有:`id`、priority/order/status、scope、owner lane、dependencies、acceptance 與 next action。任何工作項升到 `candidate_ready``in_progress``executing` 前,還必須補齊 problem、trigger、evidence sources、AI role、action mode、controlled actions、prohibited actions、rollback、mode-specific verifier、callback、evidence refs 與 last update缺一不可執行。
@@ -177,4 +188,4 @@
## 8. 立即下一步
目前唯一 P0 `AG99-P0-002`source/test candidate 已完成 Alertmanager 與 Telegram actionable card 共用 dispatcher、acceptance receipt、cold-start/CI-CD taxonomy、resolution policy 與 synthetic relay smoke。下一步依序是完成 Gitea source receipt等待單一視窗 CD 協調;原子部署測試過的 Agent99 package 到 99驗證 runtime manifest;以 do-not-page 重播 ACTION REQUIRED cold-start、CI/CD failure、backup、provider、PostgreSQL、host、K3s corpus讀回 Agent99 evidence、source-event closure 與 outbound envelope receipt。完成前只能標示 source green/runtime pending。其後再依序做 secure ingress、RepairCandidatemode verifier/callback最後回到 reboot state machine live rerun
目前唯一 P0 是 `AG99-P0-007`先把已測試的 `recoveryCoordinator` 以 local commit SHA 原子 promote 到 99驗證 runtime manifest、9/9 tasks、production-principal Recover evidence 與 full-SOP coordinator outcome再執行一次真實全主機 reboot drill要求 T+0 偵測、T+10 前 VM/host/service/route/data/backup/version/maintenance/verifier 同輪收斂。P0-007 terminal 後依序回到 `AG99-P0-003 secure ingress → P0-004 EvidenceCollect/RepairCandidate → P0-005 mode verifier/rollback → P0-006 callback`,再推外部 watcher、全產品版本矩陣、logs、backup、performance 與 Gitea/Harbor DR。main push 只在唯一 writer slot 進行;沒有 slot 時保留 local commit不得用推送協調打斷 runtime 主線