Opus Review — 20A/20B-P0 Report + Next Step Proposal
Opus Review — 20A/20B-P0 Inspection Report + Next Step Proposal
Date: 2026-05-05 | Reviewer: Opus 4.6 Reviewed:
knowledge/dev/laws/dieu44-trien-khai/reports/20a-20b-p0-search-vector-hygiene-inspection-report.mdFor: GPT/User thẩm tra và quyết định bước tiếp
Verdict
Report PASS — 10/10 câu hỏi trả lời đầy đủ, có evidence code/data, giữ read-only.
Key Evidence (tóm tắt cho GPT)
| Hạng mục | Kết quả | Evidence |
|---|---|---|
| 20A filter feasibility | VIABLE — ~14 LOC core | metadata.source = "dieu43_context_pack_publish" đã có sẵn trong payload. Qdrant MatchAny + must_not filter đã import sẵn. Chỉ cần thêm param exclude_source vào vector_store.py:259 + thread qua server.py:1116. |
| B1 DOT upload pattern | Accumulate (đúng như dự kiến) | doc_id="context-pack/${BUILD_ID}/${outname}" — mỗi build tạo path mới |
| B2 Delete-after-upload | Absent | grep 0 matches |
| B4 FS build count | 141 builds, 36 MB | /opt/incomex/context-pack-staging/ |
| B4 Cron cleanup | Absent | crontab + systemctl empty |
| B5 Cold archive feasible | Yes | 53 GB free, 14 MB cho 7 ngày retention |
| B6 PG manifest audit | Sufficient | 131 manifest, 1.157 sections, 20 columns, dual checksums |
| B7 v_context_pack_latest | 20260504-040018-372b48 |
Khớp KB latest từ report trước |
| B9 Full KB removal risk | Low | Không có code path nào đọc context-pack từ KB search |
| B10 Agent runtime | Filesystem only | current symlink → staging build. KB mirror = redundant. |
Điểm tôi kiểm tra kỹ
-
A4 — metadata.source có thật trong payload không? Agent trích dẫn
build script line 1080+vector_store.py:201-210payload structure. Khớp với Agent report trước (Q4). Confirmed. -
B10 — Agent đọc context-pack từ đâu? Agent grep toàn bộ
/opt/incomex/chosearch_knowledge.*contextvàget_document.*context-pack→ 0 matches ngoài build/verify scripts. Consumer dùng filesystemcurrentsymlink. Đây là evidence quyết định: KB mirror không có reader. -
Hard boundaries: 9/9 PASS. Không mutation nào.
-
Flag ngoài scope: Build staging
20260505-100008-4277bachưa promote,health_status=failtrên manifest id=138. Pipeline có thể stuck — cần điều tra riêng, không liên quan vector hygiene.
Recommendation — 3 bước
Bước 1: Ngừng upload context-pack lên KB (DOT script patch)
Sửa dot-context-pack-build.sh: bước 7e (KB mirror) thành no-op hoặc skip. Không upload mới nữa.
Lý do: KB mirror không có reader (B10). Mỗi build tạo 9 docs + embedding = đốt token vô nghĩa.
Bước 2: Purge 1.174 docs cũ khỏi KB
Batch delete_document cho tất cả prefix context-pack/. Dry-run list trước, confirm count = 1.174, rồi execute.
Lý do: FS + PG manifest đã đủ audit (B5, B6). Không ai đọc từ KB (B10). Xóa xong vector pool giảm ~60%.
Bước 3: Thiết lập FS retention 7 ngày
Cron: find /opt/incomex/context-pack-staging -maxdepth 1 -type d -mtime +7 -exec rm -rf {} +
Lý do: 141 builds tồn đọng (B4), không cron (B4). 7 ngày đủ audit, chỉ chiếm ~14 MB.
20A filter — defense-in-depth (tùy chọn, sau bước 1-2)
Sau khi KB sạch, context-pack không còn trong vector nên filter không cần thiết ngay. Nhưng nên làm để phòng ai đó upload lại context-pack (hoặc tài liệu ephemeral khác) trong tương lai.
Có thể defer 20A sau bước 1-2, hoặc làm song song nếu muốn.
Execution order đề xuất
| Phase | Nội dung | Loại |
|---|---|---|
| E1 | Patch DOT script: bỏ bước 7e KB mirror | Script mutation — cần prompt execution riêng |
| E2 | Dry-run delete list: list_documents(path="context-pack/") → confirm 1.174 → log |
Read-only |
| E3 | Batch delete 1.174 docs | KB mutation — cần confirm |
| E4 | Verify: search pollution test 7 query → so sánh before/after | Read-only |
| E5 | Cron FS retention 7 ngày | VPS mutation |
| E6 (optional) | 20A search filter patch ~14 LOC | Code mutation |
E1-E5 có thể gộp thành 1 execution prompt (Pack 20B-P1) nếu GPT/User approve.
Risks
| Risk | Mitigation |
|---|---|
| Xóa nhầm doc không phải context-pack | Dry-run list + prefix filter context-pack/ — không doc canonical nào có prefix này |
| Ai đó upload context-pack lại sau purge | E1 đã bỏ upload step. 20A filter là guard bổ sung |
| Pipeline Đ43 stuck (build staging không promote) | Flag riêng, không liên quan purge. Điều tra session khác |
| Mất audit trail | PG manifest vĩnh viễn (B6) + FS 7 ngày (E5) |
Decision request cho GPT/User
- Approve execution order E1→E5? (E6 optional)
- E1-E5 gộp 1 prompt hay tách? Tôi khuyến nghị gộp — scope nhỏ, rõ ràng, mỗi bước có verify.
- 20C KB Governance: defer sang session riêng sau khi bước 1-2 xong?
Opus Review 20A/20B-P0 | 2026-05-05 | Report PASS. Chờ GPT/User approve execution.