Skip to content

fix(post-pr-review): insert verdict findings into fix-request comment - #207

Merged
don-petry merged 4 commits into
mainfrom
fix/post-pr-review-findings-placeholder
May 17, 2026
Merged

don-petry merged 4 commits into
mainfrom
fix/post-pr-review-findings-placeholder

Conversation

@don-petry

Copy link
Copy Markdown
Collaborator

Summary

  • The escalate+AI-delegation path in post-pr-review.sh built its comment from a static heredoc with a literal [Findings would be inserted here] placeholder
  • $BODY (extracted from the verdict JSON on line 34) was already available but never referenced in this code path — only the approve path used it correctly
  • Every fix-request comment posted since AI delegation was enabled has shown the placeholder instead of the cascade's actual findings

Root cause

# Line 34 — correctly extracts findings body from verdict JSON
BODY=$(jq -r '.body' "$VERDICT_JSON")

# Line 276 (before fix) — placeholder never substituted
### Findings to fix
[Findings would be inserted here]

Fix

Replace [Findings would be inserted here] with $BODY in the heredoc. The heredoc delimiter is unquoted (COMMENT_END) so shell variable expansion already fires — this is a one-line change.

Observed symptom

combsmith/.github#302 comment #4468656929 — cycle 2/3 fix-request with blank findings.

🤖 Generated with Claude Code

The escalate+AI-delegation path built its comment from a static heredoc
with a literal '[Findings would be inserted here]' placeholder. $BODY
(already extracted from the verdict JSON on line 34) was never referenced
in this path — only the approve path used it correctly.

Replace the placeholder with $BODY so the cascade's actual findings
appear in every fix-request comment.
Copilot AI review requested due to automatic review settings May 17, 2026 01:28
@coderabbitai

coderabbitai Bot commented May 17, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@don-petry has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 39 minutes and 5 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a557d366-dd42-440c-9f88-9f622d623f31

📥 Commits

Reviewing files that changed from the base of the PR and between a0ef82a and bb7b213.

📒 Files selected for processing (1)
  • scripts/post-pr-review.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/post-pr-review-findings-placeholder

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7eb0bf185

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/post-pr-review.sh Resolved

Copilot AI 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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the scripts/post-pr-review.sh script to dynamically insert review findings into the automated PR comment using the $BODY variable. Feedback was provided to handle cases where the $BODY variable might contain the literal string "null" by implementing a fallback message to improve clarity for the user.

Comment thread scripts/post-pr-review.sh Resolved
@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

Address two reviewer findings on PR #207:

1. (Gemini) `jq -r '.body'` returns the literal string "null" when the
   verdict JSON lacks a body field. Switch to `.body // ""` so the approve
   path writes an empty string and the fix-request comment shows nothing
   rather than "null".

2. (Codex P2) The cascade-action body already contains a
   `<!-- pr-review-agent v1 sha=... -->` marker. Embedding it verbatim
   inside the fix-request heredoc produces two markers per comment;
   review-one-pr.sh counts matching lines with grep -c, so one delegated
   cycle was counted as two and could prematurely trip the max-cycle
   human-escalation cap. Strip embedded markers from BODY before inserting.
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 17, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af4bd80f89

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/post-pr-review.sh Resolved
@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

@don-petry

Copy link
Copy Markdown
Collaborator Author

@donpetry-bot - please review

The previous pattern `[a-f0-9]* --[^>]*-->` required a literal `--`
immediately after the SHA, but the actual marker format is
`sha=<hex> -->` or `sha=<hex> decision=... -->` — no leading `--`
before the non-`>` content. The strip never fired, leaving the embedded
marker intact and still double-counting review cycles.

Fix: use `[a-f0-9][^>]*-->` which matches the SHA start then any
non-`>` chars up to the closing `-->`.
@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

@sonarqubecloud

Copy link
Copy Markdown

@don-petry
don-petry merged commit 7437286 into main May 17, 2026
20 checks passed
@don-petry
don-petry deleted the fix/post-pr-review-findings-placeholder branch May 17, 2026 01:46

