skip empty review submissions instead of posting noise

when create_pull_request_review is called with no body and no inline
comments, return early with a clear log message instead of hitting
GitHub's 422 or posting a useless "approved" comment.

Made-with: Cursor
This commit is contained in:
Colin McDonnell
2026-03-17 20:09:33 +00:00
committed by pullfrog[bot]
parent c6a3ee0e9a
commit 026cc7a276
2 changed files with 22 additions and 0 deletions
+10
View File
@@ -146909,6 +146909,16 @@ function CreatePullRequestReviewTool(ctx) {
execute: execute(async ({ pull_number, body, approved, commit_id, comments = [] }) => {
if (body) body = fixDoubleEscapedString(body);
ctx.toolState.issueNumber = pull_number;
if (!body && comments.length === 0) {
log.info(
"review has no body and no inline comments \u2014 skipping submission (no issues found)"
);
return {
success: true,
skipped: true,
reason: "no issues found \u2014 nothing to post"
};
}
let event = approved ? "APPROVE" : "COMMENT";
if (event === "APPROVE" && !ctx.prApproveEnabled) {
log.info("prApproveEnabled is disabled \u2014 downgrading APPROVE to COMMENT");
+12
View File
@@ -84,6 +84,18 @@ export function CreatePullRequestReviewTool(ctx: ToolContext) {
// set issue context (PRs are issues)
ctx.toolState.issueNumber = pull_number;
// skip empty reviews (no body, no inline comments) — nothing to post
if (!body && comments.length === 0) {
log.info(
"review has no body and no inline comments — skipping submission (no issues found)"
);
return {
success: true,
skipped: true,
reason: "no issues found — nothing to post",
};
}
// enforce prApproveEnabled: downgrade APPROVE to COMMENT if disabled
let event: "APPROVE" | "COMMENT" = approved ? "APPROVE" : "COMMENT";
if (event === "APPROVE" && !ctx.prApproveEnabled) {