feat(adr100): surface replay execution gate
This commit is contained in:
@@ -1,3 +1,62 @@
|
||||
## 2026-06-02|ADR-100 ready-for-replay Replay Gate 可視化
|
||||
|
||||
**背景**:
|
||||
|
||||
- Production `/api/v1/ai/slo` 目前仍有 ADR-100 補救工作 `8` 筆,其中 `ready_for_replay` 有 `2` 筆:`INC-20260601-1B3388` / `GiteaDown` 與 `INC-20260601-B51DFD` / `DockerContainerUnhealthy`。
|
||||
- 既有 Work Items 只能做 read-only dry-run,operator 看得到 `mcp:ssh_diagnose`,但看不到下一步是否已具備 write executor、是否要 approval、是否真的會寫 `auto_repair_executions`。
|
||||
- 本階段不直接執行 runtime repair、不更新 incident state、不回填舊 auto-repair result,避免把 replay preflight 誤宣稱為 `verified_success`。
|
||||
|
||||
**Production 現況驗證(變更前)**:
|
||||
|
||||
- `verification:INC-20260601-1B3388:7d73ac5f-6224-4fa4-8ec8-96622b51f739` dry-run:
|
||||
- `mode=replay`、`allowed=true`、`executed=true`、`verification_result_preview=degraded`
|
||||
- `mcp_route=auto_repair_executor/ssh_diagnose/read`
|
||||
- `writes_incident_state=false`、`writes_auto_repair_result=false`
|
||||
- history recorded:`alert_operation_id=df52f951-a68c-49e5-844d-72c64ec80999`、`timeline_event_id=583e25be-a9b8-469a-b171-a92d822bef6b`
|
||||
- `verification:INC-20260601-B51DFD:c9635db3-ec54-405f-a909-7e6371775676` dry-run:
|
||||
- `mode=replay`、`allowed=true`、`executed=true`、`verification_result_preview=failed`
|
||||
- `mcp_route=auto_repair_executor/ssh_diagnose/read`
|
||||
- current-state tools:`prometheus_query`、`prometheus_query_range`、`ssh_diagnose`、`ssh_get_container_status`、`ssh_get_top_processes`
|
||||
- history recorded:`alert_operation_id=ad847006-d2d2-4d0a-b68c-0c13e09d4927`、`timeline_event_id=882030aa-7b00-45e8-96b5-9d16a5e51640`
|
||||
|
||||
**本次調整**:
|
||||
|
||||
- `apps/api/src/services/auto_repair_service.py`:
|
||||
- 新增 `preview_write_ssh_mcp_route()`,只預覽 legacy SSH repair step 是否可走 `ssh_docker_restart/write` MCP Gateway。
|
||||
- 不投影 Gate 5 approval、不呼叫 MCP、不執行 Docker restart、不寫 DB。
|
||||
- `apps/api/src/services/adr100_remediation_service.py`:
|
||||
- replay dry-run 新增 `replay_gate`,讀取 PlayBook repair steps 並判斷:
|
||||
- `runtime_replay_ready`
|
||||
- `approval_required`
|
||||
- `blocked_playbook_not_found`
|
||||
- `blocked_observe_only_playbook`
|
||||
- `blocked_unsupported_write_route`
|
||||
- `replay_gate` 會寫入 dry-run history context,讓 AwoooP history/API/frontend 可追同一個 gate 判斷。
|
||||
- payload 明確保留 `execution_authorized=false`、`repair_executed=false`、`writes_incident_state=false`、`writes_auto_repair_result=false`。
|
||||
- `apps/web/src/app/[locale]/awooop/work-items/page.tsx`:
|
||||
- ADR-100 補救工作結果新增 `Replay Gate` 區塊,顯示 status、next step、write route/unsupported 數量,以及 authorized/executed 狀態。
|
||||
- `apps/web/messages/zh-TW.json` / `en.json`:
|
||||
- 新增 `replayGate` 文案;英文語系維持繁中文案鏡像。
|
||||
|
||||
**驗證**:
|
||||
|
||||
- `python3 -m py_compile apps/api/src/services/adr100_remediation_service.py apps/api/src/services/auto_repair_service.py apps/api/tests/test_adr100_remediation_service.py`
|
||||
- `DATABASE_URL=postgresql://test:test@localhost:5432/test PYTHONPATH=apps/api /Users/ogt/.pyenv/shims/pytest apps/api/tests/test_adr100_remediation_service.py -q` → `13 passed`
|
||||
- `DATABASE_URL=postgresql://test:test@localhost:5432/test PYTHONPATH=apps/api /Users/ogt/.pyenv/shims/pytest apps/api/tests/test_auto_repair_service.py -q` → `29 passed`
|
||||
- `python3 -m json.tool apps/web/messages/zh-TW.json` / `apps/web/messages/en.json` / `cmp -s`
|
||||
- `pnpm install --offline --frozen-lockfile`(clean worktree dependency setup only)
|
||||
- `pnpm --dir apps/web exec tsc --noEmit --tsBuildInfoFile /tmp/awoooi-ready-replay-gate.tsbuildinfo`
|
||||
- `NEXT_PUBLIC_API_URL=https://awoooi.wooo.work NEXT_PRIVATE_BUILD_WORKER_COUNT=1 pnpm --dir apps/web run build`
|
||||
- `git diff --check`
|
||||
- `python3 scripts/security/security-mirror-progress-guard.py --root .` → `SECURITY_MIRROR_PROGRESS_GUARD_OK`
|
||||
|
||||
**目前整體進度(本階段完成後)**:
|
||||
|
||||
- ADR-100 非成功驗證補救工作項:約 `95%`;`ready_for_replay` 已從只看 read-only dry-run,提升到可判斷 write replay gate / blocked reason / next step。
|
||||
- Approval / execution 誠實度:約 `95%`;前後端會明確顯示 replay 尚未 authorized/executed,也不寫 incident 或 auto-repair result。
|
||||
- 真正 verified auto-repair 成功樣本:仍約 `3-4%`;本階段沒有執行 runtime repair,不能上修這項。
|
||||
- 完整 AI 自動化飛輪總進度:維持 `61%`;下一個上調條件是 `ready_for_replay` 進入受控 write execution,並產生 production `verification_result=success` + KM / learning 回寫。
|
||||
|
||||
## 2026-06-01|IwoooS S4.9 補件草稿詳情層落地
|
||||
|
||||
**背景**:
|
||||
|
||||
Reference in New Issue
Block a user