@donpetry-bot donpetry-bot 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.

Automated review — APPROVED ✓

Risk: LOW
Reviewed commit: bb7b21312643c3f137378459e355a86b2211deee
Review mode: triage-approved (single reviewer)

Summary

Small, well-scoped bash fix in scripts/post-pr-review.sh (+8/-2, 1 file). Addresses three issues:

  1. Root bug — Replaces the literal placeholder [Findings would be inserted here] with $BODY_FOR_COMMENT so cascade findings actually appear in fix-request comments.
  2. Null-body guard (Gemini) — jq -r '.body' returned the literal string "null" when the verdict JSON lacked a body field; switched to .body // "".
  3. Duplicate marker (Codex P2) — The verdict body already carries its own <!-- pr-review-agent v1 sha=… --> marker; embedding it inside the fix-request heredoc produced two markers per comment, causing review-one-pr.sh's grep -c to count one delegated cycle as two and prematurely trip the max-cycle cap. Now stripped with sed before insertion.

The final commit (bb7b213) corrects the sed pattern: the earlier [a-f0-9]* --[^>]*--> required a literal -- after the SHA that doesn't exist in the actual marker format. The new [a-f0-9][^>]*--> correctly matches <!-- pr-review-agent v1 sha=<hex> [decision=… risk=…] -->.

Linked issue analysis

No Fixes # link, but the PR body cites the observed symptom — combsmith/.github#302 comment 4468656929 showed a cycle-2/3 fix-request with blank findings. The fix substantively addresses that observation.

Findings

No blocking issues.

  • Heredoc safety: $BODY_FOR_COMMENT is inserted into an unquoted heredoc. Bash expands $VAR references but does not re-evaluate the substituted content, so literal $(...) or backticks inside the review body are inserted as text — no command-injection risk from review-body contents.
  • Sed pattern correctness: [a-f0-9][^>]*--> requires at least one hex char after sha= (preventing matches on sha= -->) and stops at the first >, so it cannot run away into surrounding markdown. Correctly matches both the bare-SHA form and the decision/risk form.
  • Approve-path parity: Line 182 (echo "$BODY" > "$BODY_FILE") already used the body verbatim with the embedded marker. With the null-guard now applied at extraction (line 34), the approve path is also protected from null-body writes — a small, free improvement.

CI status

All required checks green: CodeQL, SonarCloud (quality gate passed), AgentShield, shellcheck, bats, unit-tests, dependency-audit. CodeRabbit APPROVED on the reviewed SHA.


Reviewed automatically by the PR-review agent (single-reviewer mode: opus 4.7). Reply if you need a human review.

don-petry added a commit that referenced this pull request Jun 7, 2026
…#207)

* fix(post-pr-review): insert verdict body into fix-request comment

The escalate+AI-delegation path built its comment from a static heredoc
with a literal '[Findings would be inserted here]' placeholder. $BODY
(already extracted from the verdict JSON on line 34) was never referenced
in this path — only the approve path used it correctly.

Replace the placeholder with $BODY so the cascade's actual findings
appear in every fix-request comment.

* fix(post-pr-review): guard null body and strip duplicate markers

Address two reviewer findings on PR #207:

1. (Gemini) `jq -r '.body'` returns the literal string "null" when the
   verdict JSON lacks a body field. Switch to `.body // ""` so the approve
   path writes an empty string and the fix-request comment shows nothing
   rather than "null".

2. (Codex P2) The cascade-action body already contains a
   `<!-- pr-review-agent v1 sha=... -->` marker. Embedding it verbatim
   inside the fix-request heredoc produces two markers per comment;
   review-one-pr.sh counts matching lines with grep -c, so one delegated
   cycle was counted as two and could prematurely trip the max-cycle
   human-escalation cap. Strip embedded markers from BODY before inserting.

* fix(post-pr-review): correct sed pattern for stripping embedded markers

The previous pattern `[a-f0-9]* --[^>]*-->` required a literal `--`
immediately after the SHA, but the actual marker format is
`sha=<hex> -->` or `sha=<hex> decision=... -->` — no leading `--`
before the non-`>` content. The strip never fired, leaving the embedded
marker intact and still double-counting review cycles.

