diff --git a/docs/LOGBOOK.md b/docs/LOGBOOK.md index 1ff6ea4b7..b88248696 100644 --- a/docs/LOGBOOK.md +++ b/docs/LOGBOOK.md @@ -1,3 +1,51 @@ +## 2026-05-13 | T6 Incident timeline / Telegram detail reconciliation visibility 已推版 + +**背景**:T5 已把 incident / approval / execution / evidence 的矛盾整理成 `incident_reconciliation_v1`,但 operator 仍需要在既有 incident timeline 與 Telegram「詳情」入口看到同一個真相鏈狀態,不能只靠另外查 truth-chain API。 + +**修正**: +- `awooop_truth_chain_service.py` 將 incident reconciliation builder 公開為 `build_incident_reconciliation()`,讓其他查詢面共用同一份判定邏輯。 +- `incident_timeline_service.py`: + - 在 incident timeline response 追加頂層 `reconciliation`。 + - 當 reconciliation 顯示 `blocked` / `degraded` 時,把同一份資料放進 `safe.events[]`,事件來源標示為 `truth_chain` / `truth_chain_reconciliation`。 + - 不修改 incident、approval、execution、timeline_events;只做 read-only compose。 +- `api/v1/incidents.py` 更新 timeline response schema。 +- `telegram_gateway.py` 的 incident detail 追加「真相鏈狀態」區塊,顯示 `consistency_status`、`operator_next_state` 與前 4 個 mismatch code。 +- 邊界:只調整詳情/查詢顯示,不改主告警卡、按鈕 callback、nonce、approval execution 或自動修復行為。 + +**驗證與推版**: +- Local: + - `py_compile`:pass。 + - `ruff --select F,E9`:pass。 + - `pytest tests/test_incident_timeline_service.py tests/test_awooop_truth_chain_service.py tests/test_phase25_drift_detection.py tests/test_drift_interpreter_ollama_first.py tests/test_platform_router_order.py tests/test_awooop_operator_auth.py -q`:43 passed。 + - `git diff --check`:pass。 +- Gitea: + - `af9798a6 feat(awooop): surface reconciliation in incident timeline` 已推 `gitea main`。 + - Code Review run `1945`:success。 + - CD run `1944`:success。 + - Deploy marker:`c01012d7 chore(cd): deploy af9798a [skip ci]`。 +- Production: + - API/Web/Worker image 均為 `af9798a62e85e3876b471d7c9c4339dd78fb6aa4`。 + - K3s rollout status:API/Web/Worker success。 + - Health:host-local NodePort `127.0.0.1:32334` healthy / mock_mode=false,PostgreSQL / Redis / OpenClaw / SignOz 皆 up。 + - Incident timeline smoke `INC-20260512-B6C589`: + - `GET /api/v1/incidents/INC-20260512-B6C589/timeline` → 200。 + - `reconciliation.schema_version=incident_reconciliation_v1`。 + - `consistency_status=blocked`。 + - `operator_next_state=manual_required`。 + - `safe.events[]` 內有 `actor=truth_chain_reconciliation`、`title=Lifecycle reconciliation: blocked`。 + - mismatch codes:`incident_open_after_approval_resolved`、`approval_approved_without_execution_record`、`approval_no_action_without_execution`、`evidence_all_sensors_failed`。 + +**整體進度**: +- Wave 0:MOMO PostgreSQL backup → AwoooP 失敗通知接線完成並已推版。 +- T0:Truth-chain read-only API 完成、部署、production smoke 完成。 +- T1:Channel Event hardening 完成、部署、production smoke 完成。 +- T2:legacy MCP audit bridge / backfill / truth-chain visibility 完成、部署、production smoke 完成;first-class Gateway enforced path 仍待後續 wave。 +- T3:Ansible audit contract + decision candidate dry-run audit 完成、部署、production smoke 完成。 +- T4:Config Drift stable fingerprint / repeat-state / Telegram stage visibility 完成、部署、production smoke 完成。 +- T5:Incident / Approval / Execution reconciliation 完成、部署、production smoke 完成。 +- T6:Incident timeline / Telegram detail reconciliation visibility 完成、部署、production smoke 完成。 +- 仍未完成:first-class MCP Gateway enforcement、Ansible 真正 check-mode executor / diff / apply / rollback、Operator Console 前端完整呈現、root cause 修復 execution / incident closure 矛盾。 + ## 2026-05-13 | T5 Incident / Approval / Execution reconciliation 已推版 **背景**:B6C589 類 incident 會出現狀態矛盾:Telegram 顯示需要審批 / 處理,DB 裡 approval 已 `APPROVED` 且 action 是 `NO_ACTION`,但 incident 仍 `INVESTIGATING`,automation execution / verification 又沒有成功紀錄。Operator 不能再靠人工猜測「AI 到底修了沒」。 diff --git a/docs/superpowers/specs/2026-04-15-MASTER-ai-autonomous-flywheel-v2.md b/docs/superpowers/specs/2026-04-15-MASTER-ai-autonomous-flywheel-v2.md index f83d53c93..e341943a7 100644 --- a/docs/superpowers/specs/2026-04-15-MASTER-ai-autonomous-flywheel-v2.md +++ b/docs/superpowers/specs/2026-04-15-MASTER-ai-autonomous-flywheel-v2.md @@ -365,10 +365,11 @@ source_event_received | T3 Ansible declarative executor | Ansible 成為 executor candidate,支援 check mode、diff、apply、rollback、artifact link | 每次 AI 修復決策能說明 Ansible 是否可用、是否 dry-run、為何選/不選 | | T4 Drift fingerprint FSM | Drift 不再每小時新增不可辨識卡;同 fingerprint 更新 repeat_count / status / PR / adopt / rollback / ignore | `awoooi-prod HIGH=1 MEDIUM=30` 同組 12h 只更新同一 truth chain | | T5 Incident status reconciliation | approval、incident、evidence、execution、timeline 狀態一致;NO_ACTION 必須是明確 manual_required 或 resolved(noop) | B6C589 類事件不得再出現 incident investigating + approval approved/resolved + no execution/verification 的矛盾 | +| T6 Incident timeline / Telegram detail visibility | T5 reconciliation 必須出現在既有 incident timeline 與 Telegram 詳情入口,不只藏在 truth-chain API | B6C589 類事件在 timeline / 詳情中直接顯示 `blocked`、`manual_required` 與 mismatch codes | **T0 first implementation(2026-05-12 22:50 台北)**:新增 read-only `GET /api/v1/platform/truth-chain/{source_id}`,由 Operator Console auth 保護,聚合 incident / drift / approval / evidence / legacy MCP / AwoooP MCP Gateway / automation_operation_log / KM / timeline / outbound mirror。此 endpoint 只揭露現況與缺口,不改任何 incident、approval、execution 或 Telegram state。 -**當前紅線**:在 T0-T2 未完成前,任何「中低風險告警已有 AI 自動修復」都只能逐案查證,不能全域宣稱。Telegram 卡片必須誠實顯示 degraded / failed / pending_human,而不是只顯示 AI 研判摘要。 +**當前紅線**:T0-T6 已補上第一批查詢/詳情可觀測性,但 T2 仍不是 first-class MCP Gateway enforcement,T3 仍不是 Ansible check-mode / apply executor,T6 也只把 reconciliation 推進詳情層。任何「中低風險告警已有完整 AI 自動修復」仍必須逐案查證,不能全域宣稱。 **T1 first implementation(2026-05-12 23:20 台北)**:開始補 `awooop_outbound_message` 的真相鏈欄位:`content_redacted`、`redaction_version`、`source_envelope`。設計邊界是只保存 redacted rendered card 與 source metadata 摘要;raw Telegram payload、完整 callback data、未遮蔽 token 不入庫。production DB migration 已預套用,API app role 在 `app.project_id=awoooi` 下可讀 outbound rows(`total=312`),代表 T1 的 RLS visibility 紅燈已先驗證可見;新欄位需等 T1 API image 上線後才會產生非空資料。 @@ -1973,6 +1974,21 @@ Phase 6 完成後 - Health:K3s rollout success;host-local NodePort health 200 / `mock_mode=false`。本機直連 `192.168.0.120:32334` 當下 timeout,需另查 workstation-to-node path;cluster 內與 host-local API healthy。 - 邊界:T5 只讓矛盾狀態可見;下一段仍需把 reconciliation 結果回推 Telegram / Operator Console UI,並處理 root cause(execution / incident closure)。 +**T6 Incident timeline / Telegram detail reconciliation visibility production verified(2026-05-13 台北)**: +- `af9798a6 feat(awooop): surface reconciliation in incident timeline` 已推 Gitea main,Code Review run `1945` success,CD run `1944` success。 +- Deploy marker:`c01012d7 chore(cd): deploy af9798a [skip ci]`。 +- `incident_timeline_service` 共用 `build_incident_reconciliation()`,timeline response 追加頂層 `reconciliation`,並在 `safe.events[]` 加入 `truth_chain_reconciliation` event。 +- `telegram_gateway` incident detail 追加「真相鏈狀態」區塊,顯示 `consistency_status`、`operator_next_state` 與 mismatch codes。 +- Production `INC-20260512-B6C589` timeline smoke: + - `GET /api/v1/incidents/INC-20260512-B6C589/timeline` → 200 + - `reconciliation.schema_version=incident_reconciliation_v1` + - `consistency_status=blocked` + - `operator_next_state=manual_required` + - `safe.events[]` 有 `actor=truth_chain_reconciliation` / `title=Lifecycle reconciliation: blocked` + - mismatch codes:`incident_open_after_approval_resolved`、`approval_approved_without_execution_record`、`approval_no_action_without_execution`、`evidence_all_sensors_failed` +- Production API/Web/Worker image 均為 `af9798a62e85e3876b471d7c9c4339dd78fb6aa4`,K3s rollout success,host-local health healthy / `mock_mode=false`。 +- 邊界:T6 是 read-only 顯示層收斂,不修改主告警卡、Telegram button callback、approval execution,也尚未修復 execution / incident closure root cause。 + --- ### 2026-04-20 晚 (台北) — C1-C4 全流程串接 — Playbook 鏈路保護(commit de2d34d)