diff --git a/docs/LOGBOOK.md b/docs/LOGBOOK.md index 267f1b76..2bfaa31b 100644 --- a/docs/LOGBOOK.md +++ b/docs/LOGBOOK.md @@ -1,3 +1,75 @@ +## 2026-05-24|T162 KM stale completion state in Work Items summary + Telegram detail/history + +**觸發**: + +- T161 已讓 Completion 分流佇列可篩選、可批次 dry-run preview,但 Work Items summary 還沒有把 completion queue 狀態提升到總覽。 +- 使用者要求 Telegram 詳情 / 歷史不能只看到泛用 truth-chain,還要知道 KM owner-review completion 是否卡住、是否可處理、下一步是什麼。 +- 本階段目標是只補 read-only 顯示,不修改 Telegram 主卡、不改 callback mutation、不批次寫 KM。 + +**修正**: + +- Work Items summary 的 `knowledgeHealthcheck` 工作項新增 completion queue 摘要: + - ready / blocked / completed / failed counts。 + - latest completion entry / readiness / next_action。 +- Telegram detail/history 回覆新增 `KM Owner Review` 段: + - 顯示 completion queue ready / blocked / completed / failed。 + - 顯示 guardrail:read-only / batch-write。 + - 若 incident 對應到 stale KM completion item,顯示 entry_id、readiness、next_action。 + - 若沒有對應 item,顯示 `no_related_owner_review`,避免誤導成已處理。 +- Telegram 只查 read-only completion queue,不新增 governance audit row,不寫 KM,不發主卡更新。 + +**local verification**: + +```text +python3 -m py_compile apps/api/src/services/telegram_gateway.py apps/api/tests/test_telegram_message_templates.py -> OK +/Users/ogt/.pyenv/shims/ruff check --select F,E9 apps/api/src/services/telegram_gateway.py apps/api/tests/test_telegram_message_templates.py -> OK +DATABASE_URL='postgresql+asyncpg://test:test@localhost/test' /Users/ogt/.pyenv/shims/pytest apps/api/tests/test_telegram_message_templates.py -q + -> 45 passed +DATABASE_URL='postgresql+asyncpg://test:test@localhost/test' /Users/ogt/.pyenv/shims/pytest apps/api/tests/test_telegram_message_templates.py apps/api/tests/test_ai_governance_endpoints.py -q + -> 105 passed +pnpm --filter @awoooi/web exec tsc --noEmit --incremental false -> OK +pnpm --dir apps/web exec next lint --file 'src/app/[locale]/awooop/work-items/page.tsx' -> OK +json parse apps/web/messages/zh-TW.json apps/web/messages/en.json -> OK +git diff --check -> OK + +note: + Full-file ruff on telegram_gateway.py still reports pre-existing legacy import/E402/bare-except issues; this rollout used F/E9 fatal checks plus focused tests to avoid unrelated churn. +``` + +**production deploy / smoke**: + +```text +code commit: +ac468661 feat(governance): surface km completion state in details + +deploy marker: +a76c5e08 chore(cd): deploy ac46866 [skip ci] + +Gitea Actions: +3015 CD -> success + tests 3980 -> success + build-and-deploy 3981 -> success + post-deploy-checks 3982 -> success +3016 AI Code Review -> success + +K8s: +awoooi-api image=.../api:ac4686615f443da898830846e798bc5a73f87871 ready=2/2 +awoooi-web image=.../web:ac4686615f443da898830846e798bc5a73f87871 ready=2/2 +awoooi-worker image=.../api:ac4686615f443da898830846e798bc5a73f87871 ready=1/1 + +frontend production Browser smoke: + hasKnowledgeCompletionQueueSummary=true + hasKnowledgeCompletionLatest=true + hasCompletionPanel=true + hasCriticalError=false + screenshot=/tmp/t162-work-items-summary-production-refresh.png +``` + +**下一步**: + +- T163:把 Telegram detail/history 的 KM Owner Review 段加進 callback reply evidence / Operator callback list,讓「詳情/歷史是否成功送達」也能看到 KM completion 摘要。 +- T164:把 execution / verification / KM / learning 回寫缺口拆成可操作 work items,降低「完整自動修復聲明:不可宣稱」的剩餘缺口。 + ## 2026-05-24|T161 KM stale completion queue filters + batch dry-run preview **觸發**: