fix(api): record approval gate timeline events
Some checks failed
CD Pipeline / tests (push) Successful in 1m25s
Code Review / ai-code-review (push) Successful in 15s
CD Pipeline / build-and-deploy (push) Successful in 4m12s
CD Pipeline / post-deploy-checks (push) Failing after 11s

This commit is contained in:
Your Name
2026-06-04 15:26:56 +08:00
parent 6be8dfa0f5
commit 1ae8f809af
6 changed files with 277 additions and 4 deletions

View File

@@ -94,14 +94,16 @@
| 欄位 | 內容 |
| --- | --- |
| 優先級 | P0 |
| 狀態 | 盤點中SLO 已回綠,流程斷點已定位,待修 timeline / Telegram / gate 對照 |
| 本階段完成度 | 38% |
| 狀態 | 修復中:新建 approval gate 已寫入 raw timeline event 並通過本地測試,待正式站 rollout / page smoke |
| 本階段完成度 | 48% |
| 目標完成度 | 完整 AI 自動化飛輪 69% → 75% |
細項:
- [x]`auto_execute_success_rate` SLO 違反原因,對照最近自動修復任務。
- [x] 盤點流程是否真跑完alert ingest → classify → rule match → MCP evidence → PlayBook → approval gate → Ansible/repair → verifier → KM → postmortem。
- [ ] timeline event每個 incident 必須看到 stage、handler、AI action、manual need
- [x]新建 approval gate raw timeline event同一 transaction 寫入 `stage``next_action``blocked_reason``auto_or_manual``needs_human`、risk 與 signature 狀態
- [ ] 補既有 pending approval 歷史 backfill / production smoke確認正式站同一 incident 不再出現 `timeline_missing_for_approval`
- [ ] 補 executor / verifier / KM 狀態變更事件:每個 incident 必須看到 stage、handler、AI action、manual need。
- [ ] Telegram 告警補 stage、next action、blocked reason、auto/manual。
- [ ] 建立風險分級與 approval gate 對照表,釐清中低風險是否允許 AI 自動修復。
- [ ] 確認 MCP / 自建 MCP 實際 tool call、evidence、result 有被前端顯示;目前 Runs 表格可見 MCP summary但 result / blocker 還不夠一眼可讀。
@@ -116,9 +118,11 @@ Live evidence
- Production `/api/v1/platform/ai-route-status?workload_type=deep_rca`policy order 為 `ollama_gcp_a → ollama_gcp_b → ollama_local → gemini`,目前 selected provider `ollama_gcp_a`Gemini 仍是 final fallback。
- Browser smoke`/zh-TW/awooop/runs?project_id=awoooi` 表格載入 50 列,含 `INC-20260603-9B2535` 與 MCP 摘要,`horizontalOverflow=0`Automation Flow Gate 顯示 28 件、8 個 blocked gate、verified auto repair 0。
- Browser smoke`/zh-TW/awooop/work-items``/zh-TW/awooop/approvals` 可開且 `horizontalOverflow=0`,但未直接浮出 `INC-20260603-9B2535` / `INC-20260601-1B3388` 的可操作下一步。
- Local code verification`ApprovalDBService.create_approval()``create_approval_with_fingerprint()``IncidentApprovalService.create_with_approval()` 會在建立 approval 後追加 raw `timeline_events`,描述包含 `stage``next_action``blocked_reason``auto_or_manual``needs_human`
- Local tests`test_approval_timeline_event.py` 覆蓋 pending manual gate 與 low-risk auto gate`test_awooop_truth_chain_service.py` 覆蓋有 raw timeline event 時不再標記 `timeline_missing_for_approval`
驗收:
- [ ] DB / API / browser 都能查到同一 incident 的 stage timeline。
- [ ] DB / API / browser 都能查到同一 incident 的 stage timeline本地程式與單元測試已過production rollout 後需補實際 incident page smoke
- [ ] Telegram 訊息可不開前端判斷目前流程狀態。
- [ ] 低風險自動修復權限與人工 gate 條件有可驗證表格。