diff --git a/docs/LOGBOOK.md b/docs/LOGBOOK.md index f8065296..1842113e 100644 --- a/docs/LOGBOOK.md +++ b/docs/LOGBOOK.md @@ -134,6 +134,38 @@ **邊界**:本段沒有啟動 auto worker、沒有低 / 中風險 live execution、沒有送 Telegram、沒有寫 Gateway queue、沒有呼叫 Bot API、沒有寫 receipt production target、沒有寫 production、沒有讀 secret、沒有呼叫 paid API、沒有 host write、沒有 kubectl action、沒有 destructive operation,也沒有替換 OpenClaw。 +## 2026-06-18|P2-109 報表資料源健康 read model 正式驗證完成 + +**背景**:統帥指出日報 / 週報 / 月報若只顯示全 0 或摘要,沒有判斷資料源可信度、AI 是否能接手、KM / PlayBook / 腳本 / 排程 / Verifier 是否沉澱,就等於沒有做成 AI 自動化產品。前一段 `/zh-TW/reports` 已把首屏總控前移,但事件統計與解決率仍需要統一的 redacted public read model,而不是前端硬判缺口。 + +**完成內容**: +- `27d9f394 feat(reports): 新增報表資料源健康 read model`。 +- 新增 `apps/api/src/services/ai_agent_report_source_health.py` 與 `GET /api/v1/agents/agent-report-source-health`。 +- 新 read model 回傳 `ai_agent_report_source_health_v1`,統一輸出事件統計、解決率、AI 效能、處置統計、日 / 週 / 月報狀態板來源健康。 +- 每個來源都固定有 `source_ok`、`state`、`freshness`、`confidence_percent`、`work_item_id` 與 `next_action`;資料源失敗會變成 `report-source-gap:*`,不再被前端或 Telegram 誤讀成健康。 +- 同一 payload 新增 `all_zero_assessment`、`no_send_previews`、`automation_assets` 與 `activation_boundaries`,直接顯示 KM / PlayBook / 腳本 / 排程 / Verifier 的 done / blocked。 +- `/zh-TW/reports` 已改成讀 `agent-report-source-health`,資料源健康矩陣、日 / 週 / 月報 chips 與自動化資產沉澱卡改由後端 read model 驅動。 + +**驗證**: +- 本地:`py_compile` 通過;`apps/api/tests/test_ai_agent_report_source_health_api.py` `2 passed`;messages JSON parse / i18n mirror `zh=12848 / en=12848 / missing=0`;`git diff --check`、`SOURCE_CONTROL_OWNER_RESPONSE_GUARD_OK`、`SECURITY_MIRROR_PROGRESS_GUARD_OK` 通過。 +- 本地限制:此 temp worktree 缺 `apps/web/node_modules/typescript/bin/tsc`,`pnpm --filter @awoooi/web typecheck` 無法在本地執行;已由 Gitea clean env 補足。 +- Gitea code-review:`code-review.yaml #3211` 成功。 +- Gitea CD:`cd.yaml #3210` 成功,deploy marker `d8862123 chore(cd): deploy 27d9f39 [skip ci]`。 +- Production health:`/api/v1/health` 回 `healthy / prod / mock_mode=false`。 +- Production API readback:`/api/v1/agents/agent-report-source-health` 回 schema `ai_agent_report_source_health_v1`、current `P2-109`、next `P2-110`、completion `100`、source `5`、source ok `2`、source gap `3`、confidence `40`、no-send preview `3`、work items `3`、live send allowed `0`、runtime gate `0`。 +- Production source gaps:`incident_summary`、`resolution_stats`、`ai_performance` 目前為 `gap`;`disposition_stats` 與 `report_status_board` 為 `ok`;這是正式暴露的產品缺口,不再假裝全 0 健康。 +- Production automation assets:KM `draft_ready 3/3 blocked`、PlayBook `draft_required 0/3 blocked`、腳本 `readback_only 1/0`、排程 `no_send_preview 3/0`、Verifier `source_health_ready 1/3 blocked`。 +- Desktop smoke:`/zh-TW/reports?_v=d8862123-report-source-health-prod-desktop` 必要文字可見:`報表 / 告警 AI 接管總控`、`資料源健康矩陣`、`來源 2/5`、三個 `report-source-gap:*`、KM / PlayBook / 腳本 / 排程 / Verifier、`日報 / 週報 / 月報`、`告警到 AI 接手漏斗`、`AI Agent 分工與工作量`;console error `0`、HTTP failed response `0`、`clientWidth=1440`、`scrollWidth=1440`、horizontal overflow `false`。 +- Mobile smoke:`/zh-TW/reports?_v=d8862123-report-source-health-prod-mobile` 同一批必要文字可見;console error `0`、HTTP failed response `0`、`clientWidth=390`、`scrollWidth=390`、horizontal overflow `false`。粗略 overflowing 掃描命中固定側欄 / offscreen shell,主內容未水平跑版。 +- 截圖:`/tmp/awoooi-reports-source-health-desktop-d8862123.png`、`/tmp/awoooi-reports-source-health-mobile-d8862123.png`。 + +**完成度同步**: +- P2-109 報表資料源健康 read model:本地 `100%`、正式 API `100%`、Reports desktop / mobile `100%`。 +- 日報 / 週報 / 月報產品化總控:`45% -> 60%`;已完成 source health read model、no-send preview、Reports 接線與正式驗證;仍需把同一 read model 接進 Telegram 日報 / 週報 / 月報草案與 SRE digest route,並補 source gap PlayBook / verifier 實作。 +- IwoooS 整體仍維持 `64%`,active runtime gate 仍 `0`。 + +**邊界**:本段沒有送 Telegram、沒有寫 Gateway queue、沒有改排程、沒有啟動 AI runtime、沒有中低風險 live execution、沒有寫 production state、沒有讀 secret、沒有 host write、沒有 kubectl action,也沒有提高 runtime gate。 + ## 2026-06-18|Reports 前移 AI Agent 報表與告警接管總控 **背景**:統帥指出 Telegram 週報全 0 沒有用途,日報 / 週報 / 月報不該只是發摘要,而要判斷資料鏈路是否可信、告警是否有效、AI 是否能接手、KM / PlayBook / 腳本 / 排程 / Verifier 是否沉澱。舊 `/zh-TW/reports` 只顯示處置統計,且仍打不存在或受保護的舊 stats endpoint,導致正式站 console 404 / 401,使用者無法快速判讀 AI 自動化是否真的掌控系統。 diff --git a/docs/workplans/2026-06-04-iwooos-security-governance-p0.md b/docs/workplans/2026-06-04-iwooos-security-governance-p0.md index 715731ce..941d3194 100644 --- a/docs/workplans/2026-06-04-iwooos-security-governance-p0.md +++ b/docs/workplans/2026-06-04-iwooos-security-governance-p0.md @@ -62,7 +62,7 @@ | Knowledge Base KM 自動化掌控台 / 資產沉澱可視化 | 本地 `100%`;正式站 desktop / mobile `100%` | 是,僅限 KM governance readback、Owner Review queue、資產沉澱總帳與 Work Items 接續入口 | `/zh-TW/knowledge-base` 已把 `KM 自動化掌控台` 前移到首屏,直接顯示 stale ratio `98.8%`、stale KM `1,900`、Owner Review `10`、`ready 10 / blocked 0`、已寫回 `1`、治理流程圖與 `KM / PlayBook / 腳本 / 排程 / Verifier` 五類沉澱狀態;不寫 KM、不提升 PlayBook trust、不批次完成 owner review、不開 runtime gate | | Observability AI 自動化資產與訊號總帳 | 本地 `100%`;正式站 desktop / mobile `100%` | 是,僅限主機 / 專案 / 網站 / 服務 / 監控訊號 / KM / PlayBook / Verifier / SRE 路由 readback | `/zh-TW/observability` 已把 `AI 自動化資產與訊號總帳` 前移到首屏,6 張卡顯示全域資產、監控訊號、服務健康、KM / PlayBook / Verifier、SRE 戰情室、Runtime Gate;總帳區操作入口 `0`,不 live probe、不 reload、不改規則、不發 Telegram、不套用修復 | | Tenants 全域產品 / 網站 / 來源資產地圖 | 本地 `100%`;正式站 desktop / mobile `100%` | 是,僅限產品 / 專案、網站 / 服務入口、來源範圍、租戶資料與 gate readback | `/zh-TW/awooop/tenants` 已把 `全域資產地圖` 前移到首屏,直接顯示 `57` 個可視資產、`16 個產品 / 專案`、`31 個網站 / 服務入口`、`10 個來源範圍`、分類堆疊、route chips、主要來源就緒、已接受回覆、執行閘門與操作入口;不改租戶政策、不改路由、不部署、不掃描、不建立 repo、不開 runtime gate | -| 日報 / 週報 / 月報與 AI Agent 報表資料鏈路 | Weekly report 資料缺口止血本地 `100%`、正式部署 `100%`;Reports 總控正式站 `100%`;報表產品化總控 `45%` | 是,僅限資料源 truthfulness、全 0 判讀、Reports 首屏總控與下一步工作項 | `ac325852` / deploy marker `a4b30964` 已修正週報 Git 活動讀取失敗時假性輸出 `0`;`6d4fa7bf` / `5e849225` / `63a75f77` 已把 `/zh-TW/reports` 改成 `報表 / 告警 AI 接管總控`、資料源健康矩陣、日週月報 cadence、AI 接手漏斗與自動化資產沉澱;最新 deploy marker `cd1c4407` 正式驗證 console error `0`、HTTP failed response `0`、horizontal overflow `0`;仍未完成 public report source read model、日報 / 週報 / 月報 no-send preview 合併、資料 freshness dashboard 與 SRE 戰情室 digest route,不發 live Telegram、不改排程、不開 runtime gate | +| 日報 / 週報 / 月報與 AI Agent 報表資料鏈路 | Weekly report 資料缺口止血本地 `100%`、正式部署 `100%`;Reports 總控正式站 `100%`;P2-109 source health read model 正式站 `100%`;報表產品化總控 `60%` | 是,僅限資料源 truthfulness、全 0 判讀、Reports 首屏總控、no-send preview、資產沉澱與下一步工作項 | `ac325852` / deploy marker `a4b30964` 已修正週報 Git 活動讀取失敗時假性輸出 `0`;`6d4fa7bf` / `5e849225` / `63a75f77` 已把 `/zh-TW/reports` 改成 `報表 / 告警 AI 接管總控`;`27d9f394` / deploy marker `d8862123` 新增 `agent-report-source-health`,正式讀回 source `5`、source ok `2`、source gap `3`、confidence `40`、no-send preview `3`、work items `3`、live send allowed `0`、runtime gate `0`,Reports desktop / mobile 必要文字可見、console error `0`、HTTP failed response `0`、horizontal overflow `0`;仍需把同一 read model 接進 Telegram 日報 / 週報 / 月報草案、SRE digest route、source gap PlayBook 與 verifier,不發 live Telegram、不改排程、不開 runtime gate | | Telegram 監控告警 / 批准執行真相鏈 | outbound 主鏈路 `100%`;批准後執行止血 `100%`;no-action 人工處置包 D0 `100%`;MCP / PlayBook 修復候選 D5 `88%`;Approvals / Runs / Alerts / Knowledge Base / Observability / Tenants / Telegram 告警卡資產沉澱矩陣 `100% / desktop 100% / 100% / 100% / 100% / 100% / formatter+deploy 100%`;治理長期項 `98%` | 是,僅限候選產生、阻擋原因、人工草案包、AwoooP 工作項可追蹤性、Work Items 詳細接手板、Approvals / Runs / Alerts / Knowledge Base / Observability / Tenants / Telegram 告警卡資產沉澱欄與 coverage gap metadata | 已修復 Alertmanager tenant context、既有 approval 收斂告警 recurrence、AI 分析中重複告警 recurrence、no-action approval 誤導執行、可執行修復 execution / KM / verifier 紀錄、no-action 人工處置包、MCP evidence / PlayBook trust 候選產生、通用兜底 / 診斷型 PlayBook 阻擋理由、缺候選時的 PlayBook 草案欄位 / 下一步 / AwoooP work item 入口與詳細處置板、blocked result 的服務 coverage gap / blocking stage / required MCP evidence refs,以及 Approvals / Runs / Alerts / Knowledge Base / Observability / Tenants / Telegram 告警卡的 `KM / PlayBook / 腳本 / 排程 / Verifier` 資產沉澱矩陣;完整自動修復飛輪仍需用真實告警驗證 approval -> execution -> verifier -> KM / PlayBook trust 全鏈,不調高 runtime gate | ## 2. P0 工作拆解與優先順序 @@ -86,7 +86,7 @@ | P0-7 | Telegram 批准後執行真相鏈止血 | 100% | no-action approval 不再顯示批准 / 執行中;可執行修復 approval 會寫入 `auto_repair_executions`、KM 與 verifier;下一步補 MCP evidence / PlayBook trust 產生真正修復候選 | 目標 pytest `125 passed`、py_compile、guard、production health、API / worker rollout、production pod classifier readback | | P0-8 | Telegram no-action 人工處置包與操作入口 | 100% | no-action 卡片已新增人工處置包、證據補齊清單、AwoooP 修復候選建立步驟、verifier / KM / PlayBook 回寫提醒,並改成 `處置包`、`重診`、`歷史`、`靜默`、`真相鏈`、`Runs` 鍵盤;舊訊息不 retroactive 改寫 | 目標 pytest `64 passed + 44 passed`、py_compile、guard、production health、API / worker rollout、production pod render / keyboard smoke | | P0-9 | MCP evidence -> PlayBook 修復候選產生 | D5 `88%`;Approvals ledger `100%`;Runs ledger desktop `100%`;Alerts ledger desktop / mobile `100%` | 已補 webhook fallback 先建立 incident,再收 MCP evidence、查 approved PlayBook、檢查 trust / command safety、產生 medium approval candidate 與 verifier plan;D1 追加通用兜底 PlayBook / 診斷型命令不可誤當修復、阻擋理由繁中化;D2 在缺候選時產生 `repair_candidate_draft_package_v1`、`playbook_draft_required`、下一步與必填欄位;D3 新增 `awooop_repair_candidate_draft_work_item_v1` read-only projection 與 Telegram `工作項目` deeplink;D4 讓 AwoooP Work Items 詳細呈現 PlayBook 草案處置板、必填欄位、阻擋原因、下一步、Runs / 審批連結;D5 新增 `repair_candidate_coverage_gap_v1`,讓 blocked result 帶出 coverage key、target kind、blocking stage、必收 MCP evidence refs、PlayBook template fields 與 runtime 0 / false 邊界;Approvals / Runs / Alerts 已新增 `資產沉澱` 欄或焦點矩陣,可直接看到 KM / PlayBook / 腳本 / 排程 / Verifier 的完成與卡點;下一步要補 Runs mobile smoke,並把同一總帳接到正式 Telegram 告警卡、Observability 與 Tenants,用真實告警驗證 approval -> execution -> verifier -> KM / PlayBook 回寫 | Approvals code `dafe5342` 已隨 deploy marker `42c08ece` 正式站 desktop / mobile smoke;Runs code `11c2b5d4` 已隨 deploy marker `8b6ab87c` 正式站 desktop DOM smoke;Alerts code `10cd6167` 已隨 deploy marker `d36d764a` 正式站 desktop / mobile DOM smoke;P2-407 API production readback `overall_completion_percent=100`;status-chain 後續仍必須看到 tool call、PlayBook id、risk gate、repair candidate、verifier plan | -| P0-9a | 日報 / 週報 / 月報資料鏈路 truthfulness | 45% | Weekly report 已修正 Git 活動讀取失敗時假性全 0 的問題;Reports 頁已前移資料可信度、資料源健康矩陣、日週月報 cadence、告警到 AI 接手漏斗、自動化資產沉澱與 Agent 工作量;下一步建立 `report-source-health` / `report-no-send-preview` read model,把受保護 incident / resolution 統計轉成 redacted public readback,並把日報、週報、月報與告警 digest 串到資料 freshness、AI 接手率、KM / PlayBook / Verifier 沉澱與 SRE 戰情室收斂視圖 | Feature commit `ac325852`、Reports commits `6d4fa7bf` / `5e849225` / `63a75f77`、deploy markers `a4b30964` / `4d4c6da3` / `cd1c4407`;production `/zh-TW/reports` desktop / mobile 必要文字可見、console error `0`、HTTP failed response `0`、horizontal overflow `0`;未 live send Telegram、未改排程、未開 runtime gate | +| P0-9a | 日報 / 週報 / 月報資料鏈路 truthfulness | 60% | Weekly report 已修正 Git 活動讀取失敗時假性全 0 的問題;Reports 頁已前移資料可信度、資料源健康矩陣、日週月報 cadence、告警到 AI 接手漏斗、自動化資產沉澱與 Agent 工作量;P2-109 已建立 `agent-report-source-health` / no-send preview read model,把 incident / resolution / AI performance / disposition / status board 統一成 source health、work items、all-zero assessment 與 KM / PlayBook / 腳本 / 排程 / Verifier 沉澱;下一步把同一 read model 接進 Telegram 日報 / 週報 / 月報草案、SRE digest route、source gap PlayBook 與 verifier | Feature commit `ac325852`、Reports commits `6d4fa7bf` / `5e849225` / `63a75f77`、P2-109 commit `27d9f394`、deploy markers `a4b30964` / `4d4c6da3` / `cd1c4407` / `d8862123`;production `/api/v1/agents/agent-report-source-health` schema OK,Reports desktop / mobile 必要文字可見、console error `0`、HTTP failed response `0`、horizontal overflow `0`;未 live send Telegram、未改排程、未開 runtime gate | | P0-10 | 高價值配置 Gate path coverage、工作樹 preflight、owner packet / coverage snapshot 補強 | 100% | 已將 `k8s/nginx/**`、`scripts/ops/**/*cert*`、`scripts/ops/**/*tls*` 納入 `high-value-config-change-gate.py`,讓 Nginx public gateway 與 DNS / TLS / certbot 既有路徑命中 P0 / C0;預設模式可讀取 staged / unstaged / untracked,避免本地 preflight 漏掉未提交配置;owner packet 與 coverage snapshot 已同步最新 pattern;owner evidence 仍未提供,runtime execution 仍 false | Gate sample:`changed_files=6 matched=6 categories=3 c0=2 c1=0`;工作樹 smoke:臨時 `k8s/nginx/*` 檔命中 C0;owner packet:`packets=3 c0=2 runtime_gate=0`;coverage:`categories=14 c0=8 avg=67 runtime_gate=0`;`py_compile`、snapshot JSON parse、progress guard、owner response guard、doc secret sanity、diff check | | P0-11 | 高價值配置 Owner Packet 前台同步 | local 100%;production 100% | `/zh-TW/iwooos` 與 `/zh-TW/awooop` 已同步 latest owner packet snapshot,顯示 `packet=3 / c0=2`、Nginx public gateway、DNS / TLS / certbot 與 security tooling 影響範圍;request sent、received、accepted、runtime gate 與 action buttons 仍全部為 `0` | Feature commit `e999c16b`、deploy marker `16c6b983`、Gitea code-review `2973` / CD `2972` success;本地與正式 desktop / mobile / in-app browser smoke:IwoooS 與 AwoooP 均 HTTP `200`、必要文字與 boundary keys 可見、水平溢位 `0`、卡片內操作控制 `0`、危險連結 `0`、工作溝通片語命中 `0`;headline 不提高 | | P0-12 | IwoooS posture projection Owner Packet count sync | 100% | `iwooos-posture-projection.snapshot.json` 與 schema 已從舊 `packet=1 / c0=0` 同步為 `packet=3 / c0=2`,避免 committed projection 與前台 / owner packet snapshot 分叉;request / received / accepted / runtime gate 仍為 `0` | `security-mirror-progress-guard.py` expectation 已同步;後續驗證以 JSON parse、schema parse、progress guard、owner response guard、doc secret sanity、diff check 為準;不需要 production browser smoke |