@@ -187,6 +187,30 @@ jobs:
187187 return 1
188188 }
189189
190+ any_configured_check_failing() {
191+ local payload="$1"
192+ local required="$2"
193+ local count
194+ local state
195+
196+ count="$(jq 'length' <<<"$required")"
197+ if [ "$count" -eq 0 ]; then
198+ has_failing_check "$payload"
199+ return
200+ fi
201+
202+ while IFS= read -r name; do
203+ state="$(check_state_for "$payload" "$name")"
204+ case "$state" in
205+ FAILURE|failure|FAILED|failed|ERROR|error|TIMED_OUT|timed_out|CANCELLED|cancelled)
206+ return 0
207+ ;;
208+ esac
209+ done < <(jq -r '.[]' <<<"$required")
210+
211+ return 1
212+ }
213+
190214 evaluate_readiness() {
191215 local payload="$1"
192216 local required
@@ -210,6 +234,11 @@ jobs:
210234 return 0
211235 fi
212236
237+ if any_configured_check_failing "$payload" "$required"; then
238+ echo "needs_repair"
239+ return 0
240+ fi
241+
213242 if any_configured_check_missing "$payload" "$required"; then
214243 echo "needs_ci"
215244 return 0
@@ -304,7 +333,7 @@ jobs:
304333
305334 if [ -z "$run_id" ]; then
306335 echo "No CI run found for PR #$pr ($head_sha); leaving for scheduled/PR CI to start."
307- return 0
336+ return 1
308337 fi
309338
310339 case "$status" in
@@ -317,14 +346,22 @@ jobs:
317346 case "$conclusion" in
318347 success)
319348 echo "CI run $run_id for PR #$pr ($head_sha) already succeeded; not rerunning green checks."
320- return 0
349+ return 1
321350 ;;
322351 esac
323352
324353 echo "Reactivating CI run $run_id for PR #$pr ($head_sha) (status=$status conclusion=$conclusion)."
325- ci_gh gh run rerun "$run_id" --repo "$REPO" --failed || \
326- ci_gh gh run rerun "$run_id" --repo "$REPO" || \
327- echo "Could not reactivate CI run $run_id; scheduled monitor will retry."
354+ if ci_gh gh run rerun "$run_id" --repo "$REPO" --failed; then
355+ return 0
356+ fi
357+
358+ echo "Failed-jobs rerun was unavailable for CI run $run_id; trying full rerun."
359+ if ci_gh gh run rerun "$run_id" --repo "$REPO"; then
360+ return 0
361+ fi
362+
363+ echo "Could not reactivate CI run $run_id; scheduled monitor will retry."
364+ return 1
328365 }
329366
330367 update_branch_if_needed() {
@@ -402,7 +439,7 @@ jobs:
402439 return 1
403440 ;;
404441 needs_ci)
405- trigger_ci_if_needed "$pr" "$head_sha"
442+ trigger_ci_if_needed "$pr" "$head_sha" || true
406443 return 1
407444 ;;
408445 needs_branch_update)
0 commit comments