pr step strips an author-supplied closing keyword from the PR body, silently breaking issue closure

Author: atqamzCreated Aug 17, 2026Updated Oct 2, 2026
Labelsbugexisting-pr

Summary

The pr step does not merely fail to add a closing keyword - it removes one the author already put there. On a single branch it stripped Closes owner/repo#N from the PR body three separate times, each time the step ran, and each time the issue silently stopped being scheduled for closure on merge.

Version: no-mistakes version 1.51.1. Linux, GitHub, agent: [claude, codex].

This is narrower than #713 and independent of it. #713 asks for structured --closes metadata so no-mistakes can generate a closing reference. This report is that no-mistakes destroys author-supplied content in a field it does not own, which is a defect under current behavior with no new flag involved.

What I observed

  1. PR opened with a body containing Closes owner/repo#N on its own line. Verified present via gh pr view <n> --json closingIssuesReferences, which returned the issue.
  2. A gate run reached the pr step. It replaced the entire body with its generated template.
  3. closingIssuesReferences then returned empty. The keyword line was gone from the body.
  4. I restored the line by hand. A later run of the same pipeline on the same branch removed it again. Then a third time.

The rest of the generated body was fine and I have no complaint about its content. The problem is that the rewrite is a full replacement rather than a merge, so anything the author added between runs is lost.

Why it matters

It is silent and it fails in the direction of leaving work looking undone. Nothing in the run output says a closing reference was dropped, and the PR still links the issue - a bare reference survives if it is inside text the template preserves - so the PR looks correctly wired right up until it merges and the issue stays open. Discovering it requires re-checking closingIssuesReferences immediately before every merge, which is now a standing manual step in my process purely because of this.

Three occurrences on one branch also means the workaround of "fix the body once" does not hold. Any pipeline that reruns - a fix round, a rebase, a rerun after a red step - re-breaks it.

Suggested fix

The minimal version, no new flags, no inference:

  • When regenerating a PR body, scan the existing body for lines matching GitHub's closing-keyword grammar (closes|fixes|resolves followed by a #N or owner/repo#N reference) and carry them into the regenerated body verbatim, in a stable section.
  • Do not try to guess intent from anywhere else. If the author did not write a closing keyword, do not invent one - that is exactly the boundary #713 draws and it is the right one.
  • Before reporting the pr step complete, verify the body still contains every closing reference that was in it beforehand. If any is missing, that is a step failure, not a warning.

The last point is the one that generalizes: the pr step currently cannot tell the difference between a body it authored and a body a human edited, so it treats an author edit as stale text to discard. Preserving closing keywords fixes the case that silently breaks issue lifecycle; a broader "merge rather than replace" would also protect anything else an author adds, but the keyword case is the one that loses state rather than just prose.

Related

  • #713 - structured --closes metadata. Its "preserve the closing section whenever no-mistakes updates an existing PR body" requirement covers this once implemented, but this defect exists today for authors who write the keyword themselves and needs no flag to fix.