Fix: use `[a-f0-9][^>]*-->` which matches the SHA start then any
non-`>` chars up to the closing `-->`.
don-petry added a commit that referenced this pull request Jun 7, 2026
…#207)

* fix(post-pr-review): insert verdict body into fix-request comment

The escalate+AI-delegation path built its comment from a static heredoc
with a literal '[Findings would be inserted here]' placeholder. $BODY
(already extracted from the verdict JSON on line 34) was never referenced
in this path — only the approve path used it correctly.

Replace the placeholder with $BODY so the cascade's actual findings
appear in every fix-request comment.

* fix(post-pr-review): guard null body and strip duplicate markers

Address two reviewer findings on PR #207:

1. (Gemini) `jq -r '.body'` returns the literal string "null" when the
   verdict JSON lacks a body field. Switch to `.body // ""` so the approve
   path writes an empty string and the fix-request comment shows nothing
   rather than "null".

2. (Codex P2) The cascade-action body already contains a
   `<!-- pr-review-agent v1 sha=... -->` marker. Embedding it verbatim
   inside the fix-request heredoc produces two markers per comment;
   review-one-pr.sh counts matching lines with grep -c, so one delegated
   cycle was counted as two and could prematurely trip the max-cycle
   human-escalation cap. Strip embedded markers from BODY before inserting.

* fix(post-pr-review): correct sed pattern for stripping embedded markers

The previous pattern `[a-f0-9]* --[^>]*-->` required a literal `--`
immediately after the SHA, but the actual marker format is
`sha=<hex> -->` or `sha=<hex> decision=... -->` — no leading `--`
before the non-`>` content. The strip never fired, leaving the embedded
marker intact and still double-counting review cycles.

Fix: use `[a-f0-9][^>]*-->` which matches the SHA start then any
non-`>` chars up to the closing `-->`.
don-petry added a commit that referenced this pull request Jun 8, 2026
…#207)

* fix(post-pr-review): insert verdict body into fix-request comment

The escalate+AI-delegation path built its comment from a static heredoc
with a literal '[Findings would be inserted here]' placeholder. $BODY
(already extracted from the verdict JSON on line 34) was never referenced
in this path — only the approve path used it correctly.

Replace the placeholder with $BODY so the cascade's actual findings
appear in every fix-request comment.

* fix(post-pr-review): guard null body and strip duplicate markers

Address two reviewer findings on PR #207:

1. (Gemini) `jq -r '.body'` returns the literal string "null" when the
   verdict JSON lacks a body field. Switch to `.body // ""` so the approve
   path writes an empty string and the fix-request comment shows nothing
   rather than "null".

2. (Codex P2) The cascade-action body already contains a
   `<!-- pr-review-agent v1 sha=... -->` marker. Embedding it verbatim
   inside the fix-request heredoc produces two markers per comment;
   review-one-pr.sh counts matching lines with grep -c, so one delegated
   cycle was counted as two and could prematurely trip the max-cycle
   human-escalation cap. Strip embedded markers from BODY before inserting.

* fix(post-pr-review): correct sed pattern for stripping embedded markers

The previous pattern `[a-f0-9]* --[^>]*-->` required a literal `--`
immediately after the SHA, but the actual marker format is
`sha=<hex> -->` or `sha=<hex> decision=... -->` — no leading `--`
before the non-`>` content. The strip never fired, leaving the embedded
marker intact and still double-counting review cycles.

Fix: use `[a-f0-9][^>]*-->` which matches the SHA start then any
non-`>` chars up to the closing `-->`.
don-petry added a commit that referenced this pull request Jun 12, 2026
…#207)

* fix(post-pr-review): insert verdict body into fix-request comment

The escalate+AI-delegation path built its comment from a static heredoc
with a literal '[Findings would be inserted here]' placeholder. $BODY
(already extracted from the verdict JSON on line 34) was never referenced
in this path — only the approve path used it correctly.

Replace the placeholder with $BODY so the cascade's actual findings
appear in every fix-request comment.

* fix(post-pr-review): guard null body and strip duplicate markers

Address two reviewer findings on PR #207:

1. (Gemini) `jq -r '.body'` returns the literal string "null" when the
   verdict JSON lacks a body field. Switch to `.body // ""` so the approve
   path writes an empty string and the fix-request comment shows nothing
   rather than "null".

2. (Codex P2) The cascade-action body already contains a
   `<!-- pr-review-agent v1 sha=... -->` marker. Embedding it verbatim
   inside the fix-request heredoc produces two markers per comment;
   review-one-pr.sh counts matching lines with grep -c, so one delegated
   cycle was counted as two and could prematurely trip the max-cycle
   human-escalation cap. Strip embedded markers from BODY before inserting.

* fix(post-pr-review): correct sed pattern for stripping embedded markers

The previous pattern `[a-f0-9]* --[^>]*-->` required a literal `--`
immediately after the SHA, but the actual marker format is
`sha=<hex> -->` or `sha=<hex> decision=... -->` — no leading `--`
before the non-`>` content. The strip never fired, leaving the embedded
marker intact and still double-counting review cycles.

Fix: use `[a-f0-9][^>]*-->` which matches the SHA start then any
non-`>` chars up to the closing `-->`.
don-petry added a commit that referenced this pull request Jun 14, 2026
…#207)

* fix(post-pr-review): insert verdict body into fix-request comment

The escalate+AI-delegation path built its comment from a static heredoc
with a literal '[Findings would be inserted here]' placeholder. $BODY
(already extracted from the verdict JSON on line 34) was never referenced
in this path — only the approve path used it correctly.

Replace the placeholder with $BODY so the cascade's actual findings
appear in every fix-request comment.

* fix(post-pr-review): guard null body and strip duplicate markers

Address two reviewer findings on PR #207:

1. (Gemini) `jq -r '.body'` returns the literal string "null" when the
   verdict JSON lacks a body field. Switch to `.body // ""` so the approve
   path writes an empty string and the fix-request comment shows nothing
   rather than "null".

2. (Codex P2) The cascade-action body already contains a
   `<!-- pr-review-agent v1 sha=... -->` marker. Embedding it verbatim
   inside the fix-request heredoc produces two markers per comment;
   review-one-pr.sh counts matching lines with grep -c, so one delegated
   cycle was counted as two and could prematurely trip the max-cycle
   human-escalation cap. Strip embedded markers from BODY before inserting.

* fix(post-pr-review): correct sed pattern for stripping embedded markers

The previous pattern `[a-f0-9]* --[^>]*-->` required a literal `--`
immediately after the SHA, but the actual marker format is
`sha=<hex> -->` or `sha=<hex> decision=... -->` — no leading `--`
before the non-`>` content. The strip never fired, leaving the embedded
marker intact and still double-counting review cycles.

Fix: use `[a-f0-9][^>]*-->` which matches the SHA start then any
non-`>` chars up to the closing `-->`.
don-petry added a commit that referenced this pull request Jun 18, 2026
…#207)

* fix(post-pr-review): insert verdict body into fix-request comment

The escalate+AI-delegation path built its comment from a static heredoc
with a literal '[Findings would be inserted here]' placeholder. $BODY
(already extracted from the verdict JSON on line 34) was never referenced
in this path — only the approve path used it correctly.

Replace the placeholder with $BODY so the cascade's actual findings
appear in every fix-request comment.

* fix(post-pr-review): guard null body and strip duplicate markers

Address two reviewer findings on PR #207:

1. (Gemini) `jq -r '.body'` returns the literal string "null" when the
   verdict JSON lacks a body field. Switch to `.body // ""` so the approve
   path writes an empty string and the fix-request comment shows nothing
   rather than "null".

2. (Codex P2) The cascade-action body already contains a
   `<!-- pr-review-agent v1 sha=... -->` marker. Embedding it verbatim
   inside the fix-request heredoc produces two markers per comment;
   review-one-pr.sh counts matching lines with grep -c, so one delegated
   cycle was counted as two and could prematurely trip the max-cycle
   human-escalation cap. Strip embedded markers from BODY before inserting.

