Skip to content

fix(prepare-pr): check the PR body against the repo template before push - #14401

Merged
bolichen97 merged 1 commit into
mainfrom
fix/prepare-pr-body-template
Sep 27, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/prepare-pr-body-template

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: prepare-pr catches a PR body that does not follow the repo's template before the push, not after it.

diff_signals.py --check-body checks only that every changed area is named and that What changed is short. It never checks the template headings. And the skill says to cat the template only in Phase 3 step 2, after Phase 1 step 5 has already written and passed the body. So agents read "check-body passed" as "follows the template". PR #14173 shipped that way. CI's PR Hygiene then fails it, one round trip too late.

Why it matters

Every agent-opened PR that misses a heading costs a push, a red PR Hygiene / Fork PR Description check, and a body edit. The check already exists in the repo; the local loop just never ran it.

Not a goal

  • Re-implementing the heading rules in Python. The CI script stays the one source.
  • Checking section content or prose quality. The script checks presence only.
  • Any change to pr_status.py or the CI workflows.

What changed (motivation → approach → change)

The body check and the template lived in different phases, so a body could pass one and never meet the other. The fix runs CI's own rule where the body is first checked.

--check-body in src/kiro_crew/builtin_skills/kirocrew-dev/prepare-pr/scripts/diff_signals.py now also runs .github/scripts/pr-description-check.sh on the body. It reads the script from origin/<base>, never from the checkout, so a branch cannot weaken its own check. A missing section prints the script's own list and exits a new code, 22. A base without that script (another repo) skips it; so does a host with no bash on PATH, with a warning. All findings print; the lowest code wins.

prepare-pr/SKILL.md moves "cat the template and use it as the literal scaffold" into Phase 1 step 5, where the body is first written. Phase 3 step 2 now points back to it. The scripts table and Two checks, two strengths document exit 22.

Backwards compatibility

Compatible: a body that already follows the template passes as before; a repo without the script sees no change. Only a body CI would already reject now also fails locally.

Tests

test/test_prepare_pr_diff_signals.py adds three end-to-end runs on a throwaway repo:

  • a body missing ## Not a goal exits 22 and names it, even though the branch replaced the script with one that always passes (proves the base-ref read);
  • a template-shaped body exits 0;
  • a base without the script exits 0 and prints no template line.

Red-before: on origin/main's script the first two fail. Mutating the read to HEAD: fails the first. The 29 test files that read prepare-pr skills pass (2404 tests).

Manual verification

Ran --check-body in this worktree on a one-section body: exit 22 listing the four missing headings. This body passes it.

Related Issues

No linked issue: the real case is #14173, a PR that passed the local check and failed PR Hygiene.

Pattern harvest

Not generalizable: the one-off is a local check that skipped a rule CI already enforced; the fix is to call CI's script, not a new rule.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 804ed39768f7beba737eb2b845be505ee23a0bf3 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify a script run writing no conclusion= line warns rather than printing required sections present — interface drift would silently restore the round trip.

Suggestions

  • In template_check, gate the pass on conclusion=success being present; anything else (empty output, crash exit) is a WARN-skip like the no-bash path, so drift degrades loudly instead of as a false green.

[DESIGN-REVIEWED] 804ed39

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 804ed39768f7beba737eb2b845be505ee23a0bf3 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 804ed39

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 804ed39768f7beba737eb2b845be505ee23a0bf3: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 804ed39768f7beba737eb2b845be505ee23a0bf3 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

The no-bash WARN branch is the one untested path — confirm on a bash-less host it prints the warning and exits 0.

What this change ships

Inventory (7 items) — 7 justified

Intent: an author running prepare-pr learns before pushing that the PR body misses required template headings — a FIX (PR #14173 passed locally, failed CI's PR Hygiene).

  1. A body missing a template heading now fails --check-body locally, exit 22, before any push — justified
  2. The failure prints CI's own title and the missing-section bullets — justified
  3. The check script is read from origin/<base>, so a branch cannot weaken its own gate — justified
  4. A repo whose base lacks the script skips silently; a host without bash skips with a warning — justified
  5. The template-scaffold instruction now sits where the body is first written (Phase 1 step 5); Phase 3 points back — justified
  6. When several checks breach, all findings print and the lowest exit code wins — justified
  7. Skill docs (scripts table, Two checks, two strengths) document exit 22 — justified

[FIRST-PRINCIPLES-REVIEWED] 804ed39

@iamwhatever
iamwhatever force-pushed the fix/prepare-pr-body-template branch from c326ca9 to 8ca2e49 Compare September 27, 2026 07:33
@iamwhatever
iamwhatever requested a review from a team as a code owner September 27, 2026 07:33
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 27, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 804ed39768f7beba737eb2b845be505ee23a0bf3 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 804ed39

Verdict parsed from the review's SHA-scoped output markers for commit 804ed39768f7beba737eb2b845be505ee23a0bf3.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 804ed39768f7beba737eb2b845be505ee23a0bf3: <one-sentence reason>

@iamwhatever
iamwhatever force-pushed the fix/prepare-pr-body-template branch from 8ca2e49 to 6a1931b Compare September 27, 2026 07:57
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • rebutted: run the branch copy of the check as well span=5b0161b48946

Rebutted as out of goal. The goal is to catch a body that misses the template BEFORE push; the base copy is what CI's gate enforces today.
The case is rare: only a PR that edits pr-description-check.sh itself. CI's PR Hygiene still catches it after push, so nothing ships wrong.
Running both copies adds a second run path and a merge rule for one edge case. Kept to one run of the base copy.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • rebutted: Windows may resolve the WSL bash launcher span=baf8c8cf2405

Not a defect: this is a local early warning, and CI's PR Hygiene / Fork PR Description still enforce the same script on every PR.
If the resolved bash cannot run the script, no output file is written, and the check prints "WARN: cannot run ... template check skipped". It never reports a pass; it says it skipped.
Finding Git Bash inside a Git install is a new mechanism for one host shape. The disproportion is the reason: the fallback is visible, and CI is the gate.

@iamwhatever
iamwhatever force-pushed the fix/prepare-pr-body-template branch from 6a1931b to 804ed39 Compare September 27, 2026 08:20
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 27, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed on behalf of the maintainers (sweep 2026-09-27): readiness passed, required checks green on 804ed39, no blocking review threads, security posture unchanged. Approving and merging.

@bolichen97
bolichen97 merged commit 32a00ad into main Sep 27, 2026
105 of 125 checks passed
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.

2 participants