From 90052bb76091525f60fc036a165d7f3a3a3b4759 Mon Sep 17 00:00:00 2001 From: Ryan Melton Date: Sun, 11 Oct 2026 20:29:51 -0600 Subject: [PATCH] Describe the changes in the AI review fix PR The fix PR only pointed back at the reviewed PR and listed commit subjects, so a reviewer had to go to the parent PR to learn what the fixes did. Its body now has a "What changed" section listing each fix commit with the fixes its message records (file, line, problem and fix), without the harness trailers. Comment openers are escaped as in the review summary, and the body is capped under GitHub's limit. Co-Authored-By: Claude Opus 5.5 (1M context) --- ai-review/ai_review_publish.sh | 17 ++++++++++++++--- tests/test_ai_review.py | 12 +++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ai-review/ai_review_publish.sh b/ai-review/ai_review_publish.sh index d65bd4b..ceec66e 100644 --- a/ai-review/ai_review_publish.sh +++ b/ai-review/ai_review_publish.sh @@ -116,6 +116,19 @@ apply_fixes() { remote="https://x-access-token:${PUSH_TOKEN:-}@github.com/${GITHUB_REPOSITORY}.git" +# Describes the fix PR: each fix commit's subject and the fixes its message lists (apply_fixes +# already checked the messages for secrets). Comment openers are escaped so nothing in the agents' +# text is hidden from the reader, and it stays under GitHub's limit. +fix_pr_body() { + local commit body + body="Fixes from the AI review of #${PR_NUMBER} at ${HEAD_SHA}. Merge this PR to apply them to \`${HEAD_REF}\`; the full review summary is on #${PR_NUMBER}."$'\n\n'"### What changed"$'\n' + for commit in $(git rev-list --reverse "$HEAD_SHA..HEAD"); do + body+=$'\n'"$(git log -1 --format='**%s**' "$commit")"$'\n' + body+="$(git log -1 --format=%b "$commit" | grep '^- ' || true)"$'\n' + done + printf '%s' "${body:0:60000}" | sed 's/ printed the wrong value\n\n" + "AI-Review-Bot: true\nAI-Review-Run: 456" + ) + self.fix_patches(git, head, ["echo fixed >> feature.py"], message=message) body = "## AI adversarial review\n\n### Turn 1: Claude (commit abc1234)\n" run, status, comment, pushed = self.publish(repository, remote, head, body=body, mode="pull_request") self.assertEqual(run.returncode, 0, run.stderr) @@ -728,6 +732,12 @@ def test_publish_opens_a_fix_pr_by_default(self): create = next(call for call in calls if call[1] == "create") self.assertEqual(create[create.index("--base") + 1], "feature") self.assertEqual(create[create.index("--head") + 1], "ai-review/pr-1-123") + # The fix PR describes its changes rather than only pointing back at the reviewed PR + pr_body = create[create.index("--body") + 1] + self.assertIn("### What changed", pr_body) + self.assertIn("**fix(review): apply Claude review fixes (turn 1)**", pr_body) + self.assertIn("- feature.py:1 - <!-- hidden --> printed the wrong value", pr_body) + self.assertNotIn("AI-Review-Bot", pr_body) # Only the superseded fix PR of this PR is closed self.assertEqual([call[2] for call in calls if call[1] == "close"], ["7"]) # The author is asked to review it