[CLAUDE] Docs: S111 adopt H22 WAL session-continuity — sổ WAL ≤40 + Stop-hook wal-flush.ps1 persist-only VERIFIED-RUNTIME ×2 (12071c5/67be443 hot-reload ENV-DEPENDENT) + /pause·/tiep 1-đường + BƯỚC 0.7/§5.0/§6.4 + FLIP run-trace ≥3-task + engine PHẦN N + detector C5 + mark RC-…12-07-2026-11-43-45 + D10 paths-ignore anh-directed + email 9cdcda2f3c83 (invest/reviewer Fable per-invocation 0-garble · WF wf_5ba3daf6-fe0 3-Opus RUN-TRACE · reviewer PASS_WITH_FIXES 8/8-fix · squash §5.0 dogfood-THẬT K=2)
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 5m11s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-07-12 11:45:14 +07:00
parent 318a271930
commit 8aa3869637
30 changed files with 767 additions and 5 deletions

View File

@ -0,0 +1,25 @@
# adap-report — 2026-07-11-Governance-harness-22-wal-session-continuity (SE)
> **Broadcast:** `2026-07-11-Governance-harness-22-wal-session-continuity.md` (outbox/all AI_INFRA) + notify `2026-07-11-ai_infra-to-se-notify-harness-22-wal`. **Adopt S111 (2026-07-12), anh-directed** (lệnh anh nguyên văn: `"/check-email AI_INFRA và /adap-apply … /fable-real invest và review - đề tài là harness mà AI_INFRA apply xuống. Sau đó hwm cho Opus 4.8 MAX xử lý. Xong thì session-end"` — đúng khung H21 per-invocation: owner gõ + vai đích-danh + worker hạng-hai).
> **Integrity gate:** whole-file `Get-FileHash` copy==nguồn ✓ ×2 + body `content_sha256` re-compute notify `c64a7ac2a1bb` + broadcast `3de0758a6377` **MATCH ✓** (canonical split-frontmatter + strip-1-leading-newline + SHA256-UTF8). `reviewer_gate: PASS-W-FIXES` (gate-outward AI_INFRA tại nguồn).
> **Harness-9 mandate 2-workflow + engine-đắt:** invest = **investigator-codebase Fable-real single-deep-pass** (READY_WITH_NUANCES 14N, **0-garble** — VERDICT-header mitigation ăn) → lead verify + **CHỈNH 3 điểm** (nặng nhất: hook bash→**PS1** vì PATH 2-context ngược nhau) + ghi **spec-file 3-mục** `runs/2026-07-12-h22-wal-adopt/spec-h22-wal-adopt-12-07-2026.md` (K.E run-2 sau dogfood run-1 S110) → WF implement **`wf_5ba3daf6-fe0`** (3 worker **Opus 4.8 MAX** `tier:'opus'`, RUN-TRACE mode — **dogfood NGAY sàn mới "≥3 task = bắt buộc run-trace"**, 3/3 DONE 0-error ~322K tok) → review = **reviewer Fable-real single-deep-pass** (0-garble) → **PASS_WITH_FIXES** (0 Critical · 1 Major · 7 minor) → em-main fix trọn 8/8 cùng phiên.
## Nấc per-khoản sàn H22 (G-011: agreed / executed / verified)
| Khoản (sàn 🔴 broadcast §9) | Nấc | Evidence |
|---|---|---|
| **① Sổ WAL ≤40 dòng ghi-đè-không-append** (chain-bằng-chứng + next + verify-trước-next, ground-truth thắng, cấm secret) | **executed + dogfood CÙNG PHIÊN** | `.claude/WAL.md` sống suốt phiên adopt (17 dòng; lead ghi-đè sau MỖI subtask — 6 lần); reviewer chạy THẬT lệnh `verify:` PASS; +detector **C5 WAL-guardrail** (`governance-detectors.ps1` — flag >40 dòng, chạy [OK] 17/40; reviewer-m1 nâng convention→răng-thật); template rỗng + schema codify engine **PHẦN N.1** |
| **② Hai tầng ghi** (lead nội-dung ⟂ hook persist-only 0-content fail-open per-path) | **executed + ✅ hook-FIRE VERIFIED-RUNTIME CÙNG PHIÊN** | `.claude/hooks/wal-flush.ps1` (PS1-port giữ nguyên semantics: per-path add + CAND + exit-0 + 0 push/content/block) + `.claude/settings.json` hooks-entry (CREATE mới — file chưa từng tồn tại) + `.gitattributes` `*.sh eol=lf` append; **hook fire THẬT ×2**: `12071c5` (11:05:39) + `67be443` (11:17:00 — reviewer CHỨNG KIẾN SỐNG giữa review), CAND chuẩn (settings/broadcasts/docs đứng ngoài), 0 push; reviewer **fault-inject cây tạm 2-ca PASS** (thiếu-1-path vẫn commit path-còn + exit-0 · 0-delta im lặng · outside.txt không bị nuốt) |
| **③ Cặp /pause + /tiep — MỘT đường recovery** | **executed + sweep-verified** | `.claude/commands/pause.md` (5-bước, commit-TRƯỚC-tuyên-bố, KHÔNG add -A, KHÔNG push) + `tiep.md` (4-bước, ground-truth-thắng-sửa-WAL-trước, nhánh `wf:` relaunch-cắt-gọt, CẤM transcript, memory-pack re-derive, same-session-only); reviewer grep toàn-repo: **mọi con-trỏ recovery = MỘT đường `/tiep`**, 0 đường thứ hai; ⚡ skill-registry đăng-ký `/pause`+`/tiep` NGAY giữa phiên (hiệu-lực đầy-đủ verify phiên mới) |
| **④ Delta mở/đóng phiên** (WAL-check · squash trailing chưa-push · reset cuối) | **executed** (squash-THẬT = commit-chốt phiên này, xem honest) | `session-start.md` **BƯỚC 0.7** (sau 0.6, ngoại-lệ CHỜ duy-nhất, chỉ con-trỏ B1) + `session-end.md` **§5.0** squash (`origin/main..HEAD` — không bao giờ rewrite đã-push; +review-diff wal-paths = AS-10 backstop dời không mất) + **§6.4** reset-WAL bước cuối; reviewer dry-simulate với trạng-thái thật: K=2 → về đúng `318a271`==origin/main, 0 rewrite |
| **⑤ WAL-cho-workflow** (snapshot args · `wf:` 5-trường · harvest-liền · relaunch-cắt-gọt · mandate per-agent-file ≥3-task/>5' · trung-thực mất-mát) | **executed + dogfood CÙNG PHIÊN** | `workflows/README.md` FLIP-policy + bảng (mode-A nhỏ vẫn hợp lệ) + `runs/README.md` template `## taskList snapshot` + `hmw.js:9/:19` mandate-comment (node --check PASS; 0 code-change) + engine **N.5** honest per-TURN≠per-TASK; dogfood: chính WF `wf_5ba3daf6-fe0` chạy RUN-TRACE + run.md có taskList-snapshot (hồi-tố — bootstrap-paradox tự khai) + dòng `wf:` 5-trường sống trong WAL + harvest-liền synthesis per-turn; **minh chứng sống N9**: return W3 bị notification-truncate nhưng `sub-task-2.md` trên đĩa còn nguyên → lead disk-verify |
| **Honest (a)-(e) đủ + codify** | **executed** | Engine **PHẦN N.7** đủ 5 (reviewer verify từng cái — (b) đọc ACTIVE-MARKS thật 5 mark: 0 mark cấm-hook; (e) Dropbox 2-chiều: risk index.lock + bonus .git-sync durability) + CAVEAT No-OS-hook honest-update ngoại-lệ đích-danh + `rules.md §5.2` exception `wal:` + `CLAUDE.md` con-trỏ 2-dòng |
## Tailored / phát-hiện-riêng / honest-caveat
- **Tailored form:** hook = **PowerShell `.ps1`** thay bash nguồn (sàn semantics GIỮ NGUYÊN: per-path + CAND + exit-0 + 4 CẤM) — evidence 3-context PATH conflict (lead PS-context → `system32\bash.exe` WSL-HỎNG execvpe-fail · invest cmd-context → Git-Bash trước · reviewer PS-from-GitBash → `usr\bin\bash`); exec-env hook không xác định trước → `powershell.exe` (system32) resolve MỌI context. Nếu dùng `bash` như nguồn và exec-env rơi vào WSL-hỏng → hook chết MỌI lượt mà fail-open che mất (persist=0 âm thầm — đúng lớp ghost-wire). Giữ tên lệnh nguồn `/pause`·`/tiep` (0 trùng 16 command hiện có, đồng bộ fleet).
- **Phát-hiện-riêng #1 — Stop-hook HOT-RELOAD trên harness SE:** settings.json tạo 11:00:52 GIỮA phiên → hook fire 11:05:39 KHÔNG restart (giả-định honest-(c) nguồn "chỉ nạp lúc khởi-động" đảo trên env này). Reviewer refute 3-hướng đều GÃY (forensics NTFS×git: commit rơi 7s sau khi ps1 sinh, GIỮA cửa sổ worker; restart-giả-thuyết mâu thuẫn WF 7.8' liên tục 3/3-DONE; fire lần 2 chứng kiến sống). ⚠️ **ENV-DEPENDENT — KHÔNG fleet-generalize** (data-point #2 sau skill-registry hot-reload; hub từng NGƯỢC kết quả registry): phiên MỚI vẫn re-check 1 lần. → N.3 nâng STAGED→**VERIFIED-RUNTIME S111** (nguyên tắc STAGED-until-verified GIỮ cho hook tương-lai).
- **Phát-hiện-riêng #2 — reviewer bịt lỗ bằng-chứng 0-delta:** lead định "quan sát tự nhiên" ca-2 (absence-of-commit KHÔNG phân biệt được "0-delta im lặng" vs "không fire") → reviewer fault-inject ca-2 chứng tường minh. Lesson: nhánh-im-lặng của cơ-chế fail-open PHẢI chứng bằng inject, không bằng quan-sát-vắng-mặt.
- **Phát-hiện-riêng #3 — per-agent-file cứu return thật (N9 minh chứng sống):** W3 return bị notification-truncate NGAY TRONG run adopt → `sub-task-2.md` trên đĩa nguyên vẹn, lead disk-verify đủ. Sàn "≥3 task = per-agent-file" tự chứng minh giá trị trong chính lượt adopt nó.
- **Honest-caveat:** (i) **pilot CHƯA chạy đủ tại SE** — đã có: hook-FIRE ×2 + fault-inject 2-ca + squash-THẬT tại commit-chốt phiên này (dogfood K≥2) + dogfood ghi-chain trọn phiên; CHƯA có: kill-giữa-chain → `/tiep` thật · đổi-tài-khoản · hook-fire re-check phiên mới · pause-roundtrip 1 workflow THẬT (→ HANDOFF pilot-checklist NEXT-anh); (ii) enforcement "lead ghi WAL sau mỗi subtask" = **convention kỷ-luật** (không công-cụ-ép; C5 detector chỉ bắt >40 dòng); (iii) hooks hot-reload = **env-dependent**, không claim phổ-quát; (iv) commit `wal:` chứa `memory-budget.json` khả-năng → CI trigger AS-6 pattern known-benign (squash gộp về commit-chốt nên push-set ≡ hôm nay — profile KHÔNG tăng, invest N3 verified); **D10 option chờ anh:** deploy.yml paths-ignore +`.claude/agent-memory/**` +`.claude/workflows/runs/**` triệt noise (KHÔNG làm trong đợt này); (v) mark H22 = quyền anh — đề xuất trình, **CHƯA stamp** (P8).
- **0-garble 2/2 lane Fable** (invest + reviewer — VERDICT-header + narrow-return mitigation; đối chiếu S110 ×2-garble: streak cải thiện, correlation reasoning-lane vẫn theo dõi).

View File

@ -398,8 +398,24 @@ SE đã có RAG golden-set harness (KHÔNG phải gap): `eval/golden-set-solutio
---
## PHẦN N — Harness-22: WAL session-continuity (sổ mạch-việc + hook persist + /pause /tiep) (🔴 FUNCTION-FLOOR + 🟡 form)
> Adopt S111 (2026-07-12) từ broadcast `2026-07-11-Governance-harness-22-wal-session-continuity` (body-sha `3de0758a` verified; ≙ AI_INFRA CANONICAL §I4 + §H1). Giải: phiên chết giữa mạch việc (limit/crash/tắt-máy/đổi-acc/chết-giữa-workflow) → mất trí-nhớ chưa-ghi + đốt-lại token. **"WAL" ở đây = sổ-liên-tục-phiên** — KHÁC "WAL RUN-LEDGER hai-nhịp" đã retired H18-B (trùng chữ, khác cơ-chế; alias-map awareness).
- **N.1 Sổ WAL (🔴):** `.claude/WAL.md` **≤40 dòng, ghi-đè toàn-file KHÔNG append**; `chain:` mục `[x]/[!]/[ ]` **KÈM bằng-chứng lệnh** (không mô-tả suông) + `next:` đúng 1 mệnh-lệnh + `verify:` ≥1 lệnh CHẠY ĐƯỢC, chạy TRƯỚC next — **ground-truth thắng WAL** (lệch → sửa WAL cho khớp thực-tế rồi mới đi). **CẤM secret** (file được commit). Template rỗng → `session-end §6.4`.
- **N.2 Hai tầng ghi (🔴):** tầng NỘI-DUNG = **lead single-writer** (D9-consistent), ghi lại sau MỖI subtask đổi trạng-thái (kể cả lúc phóng + thu workflow-run). Tầng PERSIST = **Stop-hook `.claude/hooks/wal-flush.ps1`** deterministic (PS1 — chọn path-independent vì PATH-order bash 2-context Windows ngược nhau, lead-verified S111): hook **ĐƯỢC làm đúng 2 việc** = `git add` per-path 3 path cố định {`.claude/WAL.md` · `.claude/agent-memory/` · `.claude/workflows/runs/`} + commit CAND-only message `wal: flush <ts>`; hook **KHÔNG-ĐƯỢC** = sinh/sửa nội-dung · push · block-stop · đụng path ngoài list · exit≠0 (fail-open MỌI nhánh). Per-path add + CAND chống bẫy all-or-nothing đa-pathspec (bài học test-proven nguồn).
- **N.3 Trạng-thái hook = ✅ VERIFIED-RUNTIME S111 CÙNG PHIÊN (nâng từ STAGED-until-verified — chống ghost-wire S100 bằng bằng-chứng THẬT):** hooks-entry `.claude/settings.json` ghi S111 → Stop-hook **HOT-RELOAD + FIRE ngay giữa phiên** (KHÔNG cần restart): commit **`12071c5 "wal: flush 20260712T1105"`** chứa ĐÚNG 4 file thuộc 3 path cố định (WAL.md + diary invest + run.md + spec), CAND-commit chuẩn (settings.json/broadcasts/docs đứng NGOÀI — persist-only đúng thiết kế), 0 push. Giả-định honest-(c) nguồn "hook chỉ nạp lúc khởi-động phiên" → trên harness NÀY = hot-reload; ⚠️ **ENV-DEPENDENT** (data-point #2 sau skill-registry hot-reload S107/S111 — hub từng NGƯỢC kết quả, KHÔNG fleet-generalize; phiên MỚI vẫn re-check 1 lần trong pilot-checklist, không fire → thử schema phẳng). *(Nấc trước khi có bằng-chứng = STAGED-until-verified: CẤM claim "đang chạy" khi chưa thấy wal:-commit do hook sinh — nguyên tắc GIỮ cho mọi hook tương-lai.)*
- **N.4 Một đường recovery (🔴):** `/pause` (chốt điểm dừng: flush-dirty → WAL-đúng-schema → commit đích-danh `wal: pause` TRƯỚC tuyên-bố an-toàn → DỪNG HẲN) + `/tiep` (đọc WAL → chạy TOÀN BỘ verify + `git status` + disk run-folder → lệch = tin ground-truth → thực-thi next; nhánh `wf:` = relaunch-cắt-gọt). **MỌI con-trỏ recovery trỏ về MỘT chỗ = `/tiep`** (kể cả anh gõ "làm tiếp" text thường); CẤM nạp lại transcript cũ. Delta session-cmd: `session-start BƯỚC 0.7` WAL-check (ngoại-lệ CHỜ duy-nhất, chỉ con-trỏ) · `session-end §5.0` squash `wal:`-trailing CHƯA-push (`origin/main..HEAD`, KHÔNG BAO GIỜ rewrite đã-push; squash-điểm = review-diff wal-paths, AS-10 backstop dời về đây không mất) · `§6.4` reset WAL = bước cuối.
- **N.5 WAL-cho-workflow (🔴 sàn owner-nguồn):** run **≥3 task HOẶC ước >5 phút = BẮT BUỘC RUN-TRACE mode** (`args.run` — per-agent-file `sub-<role>-<i>.md`; chết giữa run còn vật-liệu trên đĩa); run.md +`## taskList snapshot` ghi TRƯỚC launch (spec đã on-disk per H21 — sàn {task-list · spec} đủ); dòng `wf:<mục-đích> run= runId= args= done=k/N harvested=` vào WAL NGAY SAU launch; **harvest-LIỀN** mỗi task xong (C4 per-turn ĐÃ CÓ — honest granularity: per-TURN ≠ per-TASK, `parallel()` trả cả batch cuối turn + Stop-hook cũng fire ở turn-boundary → chết GIỮA turn = returns mất, per-agent-file trên DISK là lớp cứu → `/tiep` đọc CẢ disk); `/tiep` nhánh wf: = **relaunch-ĐÃ-CẮT-GỌT** (grep run-id log-phiên = bằng-chứng đích-danh · harvest-hồi-tố partial-honest · relaunch CHỈ task còn lại · memory-pack **RE-DERIVE TƯƠI, CẤM snapshot**); resume-by-run-id = bonus **SAME-SESSION-ONLY** (CẤM claim cross-session). Trung-thực mất-mát tối-đa: agent song-song đang-chạy tại thời-điểm chết mất phần dở; run nhỏ ngoài diện WAL-hóa có thể mất cả run — rủi-ro chấp-nhận công-khai.
- **N.6 Commit-convention exception:** commit `wal:` (hook-flush + `/pause` + WAL-reset) = **ngoại-lệ DUY-NHẤT** của format `[CLAUDE] <scope>` — máy sinh, KHÔNG Co-Authored-By, bị squash vào commit-chốt trước push (`rules.md §5.2` mirror).
- **N.7 Honest (a)-(e) áp SE:** (a) **pilot CHƯA chạy đủ tại SE** — dựng + codify + **hook-FIRE-verified S111** (`12071c5`/`67be443`; script-RUN tay BỎ — bằng-chứng mạnh hơn thay thế + reviewer fault-inject 2-ca bịt nhánh 0-delta); kill-test / đổi-acc / squash-thật / pause-roundtrip-workflow = phiên mới + anh (HANDOFF pilot-checklist) · (b) SE **0 mark cấm-hook** (5 Active-High không đụng); engine CAVEAT "No-OS-hook" = MÔ-TẢ hiện-trạng đã honest-update ngoại-lệ đích-danh; E.3 chỉ cấm hook-làm-GATE — persist-only 0-content tương-thích; thứ-tự codify-trước-enable tôn trọng CÙNG-COMMIT S111 · (c) schema hooks nested = default, verify ở PHIÊN MỚI, không fire → thử flat · (d) resume-run-id cross-session CHƯA kiểm-chứng — đường chính = relaunch-cắt-gọt · (e) **repo SE TRONG Dropbox — 2 chiều:** risk `index.lock` khi cloud-sync đụng git (thấp-nhưng-có; hook fail-open tự-lành lượt sau) + bonus Dropbox sync cả `.git` → commit local CHƯA-push vẫn sống qua tắt-máy/đổi-máy → `/pause` không cần push vẫn durable.
**Honest nấc §N:** mechanized-THẬT = hook-script deterministic (persist) + template + acceptance grep; convention = lead ghi nội-dung WAL sau mỗi subtask (kỷ-luật, không công-cụ-ép) + squash/reset trong thân session-end do em-main kích. Dogfood S111 = tầng nội-dung (WAL-chain thật trong phiên adopt) + script-RUN tay; hook-FIRE + full-pilot = nấc kế.
---
## CAVEAT (trung-thực — đọc trước khi tự nhận "đã tự-bảo-trì")
- **No-OS-hook:** detector + gate chạy TRONG thân session-start/end body do em-main kích — KHÔNG fully-autonomous. Đúng mức: **DÒ tự-động + toàn-diện; SỬA + GÁC dựa người-chủ-trì.**
- **No-OS-hook:** detector + gate chạy TRONG thân session-start/end body do em-main kích — KHÔNG fully-autonomous. Đúng mức: **DÒ tự-động + toàn-diện; SỬA + GÁC dựa người-chủ-trì.** **Ngoại-lệ đích-danh (S111 H22):** Stop-hook `wal-flush.ps1` persist-only (PHẦN N) — 0-content, fail-open, KHÔNG phải gate (E.3-compatible: không cưỡng-chế hành-vi, chỉ persist trạng-thái xuống đĩa); ✅ VERIFIED-RUNTIME S111 (N.3 — `12071c5` + `67be443` fire thật; STAGED-until-verified giữ làm NGUYÊN TẮC cho hook tương-lai).
- **Auto-WRITE luật/copy = MỐI-NGUY #1, CỐ Ý CHƯA LÀM** — defer tới ≥2 sự-cố thật mà thủ-công thất-bại (hiện 0). Chọn nhánh chỉ-DÒ-NÊU-CỜ cho mọi thứ chạm luật/copy (1-sửa-sai → N-chỗ-sai + phá hash broadcast đóng-băng).
- **Single-writer bar-không-hạ** — cám-dỗ "để nó tự sửa cho nhanh" phải dừng trước chốt D9.
- **Detector = LƯỚI giảm-sót, KHÔNG khoá-cứng** — bắt @đầu/đóng-phiên (theo nhịp); giữa 2 nhịp có khoảng-mù. Phòng-thủ-nhiều-lớp, không bảo-đảm tuyệt-đối.