From 9fa4846581ef6850bc903b9cc5a69ebbe3e9d3f2 Mon Sep 17 00:00:00 2001 From: openhands Date: Wed, 18 Mar 2026 08:13:43 +0000 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20ALL=5FCOMMENTS=20fetch=20is=20capped?= =?UTF-8?q?=20at=20limit=3D50=20=E2=80=94=20watermark=20search=20may=20mis?= =?UTF-8?q?s=20reviews=20on=20high-comment=20PRs=20(#100)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- dev/dev-agent.sh | 3 +-- lib/env.sh | 22 ++++++++++++++++++++++ review/review-poll.sh | 3 +-- review/review-pr.sh | 6 ++---- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/dev/dev-agent.sh b/dev/dev-agent.sh index 0e43171..21eba37 100755 --- a/dev/dev-agent.sh +++ b/dev/dev-agent.sh @@ -1244,8 +1244,7 @@ Instructions: REVIEW_SHA=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \ "${API}/pulls/${PR_NUMBER}" | jq -r '.head.sha') || true - REVIEW_COMMENT=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \ - "${API}/issues/${PR_NUMBER}/comments?limit=50" | \ + REVIEW_COMMENT=$(codeberg_api_all "/issues/${PR_NUMBER}/comments" | \ jq -r --arg sha "$REVIEW_SHA" \ '[.[] | select(.body | contains(" exists COMMENT_REVIEWED=$(echo "$ALL_COMMENTS" | \ @@ -797,8 +796,7 @@ if [ "$FOLLOWUP_COUNT" -gt 0 ]; then FU_DETAILS=$(printf '%s' "$fu" | jq -r '.details') # Check for duplicate - EXISTING=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \ - "${API_BASE}/issues?state=open&labels=tech-debt&limit=50" | \ + EXISTING=$(codeberg_api_all "/issues?state=open&labels=tech-debt" | \ jq -r --arg t "$FU_TITLE" '[.[] | select(.title == $t)] | length') if [ "${EXISTING:-0}" -gt 0 ]; then From d5b3f9e6e58340b05fb765049f433e8cd752eb57 Mon Sep 17 00:00:00 2001 From: openhands Date: Wed, 18 Mar 2026 08:25:22 +0000 Subject: [PATCH 2/2] fix: codeberg_api_all propagates API errors instead of silently returning [] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove || break from the codeberg_api call in the pagination loop. With set -euo pipefail in all callers, a failed fetch now exits the function non-zero — matching the original curl -sf behaviour where a network or auth error aborted the script rather than returning empty results and risking a duplicate review. Co-Authored-By: Claude Sonnet 4.6 --- lib/env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/env.sh b/lib/env.sh index 38a4820..85e28bf 100755 --- a/lib/env.sh +++ b/lib/env.sh @@ -68,7 +68,7 @@ codeberg_api_all() { esac page=1 while true; do - page_items=$(codeberg_api GET "${path_prefix}${sep}limit=50&page=${page}") || break + page_items=$(codeberg_api GET "${path_prefix}${sep}limit=50&page=${page}") count=$(printf '%s' "$page_items" | jq 'length') [ "$count" -eq 0 ] && break all_items=$(printf '%s\n%s' "$all_items" "$page_items" | jq -s 'add')