Skip to content

[Bugfix #685] Require Closes/Fixes keyword in PR prompts - #687

Merged
waleedkadous merged 2 commits into
mainfrom
builder/bugfix-685-builder-prompts-should-require
Apr 20, 2026
Merged

waleedkadous merged 2 commits into
mainfrom
builder/bugfix-685-builder-prompts-should-require

Conversation

@waleedkadous

Copy link
Copy Markdown
Contributor

Summary

Builder prompts for SPIR, ASPIR, AIR, maintain, and experiment did not tell
builders to include a GitHub close-keyword (Closes #N / Fixes #N) in the
final PR body, so merged PRs did not auto-close their driving issues. Shannon
hit this on PR #796 (SPIR spec 786): PR merged, issue stayed open, manual
close required.

Fixes #685

Root Cause

Of the six protocols with PR-creating prompts, only BUGFIX (prompts/pr.md)
already required Fixes #{{issue.number}} in the PR body template. The other
five produced PR bodies with no close-keyword at all, or in AIR's case a
non-recognized Implements #N line.

Fix

Added a standard close-keyword directive to each PR-creating prompt, with the
partial-fix exception spelled out so builders don't blindly close an issue
when the PR only addresses one phase of a multi-PR effort:

Protocol File
SPIR codev/protocols/spir/prompts/review.md
ASPIR codev/protocols/aspir/prompts/review.md
AIR codev/protocols/air/prompts/pr.md
BUGFIX codev/protocols/bugfix/prompts/pr.md
maintain codev/protocols/maintain/prompts/review.md
experiment codev/protocols/experiment/builder-prompt.md

codev-skeleton/protocols/ mirrored for each edit.

Changes:

  • SPIR/ASPIR templates gain a Closes #<N> placeholder next to the summary
    and a directive block explaining why it matters and when to substitute
    Refs #<N> / Part of #<N> for partial fixes.
  • AIR now emits Closes #{{issue.number}} instead of Implements #{{issue.number}}
    (the latter is not a recognized GitHub close keyword).
  • BUGFIX gains the partial-fix exception note (it already had Fixes #N).
  • maintain notes that the close-keyword applies only when the run was
    triggered by a tracking issue.
  • experiment mentions the close-keyword requirement for the (rare) case
    where an experiment produces a PR that should close an issue.

Out of scope (deferred as separate work per the issue):

  • Porch pr-gate check that scans the PR body for a close-keyword before
    allowing pr-ready to advance.
  • Auto-injection of close-keyword based on issue metadata.

Test Plan

  • Regression test added: packages/codev/src/__tests__/bugfix-685-close-keyword.test.ts
    • 37 assertions covering all 6 codev/ prompts + 6 codev-skeleton/ mirrors
    • Verifies each prompt mentions Closes #/Fixes #
    • Verifies each prompt documents the partial-fix exception
      (Refs # / Part of #)
    • Verifies each prompt explains the auto-close rationale
    • Verifies codev-skeleton is byte-identical to codev/ for every edited prompt
  • Existing bugfix-pr-prompt.test.ts still passes
  • porch check bugfix-685 — build + tests pass

Protocols other than BUGFIX did not tell builders to include a GitHub
close-keyword in the final PR body. Shannon hit this on PR #796 (SPIR
spec 786): PR merged but the driving issue stayed open.

Add a standard close-keyword directive to the PR-creating prompts for
SPIR, ASPIR, AIR, BUGFIX (partial-fix exception), maintain, and
experiment, keeping codev-skeleton in sync. AIR's "Implements #N" now
uses "Closes #N" so GitHub auto-closes on merge. Add the partial-fix
exception wording so builders don't blindly add Closes on a phase PR.

Regression test (bugfix-685-close-keyword.test.ts) verifies each
protocol prompt documents the keyword, the exception, and the
auto-close rationale, and that codev-skeleton mirrors codev/.
Codex review flagged that `{{issue.number}}` inside the AIR and BUGFIX
PR body templates is not substituted by porch's phase prompt renderer —
it only substitutes bare `{{word}}` tokens, not dotted paths. A builder
that copies the template verbatim would commit the literal string
`Fixes #{{issue.number}}` to the PR body, which GitHub will not recognise
as a close keyword.

Switch the PR body templates for AIR and BUGFIX to `<N>` placeholders
with an inline comment reminding the builder to substitute the real
issue number. Matches the pattern already used in SPIR/ASPIR/maintain
prompts. Add an explicit "do not leave `{{...}}` template tags" note to
the directive text.

Extend the regression test to assert no `{{issue...}}` tokens remain
inside any PR body template (the text between `<<'EOF'` and `EOF`).
Title and notification lines outside the body are intentionally not
covered — that's pre-existing text out of scope for #685.
@waleedkadous

Copy link
Copy Markdown
Contributor Author

Excellent work — thanks for the careful fix. The Codex catch about {{issue.number}} was crucial (porch's \{\{(\w+)\}\} regex rejects dotted paths, so the old bugfix template was silently broken). The <N> placeholder with an explicit "substitute this" note is the right call.

Also appreciate catching that AIR had Implements #N which isn't a GitHub close keyword. And the partial-fix exception is important — prevents premature issue closure on phase PRs.

Approved. Please merge with gh pr merge 687 --merge --admin (self-approval blocked by branch protection).

@waleedkadous
waleedkadous merged commit 4a931fd into main Apr 20, 2026
6 checks passed
@waleedkadous
waleedkadous deleted the builder/bugfix-685-builder-prompts-should-require branch April 20, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Builder prompts should require Closes/Fixes keyword in final PR body

1 participant