/ship's existing-PR step does not ask the agent to check gstack-post's "kept" list, so a re-run can leave an earlier run's sections in the PR body
What happens
We re-ran /ship on an open PR after merging the base. Step 19 composed a fresh body, as ship/sections/pr-body.md.tmpl:73 says ("never reuse a prior run's body"), and posted it with the existing-PR command at :281, gstack-post pr-body <pr-number> --body-file …. It printed:
gstack-post: pr-body merged by section: replaced leading text, Summary, Blast radius, Test Coverage, Pre-Landing Review, Review notes, Exploratory QA, Design Review, Eval Results, Scope Drift, Plan Completion, Verification Results, TODOS, Documentation, Test plan, Agent notes; kept Discrimination test, Tests; added Review bot comments
The two kept sections were in the PR body from before this run. We believe the earlier /ship run's agent wrote them (the template lists neither), but the merge cannot know that. They described the earlier head as if current: a regression check run against an older base commit, with that run's pass counts, under a body whose other sections now described the new head. The kept ## Tests section ended with its own 🤖 Generated with … line, so the body carried that line twice.
The post exited 0, and the run took the **0** posted branch (:310), which goes straight to removing the temporary files. At main 0326b144, neither ship/SKILL.md.tmpl nor any ship/sections/*.md.tmpl mentions checking gstack-post's kept list.
gstack-post is doing what it documents: lib/gstack-post.ts:9-16 keeps sections the file does not rewrite, and docs/troubleshooting.md#gstack-post-pr-body-merge says under Fix.: "Nothing, when the kept sections are wanted. … To drop a section, post the body with --replace or edit it on the host." That is how we repaired it: the same composed file, posted with --replace. It already carried the receipt, and nothing kept was wanted; a body with sections a person added would need those carried into the file first. So this is a request for /ship's handling, not a merge defect.
What we expected
Either of these would have caught it:
- After an existing-PR post that reports
keptsections, Step 19 has the agent decide each one: leave a section a person added; for one an earlier /ship run wrote, drop it (rewrite the file with the person-added sections carried over, then--replace, or edit on the host). That rewrite would be a deliberate exception to:275("Never re-render the body: every retry sends the same files."), which is about retrying a failed post. The duplicate-title case keeps its own rule (:322: stop, a human picks the copy; never--replaceon your own). - New: /ship marks the sections it composes, so a later run's merge can tell an earlier run's sections from a person's and report or drop them. No marker covers the
##sections the agent composes (Summary, Test plan and the rest); the agent-notes marker and the receipt fence cover only the closing notes and the receipt.
Related: #3575 (closed: the merge kept a stale copy when a title appeared twice; here each title appears once).
How to reproduce
- /ship a branch to an open PR; in Step 19 the body includes a section the template does not list (for example
## Discrimination test). - Merge the base into the branch and run /ship again; this run's body does not include that section.
- Step 19 posts with
gstack-post pr-body <n> --body-file …; stderr lists the old section underkept, the PR body still shows it with the first run's results, and the run continues on exit 0.
Environment
- Claude Code 2.1.309 on Linux 7.0.0 (container); gstack 1.99.4.0 (81fb9008351d), doctor 15 ok, 0 warn, 0 fail
ship/sections/pr-body.md.tmpl,lib/gstack-post.ts,docs/troubleshooting.md,ship/SKILL.md.tmpland everyship/sections/*.md.tmplread atmain0326b144af36676d599dcf63a9fad9a870d22ed6 (pr-body.md.tmplandgstack-post.tsare the same blobs as in 1.99.4.0)
Thanks, this is a careful write-up. I confirmed that at main (0326b14) /ship's Step 19 (ship/sections/pr-body.md.tmpl) never looks at the kept list gstack-post prints, so a re-run can leave an earlier run's sections describing an older head. We re-run /ship on open PRs all the time, so this matters to us. We're taking the first option you described as a small fix to Step 19's instructions (decide each kept section, then post with --replace when an earlier run wrote it). Marking /ship's own sections would be new functionality and isn't part of this. It's queued behind other finished work, so it may take a few days.
Picking this up. A maintainer agent working through a batch of fixes (our tracking thread GSTA-803) will first reproduce this on current main. If it reproduces, the agent fixes it on main and we'll close this issue with a link when the change lands. If it no longer reproduces, we'll close it and say what changed.
Fixed in #4686 (merged as 113deeaf). After updating an open PR, /ship now checks the sections gstack-post kept: it keeps ones a person wrote, and replaces ones an earlier run wrote for an older head, rereading the live body first and keeping the receipt and run history. Thanks for the careful write-up.