v0.5.1: disable apply_patch in agents prone to append-mode failures

Root cause: apply_patch finds anchor lines in read-cached file state,
but file may have been modified between read and patch, causing stalls.

Changes:
- dr-verifier: disable apply_patch AND edit; force read-then-write protocol for evidence file appends
- dr-analyst: document write-preferred protocol for sources.jsonl appends
- dr-polisher: disable apply_patch; keep edit for small string replacements
- dr-editor-in-chief / dr-translator: disable apply_patch

Recovery procedure documented in dr-verifier for write failures.
This commit is contained in:
kai
2026-04-21 14:44:03 +08:00
parent a092af4398
commit 333b7bb8d5
19 changed files with 2167 additions and 21 deletions
+12 -3
View File
@@ -114,9 +114,18 @@ Write to `projects/<slug>/phase2/evidence/chXX-evidence.md` (English).
### Step 7: Write to Files
- Draft: `projects/<slug>/phase2/drafts/chXX.md` (English)
- Evidence matrix: `projects/<slug>/phase2/evidence/chXX-evidence.md` (English)
- New sources appended: `projects/<slug>/phase2/sources.jsonl`
**File writing protocol (v0.5.1)** — prefer `write` over `edit`/`apply_patch` for these files, because they are created fresh by you:
- Draft: `projects/<slug>/phase2/drafts/chXX.md` (English) — use `write` to create
- Evidence matrix: `projects/<slug>/phase2/evidence/chXX-evidence.md` (English) — use `write` to create
- Sources: `projects/<slug>/phase2/sources.jsonl` — read current content, append new source lines in memory, then `write` the full new content (do NOT use `apply_patch` to append JSONL lines — it often fails on whitespace matching)
**If you need to revise a file you already wrote in this session** (e.g., after a self-check you want to extend a section):
1. `read` the file to get current content
2. Compose the new full content in memory
3. `write` the full content (overwrites atomically)
Do NOT use `apply_patch` to append content. This has caused task stalls in production (v0.4 lessons).
### Step 8: Report Back