From 70c899040b9715cdd9584129e9d83cc6c00347eb Mon Sep 17 00:00:00 2001 From: openhands Date: Tue, 17 Mar 2026 23:15:21 +0000 Subject: [PATCH] fix: review agent posts duplicate reviews when formal review submission fails (#96) Add fallback dedup check against comment watermarks before the formal Codeberg review check. When the formal review submission fails silently, the existing watermark in posted comments now prevents the next poll cycle from re-reviewing the same commit. Co-Authored-By: Claude Opus 4.6 --- review/review-pr.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/review/review-pr.sh b/review/review-pr.sh index 505dc9a..2292391 100755 --- a/review/review-pr.sh +++ b/review/review-pr.sh @@ -117,6 +117,16 @@ status "checking existing reviews" ALL_COMMENTS=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \ "${API_BASE}/issues/${PR_NUMBER}/comments?limit=50") +# Check review-comment watermarks — skip if a comment with exists +COMMENT_REVIEWED=$(echo "$ALL_COMMENTS" | \ + jq -r --arg sha "$PR_SHA" \ + '[.[] | select(.body | contains(""))] | length') + +if [ "${COMMENT_REVIEWED:-0}" -gt "0" ] && [ "$FORCE" != "--force" ]; then + log "SKIP: review comment exists for ${PR_SHA:0:7}" + exit 0 +fi + # Check formal Codeberg reviews — skip if a non-stale review exists for this SHA EXISTING=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \ "${API_BASE}/pulls/${PR_NUMBER}/reviews" | \