From 79c34c4cf95519b99df918f9e1408986f0064c4d Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 31 May 2026 16:55:48 +0800 Subject: [PATCH] docs(logbook): record awooop truth chain drilldown [skip ci] --- docs/LOGBOOK.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/docs/LOGBOOK.md b/docs/LOGBOOK.md index 65f0f1229..af25cd6d6 100644 --- a/docs/LOGBOOK.md +++ b/docs/LOGBOOK.md @@ -1,3 +1,78 @@ +## 2026-05-31|AwoooP 真相鏈 Ansible 證據與 Run 詳情 500 修復 + +**背景**: + +- 使用者指出 Telegram 告警、詳情、歷史與前端頁面必須清楚呈現「跑到哪個流程、是否 AI 自動處理、是否真的執行修復、是否需要人工介入」。 +- MOMO PostgreSQL backup 已完成受控 Ansible apply,但 AwoooP status-chain / Telegram detail-history 只顯示部分脈絡,沒有把 check/apply/rc/approval_source 這些關鍵證據完整浮出。 +- production 驗證時發現 `/api/v1/platform/runs/list?...&incident_id=INC-20260531-D6A3C4` 會因大量 run context 查詢撞到 asyncpg bind 參數上限而回 500,導致前端 Run drill-down 與「詳情 / 歷史」可視性不穩。 + +**本次調整**: + +- `awooop_ansible_audit_service` 新增 Ansible execution summary,將 `automation_operation_log` 的 `catalog_id`、`execution_mode`、`check_mode_executed`、`apply_enabled`、`apply_executed`、`returncode`、`approval_source` 彙整成 `execution.ansible`。 +- `platform_operator_service` / `telegram_gateway` / 前端 `AwoooPStatusChainPanel` 同步顯示 PlayBook / Ansible 證據:check/apply 數、最新 operation/status、rc、catalog、playbook path、controlled apply 與 approval source。 +- `runs/list` 的 sidecar event/context 查詢改為 500 runs 一批,避免單次 SQL `IN (...)` 參數超過 asyncpg 32767 上限;新增回歸測試鎖住最壞情境參數量。 +- 本輪仍只宣稱「使用者批准後的 controlled apply 證據已接入」,不可宣稱 24h 完整 autonomous auto-repair 已達成。 + +**提交與部署**: + +```text +497e36ba fix(awooop): surface ansible apply proof +aee92bc7 fix(awooop): chunk run context lookups +7894156d chore(cd): deploy aee92bc [skip ci] +``` + +**驗證**: + +```text +python3 -m py_compile platform_operator_service.py / telegram_gateway.py / truth_chain / tests + -> pass +cd apps/api && ruff check --select E9,F401,F821,F841 ... + -> pass +DATABASE_URL=postgresql+asyncpg://test:test@localhost:5432/test pytest \ + test_telegram_message_templates.py \ + test_awooop_operator_timeline_labels.py \ + test_awooop_truth_chain_service.py -q + -> 156 passed +NEXT_PUBLIC_API_URL=https://awoooi.wooo.work pnpm --dir apps/web run build + -> pass +kubectl -n awoooi-prod rollout status deploy/awoooi-api / awoooi-web / awoooi-worker + -> successfully rolled out +production image: + awoooi-api 192.168.0.110:5000/awoooi/api:aee92bc7a30c6d9f8857df2799604fa065092aa9 + awoooi-web 192.168.0.110:5000/awoooi/web:aee92bc7a30c6d9f8857df2799604fa065092aa9 + awoooi-worker 192.168.0.110:5000/awoooi/api:aee92bc7a30c6d9f8857df2799604fa065092aa9 +production health: + status=healthy, environment=prod, mock_mode=false + ollama_route_order=["ollama_gcp_a","ollama_gcp_b","ollama_local"] +production runs/list: + /api/v1/platform/runs/list?project_id=awoooi&incident_id=INC-20260531-D6A3C4&page=1&per_page=5 + -> HTTP 200, total=5 +production status-chain: + source_id=INC-20260531-D6A3C4 + repair_state=executed + ansible.record_total=6 + ansible.check_mode_total=3 + ansible.apply_total=1 + ansible.applied_success_total=1 + ansible.controlled_apply=true + ansible.latest_operation_type=ansible_apply_executed + ansible.latest_status=success + ansible.latest_catalog_id=ansible:188-momo-backup-user + ansible.latest_playbook_path=infra/ansible/playbooks/188-momo-backup-user.yml + ansible.latest_execution_mode=controlled_apply + ansible.latest_returncode=0 + ansible.latest_apply_executed=true + ansible.approval_source=user_chat_approved_continue +``` + +**目前整體進度**: + +- MOMO PostgreSQL backup 接入 AwoooP failure-notify / Ansible controlled apply:100%。 +- AwoooP truth-chain / status-chain 對 Ansible apply 證據可視化:約 98%。 +- Telegram detail/history 與前端 Run drill-down 穩定性:約 96%。 +- MCP / Sentry / SigNoz / KM / PlayBook / Ansible 的單一流程透明度:約 69%;仍需把每筆告警的 source refs、matching logs、MCP calls、PlayBook 建議、KM 更新與處置結果做更細的 per-incident drill-down。 +- 24h 完整 AI Agent 自動修復 production claim:0%;目前沒有足夠 production 證據宣稱「全自動修復閉環」已達成。 + ## 2026-05-31|Telegram / AwoooP 歷史 result 補寫與殘留狀態分流 **背景**: