Skip to content

Commit 19e699a

Browse files
garrytanclaude
andauthored
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>
1 parent db9447c commit 19e699a

12 files changed

Lines changed: 244 additions & 65 deletions

File tree

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Changelog
22

3+
## [1.26.4.0] - 2026-05-05
4+
5+
## **`/autoplan` review reports now reliably land at the bottom of the plan, even when an older copy lives mid-file.**
6+
7+
The `## GSTACK REVIEW REPORT` section had a write rule that contradicted itself: one bullet said "replace it entirely (in place)" while another said "always last section, move if mid-file." When the agent inherited a plan whose prior `/autoplan` run had landed before user-added sections, the in-place replace path won and the new report stayed mid-file. The user opened ExitPlanMode, saw their plan with no review at the bottom, and had to ask twice. Single delete-then-append rule now, with a Read-tool verification step before the next instruction runs.
8+
9+
### What you can now do
10+
11+
- **Run `/autoplan` against a plan that already has a stale `## GSTACK REVIEW REPORT` mid-file and trust the new report ends up at the bottom.** The instruction in `scripts/resolvers/review.ts` (which feeds `/plan-ceo-review`, `/plan-eng-review`, `/plan-design-review`, `/plan-devex-review`, `/codex`, `/devex-review`) now reads as one rule: search for any existing report section, delete it wherever it lives, append a fresh report at end of file, verify with the Read tool that the report is the last `##` heading. No more contradiction for the agent to reconcile.
12+
13+
### What gets safer
14+
15+
- **Five static template assertions in `test/gen-skill-docs.test.ts` lock the prompt change against drift.** Each plan-review SKILL.md (4 of them) plus the source resolver are checked for the new "delete-then-append flow" / "never mid-file" / "Do NOT replace the section in place" markers AND the absence of the old "replace it** entirely using the Edit tool" / "If it was found mid-file, move it" bullets. Synthetic regression check confirmed: all 5 fail when the prompt is reverted, all 5 pass when restored. The tests are bound to the change, not to incidentally green output.
16+
17+
### Itemized changes
18+
19+
#### Changed
20+
- `scripts/resolvers/review.ts` — "Write to the plan file" subsection rewritten. Old contradictory pair ("replace it entirely" vs "always last / move if mid-file") collapsed into a single 4-step delete-then-append flow with explicit verification.
21+
- All 6 generated SKILL.md files refreshed to carry the new instruction: `plan-ceo-review`, `plan-design-review`, `plan-devex-review`, `plan-eng-review`, `codex`, `devex-review`.
22+
23+
#### Added
24+
- `test/gen-skill-docs.test.ts` — new `GSTACK REVIEW REPORT delete-then-append flow` describe block: 4 SKILL.md target tests + 1 source resolver test. Static, deterministic, free.
25+
26+
#### For contributors
27+
- The `/autoplan` E2E approach attempted in the plan was dropped after a paid run revealed that `--disallowedTools AskUserQuestion` makes autoplan bail at the Phase 1 premise gate via the plan-file fallback. The PTY harness can't drive autoplan through its review phases without auto-progression of AskUserQuestions. The static prompt-text test catches the load-bearing change without needing that infrastructure.
28+
329
## [1.26.3.0] - 2026-05-03
430

531
## **`/sync-gbrain` keeps your brain current and teaches the agent when to use it.**

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.26.3.0
1+
1.26.4.0

codex/SKILL.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,15 +1047,29 @@ Below the table, add these lines (omit any that are empty/not applicable):
10471047
file you are allowed to edit in plan mode. The plan file review report is part of the
10481048
plan's living status.
10491049

1050-
- Search the plan file for a \`## GSTACK REVIEW REPORT\` section **anywhere** in the file
1051-
(not just at the end — content may have been added after it).
1052-
- If found, **replace it** entirely using the Edit tool. Match from \`## GSTACK REVIEW REPORT\`
1053-
through either the next \`## \` heading or end of file, whichever comes first. This ensures
1054-
content added after the report section is preserved, not eaten. If the Edit fails
1055-
(e.g., concurrent edit changed the content), re-read the plan file and retry once.
1056-
- If no such section exists, **append it** to the end of the plan file.
1057-
- Always place it as the very last section in the plan file. If it was found mid-file,
1058-
move it: delete the old location and append at the end.
1050+
The report must always be the LAST section of the plan file — never mid-file.
1051+
Use a single delete-then-append flow:
1052+
1053+
1. Read the plan file (Read tool) to see its full current content. Search the read
1054+
output for a \`## GSTACK REVIEW REPORT\` heading anywhere in the file.
1055+
2. If found, use the Edit tool to DELETE the entire existing section. Match from
1056+
\`## GSTACK REVIEW REPORT\` through either the next \`## \` heading or end of
1057+
file, whichever comes first. Replace with the empty string. This applies
1058+
regardless of where the section currently lives — mid-file deletion is
1059+
intentional, not a special case. If the Edit fails (e.g., concurrent edit
1060+
changed the content), re-read the plan file and retry once.
1061+
3. After the delete (or skipped, if no section existed), append the new
1062+
\`## GSTACK REVIEW REPORT\` section at the END of the file. Use the Edit
1063+
tool to match the file's current last paragraph and add the section after it,
1064+
or use Write to re-emit the whole file with the section at the end.
1065+
4. Verify with the Read tool that \`## GSTACK REVIEW REPORT\` is the last
1066+
\`## \` heading in the file before continuing. If it isn't, repeat steps
1067+
2-3 once.
1068+
1069+
Do NOT replace the section in place. The "replace mid-file" path is what allowed
1070+
prior versions to leave the report mid-file when an older report already lived
1071+
there — the user then sees a plan whose review report is not at the bottom and
1072+
(correctly) rejects it.
10591073

10601074
---
10611075

devex-review/SKILL.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,15 +1153,29 @@ Below the table, add these lines (omit any that are empty/not applicable):
11531153
file you are allowed to edit in plan mode. The plan file review report is part of the
11541154
plan's living status.
11551155

1156-
- Search the plan file for a \`## GSTACK REVIEW REPORT\` section **anywhere** in the file
1157-
(not just at the end — content may have been added after it).
1158-
- If found, **replace it** entirely using the Edit tool. Match from \`## GSTACK REVIEW REPORT\`
1159-
through either the next \`## \` heading or end of file, whichever comes first. This ensures
1160-
content added after the report section is preserved, not eaten. If the Edit fails
1161-
(e.g., concurrent edit changed the content), re-read the plan file and retry once.
1162-
- If no such section exists, **append it** to the end of the plan file.
1163-
- Always place it as the very last section in the plan file. If it was found mid-file,
1164-
move it: delete the old location and append at the end.
1156+
The report must always be the LAST section of the plan file — never mid-file.
1157+
Use a single delete-then-append flow:
1158+
1159+
1. Read the plan file (Read tool) to see its full current content. Search the read
1160+
output for a \`## GSTACK REVIEW REPORT\` heading anywhere in the file.
1161+
2. If found, use the Edit tool to DELETE the entire existing section. Match from
1162+
\`## GSTACK REVIEW REPORT\` through either the next \`## \` heading or end of
1163+
file, whichever comes first. Replace with the empty string. This applies
1164+
regardless of where the section currently lives — mid-file deletion is
1165+
intentional, not a special case. If the Edit fails (e.g., concurrent edit
1166+
changed the content), re-read the plan file and retry once.
1167+
3. After the delete (or skipped, if no section existed), append the new
1168+
\`## GSTACK REVIEW REPORT\` section at the END of the file. Use the Edit
1169+
tool to match the file's current last paragraph and add the section after it,
1170+
or use Write to re-emit the whole file with the section at the end.
1171+
4. Verify with the Read tool that \`## GSTACK REVIEW REPORT\` is the last
1172+
\`## \` heading in the file before continuing. If it isn't, repeat steps
1173+
2-3 once.
1174+
1175+
Do NOT replace the section in place. The "replace mid-file" path is what allowed
1176+
prior versions to leave the report mid-file when an older report already lived
1177+
there — the user then sees a plan whose review report is not at the bottom and
1178+
(correctly) rejects it.
11651179

11661180
## Capture Learnings
11671181

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gstack",
3-
"version": "1.26.3.0",
3+
"version": "1.26.4.0",
44
"description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.",
55
"license": "MIT",
66
"type": "module",

plan-ceo-review/SKILL.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,15 +1958,29 @@ Below the table, add these lines (omit any that are empty/not applicable):
19581958
file you are allowed to edit in plan mode. The plan file review report is part of the
19591959
plan's living status.
19601960

1961-
- Search the plan file for a \`## GSTACK REVIEW REPORT\` section **anywhere** in the file
1962-
(not just at the end — content may have been added after it).
1963-
- If found, **replace it** entirely using the Edit tool. Match from \`## GSTACK REVIEW REPORT\`
1964-
through either the next \`## \` heading or end of file, whichever comes first. This ensures
1965-
content added after the report section is preserved, not eaten. If the Edit fails
1966-
(e.g., concurrent edit changed the content), re-read the plan file and retry once.
1967-
- If no such section exists, **append it** to the end of the plan file.
1968-
- Always place it as the very last section in the plan file. If it was found mid-file,
1969-
move it: delete the old location and append at the end.
1961+
The report must always be the LAST section of the plan file — never mid-file.
1962+
Use a single delete-then-append flow:
1963+
1964+
1. Read the plan file (Read tool) to see its full current content. Search the read
1965+
output for a \`## GSTACK REVIEW REPORT\` heading anywhere in the file.
1966+
2. If found, use the Edit tool to DELETE the entire existing section. Match from
1967+
\`## GSTACK REVIEW REPORT\` through either the next \`## \` heading or end of
1968+
file, whichever comes first. Replace with the empty string. This applies
1969+
regardless of where the section currently lives — mid-file deletion is
1970+
intentional, not a special case. If the Edit fails (e.g., concurrent edit
1971+
changed the content), re-read the plan file and retry once.
1972+
3. After the delete (or skipped, if no section existed), append the new
1973+
\`## GSTACK REVIEW REPORT\` section at the END of the file. Use the Edit
1974+
tool to match the file's current last paragraph and add the section after it,
1975+
or use Write to re-emit the whole file with the section at the end.
1976+
4. Verify with the Read tool that \`## GSTACK REVIEW REPORT\` is the last
1977+
\`## \` heading in the file before continuing. If it isn't, repeat steps
1978+
2-3 once.
1979+
1980+
Do NOT replace the section in place. The "replace mid-file" path is what allowed
1981+
prior versions to leave the report mid-file when an older report already lived
1982+
there — the user then sees a plan whose review report is not at the bottom and
1983+
(correctly) rejects it.
19701984

19711985
## Next Steps — Review Chaining
19721986

plan-design-review/SKILL.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,15 +1722,29 @@ Below the table, add these lines (omit any that are empty/not applicable):
17221722
file you are allowed to edit in plan mode. The plan file review report is part of the
17231723
plan's living status.
17241724

1725-
- Search the plan file for a \`## GSTACK REVIEW REPORT\` section **anywhere** in the file
1726-
(not just at the end — content may have been added after it).
1727-
- If found, **replace it** entirely using the Edit tool. Match from \`## GSTACK REVIEW REPORT\`
1728-
through either the next \`## \` heading or end of file, whichever comes first. This ensures
1729-
content added after the report section is preserved, not eaten. If the Edit fails
1730-
(e.g., concurrent edit changed the content), re-read the plan file and retry once.
1731-
- If no such section exists, **append it** to the end of the plan file.
1732-
- Always place it as the very last section in the plan file. If it was found mid-file,
1733-
move it: delete the old location and append at the end.
1725+
The report must always be the LAST section of the plan file — never mid-file.
1726+
Use a single delete-then-append flow:
1727+
1728+
1. Read the plan file (Read tool) to see its full current content. Search the read
1729+
output for a \`## GSTACK REVIEW REPORT\` heading anywhere in the file.
1730+
2. If found, use the Edit tool to DELETE the entire existing section. Match from
1731+
\`## GSTACK REVIEW REPORT\` through either the next \`## \` heading or end of
1732+
file, whichever comes first. Replace with the empty string. This applies
1733+
regardless of where the section currently lives — mid-file deletion is
1734+
intentional, not a special case. If the Edit fails (e.g., concurrent edit
1735+
changed the content), re-read the plan file and retry once.
1736+
3. After the delete (or skipped, if no section existed), append the new
1737+
\`## GSTACK REVIEW REPORT\` section at the END of the file. Use the Edit
1738+
tool to match the file's current last paragraph and add the section after it,
1739+
or use Write to re-emit the whole file with the section at the end.
1740+
4. Verify with the Read tool that \`## GSTACK REVIEW REPORT\` is the last
1741+
\`## \` heading in the file before continuing. If it isn't, repeat steps
1742+
2-3 once.
1743+
1744+
Do NOT replace the section in place. The "replace mid-file" path is what allowed
1745+
prior versions to leave the report mid-file when an older report already lived
1746+
there — the user then sees a plan whose review report is not at the bottom and
1747+
(correctly) rejects it.
17341748

17351749
## Capture Learnings
17361750

plan-devex-review/SKILL.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,15 +1926,29 @@ Below the table, add these lines (omit any that are empty/not applicable):
19261926
file you are allowed to edit in plan mode. The plan file review report is part of the
19271927
plan's living status.
19281928

1929-
- Search the plan file for a \`## GSTACK REVIEW REPORT\` section **anywhere** in the file
1930-
(not just at the end — content may have been added after it).
1931-
- If found, **replace it** entirely using the Edit tool. Match from \`## GSTACK REVIEW REPORT\`
1932-
through either the next \`## \` heading or end of file, whichever comes first. This ensures
1933-
content added after the report section is preserved, not eaten. If the Edit fails
1934-
(e.g., concurrent edit changed the content), re-read the plan file and retry once.
1935-
- If no such section exists, **append it** to the end of the plan file.
1936-
- Always place it as the very last section in the plan file. If it was found mid-file,
1937-
move it: delete the old location and append at the end.
1929+
The report must always be the LAST section of the plan file — never mid-file.
1930+
Use a single delete-then-append flow:
1931+
1932+
1. Read the plan file (Read tool) to see its full current content. Search the read
1933+
output for a \`## GSTACK REVIEW REPORT\` heading anywhere in the file.
1934+
2. If found, use the Edit tool to DELETE the entire existing section. Match from
1935+
\`## GSTACK REVIEW REPORT\` through either the next \`## \` heading or end of
1936+
file, whichever comes first. Replace with the empty string. This applies
1937+
regardless of where the section currently lives — mid-file deletion is
1938+
intentional, not a special case. If the Edit fails (e.g., concurrent edit
1939+
changed the content), re-read the plan file and retry once.
1940+
3. After the delete (or skipped, if no section existed), append the new
1941+
\`## GSTACK REVIEW REPORT\` section at the END of the file. Use the Edit
1942+
tool to match the file's current last paragraph and add the section after it,
1943+
or use Write to re-emit the whole file with the section at the end.
1944+
4. Verify with the Read tool that \`## GSTACK REVIEW REPORT\` is the last
1945+
\`## \` heading in the file before continuing. If it isn't, repeat steps
1946+
2-3 once.
1947+
1948+
Do NOT replace the section in place. The "replace mid-file" path is what allowed
1949+
prior versions to leave the report mid-file when an older report already lived
1950+
there — the user then sees a plan whose review report is not at the bottom and
1951+
(correctly) rejects it.
19381952

19391953
## Capture Learnings
19401954

plan-eng-review/SKILL.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,15 +1537,29 @@ Below the table, add these lines (omit any that are empty/not applicable):
15371537
file you are allowed to edit in plan mode. The plan file review report is part of the
15381538
plan's living status.
15391539

1540-
- Search the plan file for a \`## GSTACK REVIEW REPORT\` section **anywhere** in the file
1541-
(not just at the end — content may have been added after it).
1542-
- If found, **replace it** entirely using the Edit tool. Match from \`## GSTACK REVIEW REPORT\`
1543-
through either the next \`## \` heading or end of file, whichever comes first. This ensures
1544-
content added after the report section is preserved, not eaten. If the Edit fails
1545-
(e.g., concurrent edit changed the content), re-read the plan file and retry once.
1546-
- If no such section exists, **append it** to the end of the plan file.
1547-
- Always place it as the very last section in the plan file. If it was found mid-file,
1548-
move it: delete the old location and append at the end.
1540+
The report must always be the LAST section of the plan file — never mid-file.
1541+
Use a single delete-then-append flow:
1542+
1543+
1. Read the plan file (Read tool) to see its full current content. Search the read
1544+
output for a \`## GSTACK REVIEW REPORT\` heading anywhere in the file.
1545+
2. If found, use the Edit tool to DELETE the entire existing section. Match from
1546+
\`## GSTACK REVIEW REPORT\` through either the next \`## \` heading or end of
1547+
file, whichever comes first. Replace with the empty string. This applies
1548+
regardless of where the section currently lives — mid-file deletion is
1549+
intentional, not a special case. If the Edit fails (e.g., concurrent edit
1550+
changed the content), re-read the plan file and retry once.
1551+
3. After the delete (or skipped, if no section existed), append the new
1552+
\`## GSTACK REVIEW REPORT\` section at the END of the file. Use the Edit
1553+
tool to match the file's current last paragraph and add the section after it,
1554+
or use Write to re-emit the whole file with the section at the end.
1555+
4. Verify with the Read tool that \`## GSTACK REVIEW REPORT\` is the last
1556+
\`## \` heading in the file before continuing. If it isn't, repeat steps
1557+
2-3 once.
1558+
1559+
Do NOT replace the section in place. The "replace mid-file" path is what allowed
1560+
prior versions to leave the report mid-file when an older report already lived
1561+
there — the user then sees a plan whose review report is not at the bottom and
1562+
(correctly) rejects it.
15491563

15501564
## Capture Learnings
15511565

0 commit comments

Comments
 (0)