v1.26.4.0 fix: GSTACK REVIEW REPORT delete-then-append (no more mid-file leftovers) (#1335)

* fix: GSTACK REVIEW REPORT delete-then-append flow

Replaces contradictory "replace it entirely" + "always last section / move
if mid-file" bullets in scripts/resolvers/review.ts with a single
delete-then-append rule. Adds Read-tool verification step so the agent
self-checks before continuing.

Affected SKILL.md files (regenerated): plan-ceo-review, plan-design-review,
plan-devex-review, plan-eng-review, codex, devex-review.

* test: static template assertions for delete-then-append + revert autoplan E2E shape

5 new static tests in test/gen-skill-docs.test.ts (4 plan-review SKILL.md
files + 1 source resolver) verify the new prompt language is present and
the old contradictory bullets are absent. Synthetic regression check
confirmed all 5 fail when the prompt fix is reverted.

The autoplan E2E (skill-e2e-autoplan-auto-mode.test.ts) reverts to its
original AUQ-blocked-gate-surface shape. The mid-file regression scenario
the plan briefly proposed isn't reachable in the current PTY harness because
--disallowedTools AskUserQuestion makes autoplan bail at the Phase 1
premise gate before any review-write code path runs. Static prompt-text
verification covers the load-bearing change.

* chore: bump version and changelog (v1.26.4.0)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-05-05 21:18:35 -07:00
committed by GitHub
parent db9447c333
commit 19e699ab9b
12 changed files with 244 additions and 65 deletions
+23 -9
View File
@@ -133,15 +133,29 @@ Below the table, add these lines (omit any that are empty/not applicable):
file you are allowed to edit in plan mode. The plan file review report is part of the
plan's living status.
- Search the plan file for a \\\`## GSTACK REVIEW REPORT\\\` section **anywhere** in the file
(not just at the end — content may have been added after it).
- If found, **replace it** entirely using the Edit tool. Match from \\\`## GSTACK REVIEW REPORT\\\`
through either the next \\\`## \\\` heading or end of file, whichever comes first. This ensures
content added after the report section is preserved, not eaten. If the Edit fails
(e.g., concurrent edit changed the content), re-read the plan file and retry once.
- If no such section exists, **append it** to the end of the plan file.
- Always place it as the very last section in the plan file. If it was found mid-file,
move it: delete the old location and append at the end.`;
The report must always be the LAST section of the plan file — never mid-file.
Use a single delete-then-append flow:
1. Read the plan file (Read tool) to see its full current content. Search the read
output for a \\\`## GSTACK REVIEW REPORT\\\` heading anywhere in the file.
2. If found, use the Edit tool to DELETE the entire existing section. Match from
\\\`## GSTACK REVIEW REPORT\\\` through either the next \\\`## \\\` heading or end of
file, whichever comes first. Replace with the empty string. This applies
regardless of where the section currently lives — mid-file deletion is
intentional, not a special case. If the Edit fails (e.g., concurrent edit
changed the content), re-read the plan file and retry once.
3. After the delete (or skipped, if no section existed), append the new
\\\`## GSTACK REVIEW REPORT\\\` section at the END of the file. Use the Edit
tool to match the file's current last paragraph and add the section after it,
or use Write to re-emit the whole file with the section at the end.
4. Verify with the Read tool that \\\`## GSTACK REVIEW REPORT\\\` is the last
\\\`## \\\` heading in the file before continuing. If it isn't, repeat steps
2-3 once.
Do NOT replace the section in place. The "replace mid-file" path is what allowed
prior versions to leave the report mid-file when an older report already lived
there — the user then sees a plan whose review report is not at the bottom and
(correctly) rejects it.`;
}
export function generateSpecReviewLoop(_ctx: TemplateContext): string {