@@ -81,15 +81,25 @@ jobs:
8181 REVIEWS=''
8282 fi
8383 CYCLE=$(printf '%s' "$REVIEWS" | jq -s "$CYCLE_JQ" 2>/dev/null) || CYCLE=0
84+ # Zero rounds plus an *unrecognized* bot reviewer is the login-drift shape. The
85+ # bots below legitimately review ahead of the first Claude round, so counting
86+ # them here would warn on every ordinary cycle 1.
8487 if [ "$CYCLE" -eq 0 ] && printf '%s' "$REVIEWS" \
85- | jq -e -s 'any(.[][]; .user.type == "Bot")' >/dev/null 2>&1; then
86- echo "::warning::Bot reviews exist but none matched the reviewer login; the review cycle counter is stale."
88+ | jq -e -s --argjson known '["hotdata-automation[bot]", "aikido-autofix[bot]", "dependabot[bot]"]' \
89+ 'any(.[][]; .user.type == "Bot" and (.user.login | IN($known[]) | not))' >/dev/null 2>&1; then
90+ echo "::warning::Unrecognized bot reviewer and no counted rounds; the review cycle counter may be stale."
8791 fi
8892 echo "review_cycle=$((CYCLE + 1))" >> $GITHUB_OUTPUT
8993
90- THREADS=$(gh api "repos/${REPO}/pulls/${PR_NUMBER}/comments" \
91- --paginate | jq -s -r '
92- add | sort_by(.created_at) |
94+ # Same guard as the counter above: unguarded `gh api | jq` aborts the step, and a
95+ # failure here *skips* the review step, so the notify step's failure check never
96+ # fires and the PR gets no review and no explanation.
97+ if ! COMMENTS=$(gh api "repos/${REPO}/pulls/${PR_NUMBER}/comments" --paginate); then
98+ echo "::warning::Could not read prior review comments; reviewing without them."
99+ COMMENTS=''
100+ fi
101+ THREADS=$(printf '%s' "$COMMENTS" | jq -s -r '
102+ (add // []) | sort_by(.created_at) |
93103 if length == 0 then "No prior review comments."
94104 else .[] |
95105 "---",
@@ -100,7 +110,7 @@ jobs:
100110 "",
101111 .body
102112 end
103- ')
113+ ') || THREADS='No prior review comments.'
104114
105115 DELIMITER="REVIEW_CONTEXT_$(openssl rand -hex 16)"
106116 {
0 commit comments