* fix(post-pr-review): correct sed pattern for stripping embedded markers

The previous pattern `[a-f0-9]* --[^>]*-->` required a literal `--`
immediately after the SHA, but the actual marker format is
`sha=<hex> -->` or `sha=<hex> decision=... -->` — no leading `--`
before the non-`>` content. The strip never fired, leaving the embedded
marker intact and still double-counting review cycles.

Fix: use `[a-f0-9][^>]*-->` which matches the SHA start then any
non-`>` chars up to the closing `-->`.
don-petry added a commit that referenced this pull request Jun 25, 2026
…#207)

* fix(post-pr-review): insert verdict body into fix-request comment

The escalate+AI-delegation path built its comment from a static heredoc
with a literal '[Findings would be inserted here]' placeholder. $BODY
(already extracted from the verdict JSON on line 34) was never referenced
in this path — only the approve path used it correctly.

Replace the placeholder with $BODY so the cascade's actual findings
appear in every fix-request comment.

* fix(post-pr-review): guard null body and strip duplicate markers

Address two reviewer findings on PR #207:

1. (Gemini) `jq -r '.body'` returns the literal string "null" when the
   verdict JSON lacks a body field. Switch to `.body // ""` so the approve
   path writes an empty string and the fix-request comment shows nothing
   rather than "null".

2. (Codex P2) The cascade-action body already contains a
   `<!-- pr-review-agent v1 sha=... -->` marker. Embedding it verbatim
   inside the fix-request heredoc produces two markers per comment;
   review-one-pr.sh counts matching lines with grep -c, so one delegated
   cycle was counted as two and could prematurely trip the max-cycle
   human-escalation cap. Strip embedded markers from BODY before inserting.

* fix(post-pr-review): correct sed pattern for stripping embedded markers

The previous pattern `[a-f0-9]* --[^>]*-->` required a literal `--`
immediately after the SHA, but the actual marker format is
`sha=<hex> -->` or `sha=<hex> decision=... -->` — no leading `--`
before the non-`>` content. The strip never fired, leaving the embedded
marker intact and still double-counting review cycles.

Fix: use `[a-f0-9][^>]*-->` which matches the SHA start then any
non-`>` chars up to the closing `-->`.
don-petry added a commit that referenced this pull request Jun 25, 2026
…#207)

* fix(post-pr-review): insert verdict body into fix-request comment

The escalate+AI-delegation path built its comment from a static heredoc
with a literal '[Findings would be inserted here]' placeholder. $BODY
(already extracted from the verdict JSON on line 34) was never referenced
in this path — only the approve path used it correctly.

Replace the placeholder with $BODY so the cascade's actual findings
appear in every fix-request comment.

* fix(post-pr-review): guard null body and strip duplicate markers

Address two reviewer findings on PR #207:

1. (Gemini) `jq -r '.body'` returns the literal string "null" when the
   verdict JSON lacks a body field. Switch to `.body // ""` so the approve
   path writes an empty string and the fix-request comment shows nothing
   rather than "null".

2. (Codex P2) The cascade-action body already contains a
   `<!-- pr-review-agent v1 sha=... -->` marker. Embedding it verbatim
   inside the fix-request heredoc produces two markers per comment;
   review-one-pr.sh counts matching lines with grep -c, so one delegated
   cycle was counted as two and could prematurely trip the max-cycle
   human-escalation cap. Strip embedded markers from BODY before inserting.

* fix(post-pr-review): correct sed pattern for stripping embedded markers

The previous pattern `[a-f0-9]* --[^>]*-->` required a literal `--`
immediately after the SHA, but the actual marker format is
`sha=<hex> -->` or `sha=<hex> decision=... -->` — no leading `--`
before the non-`>` content. The strip never fired, leaving the embedded
marker intact and still double-counting review cycles.

Fix: use `[a-f0-9][^>]*-->` which matches the SHA start then any
non-`>` chars up to the closing `-->`.
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.

3 participants