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 <!-- reviewed: SHA --> watermark in posted comments now prevents the next poll cycle from re-reviewing the same commit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b9eea10835
commit
70c899040b
1 changed files with 10 additions and 0 deletions
|
|
@ -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 <!-- reviewed: SHA --> exists
|
||||
COMMENT_REVIEWED=$(echo "$ALL_COMMENTS" | \
|
||||
jq -r --arg sha "$PR_SHA" \
|
||||
'[.[] | select(.body | contains("<!-- reviewed: " + $sha + " -->"))] | 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" | \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue