docs(logbook): record stale km batch queue rollout [skip ci]
This commit is contained in:
126
docs/LOGBOOK.md
126
docs/LOGBOOK.md
@@ -1,3 +1,129 @@
|
||||
## 2026-05-24|T157 P0/P1 stale KM batch owner-review queue
|
||||
|
||||
**觸發**:
|
||||
|
||||
- T156 已完成單筆 stale KM owner-approved completion,但 production 仍有約 1.4k 筆 stale KM,逐筆排入 owner review 太慢。
|
||||
- 使用者要求前端要能看到已完成與正在推進的 AI 自動化工作,並能判斷每個告警目前卡在哪個流程階段。
|
||||
- 下一個缺口是 P0/P1 stale KM 需要可批次推進到 `waiting_owner_review`,但不能批次直接改寫 KM。
|
||||
|
||||
**修正**:
|
||||
|
||||
- 新增 `POST /api/v1/ai/governance/km-stale-candidates/batch-queue-review`:
|
||||
- schema `km_stale_owner_review_batch_v1`。
|
||||
- 預設處理 `priority_tiers=["P0","P1"]`、`limit=10`。
|
||||
- `dry_run=true` 回傳 batch plan fingerprint、stale ratio snapshot、候選狀態,不寫 audit、不寫 KM。
|
||||
- 實際 queue 必須帶回 dry-run fingerprint;若候選或 dispatch 狀態已變更會拒絕。
|
||||
- 寫入時只建立:
|
||||
- 1 筆 `hermes_km_stale_owner_review_batch` terminal batch dispatch。
|
||||
- N 筆 `hermes_km_stale_owner_review` pending dispatch。
|
||||
- `writes_km=false`;真正 `refresh_with_evidence / archive / supersede` 仍沿用 T156 單筆 dry-run + owner approval。
|
||||
- 已排入的候選會回 `already_queued`,再次確認回 `noop_already_queued`,避免重複排隊。
|
||||
- AwoooP Work Items / AI 治理前端新增 P0/P1 stale KM batch 操作:
|
||||
- 顯示「批次處理 P0 / P1 陳舊 KM」。
|
||||
- 先乾跑批次,顯示候選 / 將排入 / 已在審核 / 略過 / plan fingerprint / stale ratio snapshot。
|
||||
- 確認後顯示 batch dispatch 與 batch event。
|
||||
- 補 zh-TW / en i18n:
|
||||
- `batch_owner_review_previewed`
|
||||
- `batch_owner_review_queued`
|
||||
- `batch_noop_already_queued`
|
||||
|
||||
**local verification**:
|
||||
|
||||
```text
|
||||
python3 -m py_compile apps/api/src/models/governance.py apps/api/src/services/governance_km_stale_review_service.py apps/api/src/api/v1/ai_governance.py apps/api/tests/test_ai_governance_endpoints.py -> OK
|
||||
/Users/ogt/.pyenv/versions/3.11.7/bin/python -m ruff check apps/api/src/models/governance.py apps/api/src/services/governance_km_stale_review_service.py apps/api/src/api/v1/ai_governance.py apps/api/tests/test_ai_governance_endpoints.py -> OK
|
||||
DATABASE_URL='postgresql+asyncpg://test:test@localhost/test' REDIS_URL='redis://localhost:6379/0' /Users/ogt/.pyenv/versions/3.11.7/bin/python -m pytest apps/api/tests/test_ai_governance_endpoints.py apps/api/tests/test_governance_agent.py apps/api/tests/test_hermes_kb_growth_worker.py apps/api/tests/test_governance_dispatcher.py -q
|
||||
-> 101 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
|
||||
```
|
||||
|
||||
**production deploy / smoke**:
|
||||
|
||||
```text
|
||||
code commit:
|
||||
943093a4 feat(governance): batch queue stale km reviews
|
||||
|
||||
Gitea Actions:
|
||||
2981 CD -> success
|
||||
tests 3917 -> success
|
||||
build-and-deploy 3918 -> success
|
||||
post-deploy-checks 3919 -> success
|
||||
2982 AI Code Review -> success
|
||||
ai-code-review 3920 -> success
|
||||
2983 Type Sync Check -> success
|
||||
check-type-sync 3921 -> success
|
||||
|
||||
K8s:
|
||||
awoooi-api image=.../api:943093a49bd36fa27ff0f0236db702d4d756acf7 ready=2/2
|
||||
awoooi-web image=.../web:943093a49bd36fa27ff0f0236db702d4d756acf7 ready=2/2
|
||||
awoooi-worker image=.../api:943093a49bd36fa27ff0f0236db702d4d756acf7 ready=1/1
|
||||
|
||||
health:
|
||||
GET /api/v1/health -> status=degraded, prod, mock_mode=false
|
||||
components api/postgresql/redis/openclaw/signoz=up
|
||||
ollama_gcp_a=down timeout; ollama_gcp_b=up; primary unavailable fallback active=ollama_gcp_b
|
||||
|
||||
batch dry run:
|
||||
status=dry_run
|
||||
workflow_stage=batch_owner_review_previewed
|
||||
candidate_count=10
|
||||
queued_count=10
|
||||
already_queued_count=0
|
||||
skipped_count=0
|
||||
writes_km=false
|
||||
writes_governance_audit=false
|
||||
dry_run_plan_fingerprint=sha256:920051da8b8084ccee98907966e6732b49269aaf20a7044f0a9e3b0c2746e0a7
|
||||
stale_ratio_snapshot=1489/3026 ratio=0.492 threshold=0.2
|
||||
|
||||
batch confirm:
|
||||
status=queued
|
||||
workflow_stage=batch_owner_review_queued
|
||||
batch_governance_event_id=c0907f6c-aa1d-4133-bd93-db72cbf9cef6
|
||||
batch_dispatch_id=4e2530b7-e3d2-4569-86e2-78f13a6e652d
|
||||
queued_count=10
|
||||
writes_km=false
|
||||
writes_governance_audit=true
|
||||
|
||||
repeat dry run:
|
||||
status=dry_run
|
||||
queued_count=0
|
||||
already_queued_count=10
|
||||
|
||||
repeat confirm:
|
||||
status=noop_already_queued
|
||||
writes_km=false
|
||||
writes_governance_audit=false
|
||||
batch_dispatch_id=null
|
||||
|
||||
queue trail:
|
||||
4e2530b7-e3d2-4569-86e2-78f13a6e652d hermes_km_stale_owner_review_batch succeeded stage=batch_owner_review_queued worker=batch_owner_review_queued
|
||||
d754c205-9678-413c-a10e-3b8b4ee6f739 hermes_km_stale_owner_review pending stage=waiting_owner_review worker=queued_owner_review
|
||||
f648ab84-50dd-4f5d-bb5d-53cf20a2a42b hermes_km_stale_owner_review pending stage=waiting_owner_review worker=queued_owner_review
|
||||
... total 10 P0 owner-review dispatches queued
|
||||
|
||||
frontend:
|
||||
GET /zh-TW/awooop/work-items?project_id=awoooi -> 200
|
||||
HTML includes active AwoooP nav and work-items bundle page-af5048f6612494b7.js
|
||||
```
|
||||
|
||||
**處置判讀**:
|
||||
|
||||
- T157 將 KM stale governance 從「單筆處理」推進到「P0/P1 批次排入 owner review」。
|
||||
- 這不是 AI 批量寫知識;Hermes 只負責排序、批次排隊、狀態機與 audit,KM 寫入仍需 owner 按 T156 的單筆 fingerprint 流程。
|
||||
- `stale_ratio` 仍高於 20% 門檻,所以治理告警不應關閉;下一段應做 batch owner-review completion queue / owner 工作台排序,讓 10 筆 pending 能被逐筆 completion 並回測 stale ratio。
|
||||
|
||||
**目前整體進度**:
|
||||
|
||||
- AwoooP 告警可觀測鏈:約 98%。
|
||||
- 治理告警可讀性 / 可處置性:約 96.5%。
|
||||
- KM stale governance 自動化:約 93%。
|
||||
- Frontend AI 自動化管理介面同步:約 97%。
|
||||
- Runtime rollout 穩定性:約 96.5%。
|
||||
- 完整 AI 自動化管理產品化:約 95.5%。
|
||||
|
||||
## 2026-05-24|T156 KM stale owner-review completion / stale ratio recheck
|
||||
|
||||
**觸發**:
|
||||
|
||||
Reference in New Issue
Block a user