fix(#571): forbid Write in doc-writer fix mode; add workflow truncation guard
* fix(#571): forbid Write in doc-writer fix mode; add workflow truncation guard gsd-doc-writer in fix mode only had Write in its tools list, so when correcting a specific failing claim it would re-emit the whole file with only the lines it had in context — truncating untracked docs with no git recovery path. Fix 1 (root cause): add Edit to the agent tools frontmatter and rewrite fix_mode instructions to mandate Edit for surgical corrections and explicitly forbid Write on existing files. Also reinforced in critical_rules. Fix 2 (safety net): add a post-fix line-count guard in the fix_loop step of docs-update.md. If the file shrank by >90% after a fix agent runs, the orchestrator restores the file from the existing_content it captured before dispatch and logs a WARNING. This makes the previously unrecoverable case recoverable. Regression test: tests/bug-571-doc-writer-fix-mode-edit-only.test.cjs covers both the agent contract and the workflow guard. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: add changeset for fix #571 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(#571): address codex adversarial review findings - Quote {doc_path} in shell snippets to handle paths with spaces (#SECURITY) - Clarify corrupted doc re-verification vs re-fix distinction (#CORRECTNESS) - Strengthen regression tests with structural ordering assertions (#REGRESSION) - Move docs-update.md from global ALLOWLIST to SIZE_ONLY_WORKFLOWS so injection scanning still runs while only the 50K size finding is exempt (#SECURITY) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
5
.changeset/sturdy-pumas-sing.md
Normal file
5
.changeset/sturdy-pumas-sing.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
type: Fixed
|
||||
pr: 571
|
||||
---
|
||||
gsd-doc-writer fix mode now uses the Edit tool for surgical corrections instead of Write. Previously, the fix_loop in docs-update.md could call gsd-doc-writer in fix mode with Write, truncating an untracked doc to a single line with no git recovery path. Adds a post-fix line-count guard in fix_loop that restores from pre-fix content if >90% shrinkage is detected.
|
||||
Reference in New Issue
Block a user