feat: add chat replay verification

This commit is contained in:
thanhnv
2026-07-08 22:45:12 +09:00
parent 49d0363c6a
commit 36af576f15
15 changed files with 350 additions and 14 deletions
+13 -6
View File
@@ -286,8 +286,8 @@ flowchart TD
### Track 8 — Replay / Evidence / Command Center widgets `[MVP-2 → MVP-3]`
| Task | Việc | File | Verify (WSL) |
|---|---|---|---|
| 18.8.1 | **Replay** một turn (verify lại artifact đã ghi) phát hiện tamper/non-determinism | nối `loop-trace.py replay` | sửa artifact turn → replay lệch |
| 18.8.2 | `verify-chain` lịch sử chat (tamper-evidence, SEC-01/02, KMS khi TIER-2) | nối `loop-trace verify-chain` | sửa 1 turn → chain BREAK |
| 18.8.1 | ✅ **Replay** một turn (verify lại artifact đã ghi) phát hiện tamper/non-determinism | `chat-replay.py` + `loop-trace.py replay` | sửa artifact turn → replay lệch |
| 18.8.2 | ✅ `verify-chain` lịch sử chat (tamper-evidence, SEC-01/02; KMS khi TIER-2 là follow-up) | `chat-replay.py verify-chain` | sửa 1 turn → chain BREAK |
| 18.8.3 | Widget **Chat/Loop** trên Command Center (13 §8.6): ticker per-iteration, budget gauge, click → Evidence drawer | nối Plan-13 §8.6 | số khớp fixture; click → evidence |
| 18.8.4 | **Approvals/Escalation panel**: turn `ESCALATED` vào approvals inbox (13 §3.4), duyệt/từ chối (JWT + SoD + lý do) | nối Plan-13 §3.4 | escalate → pending; JWT giả → DENY |
@@ -355,6 +355,12 @@ cập nhật tổng test ở `CASAN_HARDENING_STATUS.md`.
- [x] Tool output is scanned with `tool-output-scan.sh` before returning the operator result to chat.
- [x] Control Panel response includes `loop_run`; `/chat` displays loop certification/replay status. Verify: `phase-chat-pipeline` 4/0, `phase-chat-stream-hold` 2/0, `phase-chat-operator` 8/0, `console:test` 25/0, `console:build` xanh.
**MVP-2 Track 8.1/8.2 (Replay / verify-chain foundation):**
- [x] `chat-replay.py verify-chain` recomputes chat audit hash-chain and fails closed on edited records.
- [x] `chat-replay.py replay` verifies recorded evidence artifact hashes and replays OPERATOR loop traces via `loop-trace.py replay`.
- [x] Control Plane `GET /api/v1/chat/replay` wraps harness replay; no verdict reimplementation in NestJS.
- [x] Tampered operator evidence artifact → `DRIFT`; tampered chat audit → `BREAK`. Verify: `phase-chat-replay` 4/0, `console:test` 25/0, `console:build` xanh.
**Full (target architecture) — DoD tổng:**
- [ ] Turn chạy **đúng như một loop-run Plan-17** (không định nghĩa vòng lặp riêng).
- [ ] **Không đường vòng:** test chứng minh bỏ bất kỳ gate nào (preflight/verify) → FAIL.
@@ -368,10 +374,11 @@ cập nhật tổng test ở `CASAN_HARDENING_STATUS.md`.
---
## 7. Ghi chú trung thực & Non-goals (không lan man)
- **[MVP-0 + MVP-1 + MVP-2 Track 4 + Operator Track 5/6] — 🟡 done+test.** Ask CASAN
read-only, Operator registered actions, agent/skill governance foundation, và
OPERATOR chat-as-loop/draft-hold đã có harness CLI + Control Panel API/UI. Các
phase CODEGEN-as-loop / replay widget / multi-tenant production vẫn chưa mở.
- **[MVP-0 + MVP-1 + MVP-2 Track 4 + Operator Track 5/6 + Track 8.1/8.2] — 🟡 done+test.**
Ask CASAN read-only, Operator registered actions, agent/skill governance foundation,
OPERATOR chat-as-loop/draft-hold, và replay/verify-chain foundation đã có harness
CLI + Control Panel API. Các phase CODEGEN-as-loop / replay widget / approvals
escalation / multi-tenant production vẫn chưa mở.
- **MVP-first (chống lan man):** **MVP-0 (Ask CASAN read-only) KHÔNG phụ thuộc Plan-17/
14/SEC-23** — làm được ngay trên nền H4/H5/H6 hiện có. Chỉ **MVP-2 trở đi** (chat-as-
loop + agent) mới cần Plan-17 (T1–T3) + Plan-14 RBAC; **MVP-3** mới cần SEC-23 tenant.