From 9a25831f577060e92f9ab606c6f0fea63cd1137c Mon Sep 17 00:00:00 2001 From: dizhaky Date: Mon, 29 Jun 2026 18:13:48 -0400 Subject: [PATCH] fix(ci): cap healer reruns globally via run_attempt check The MAX_RERUNS=3 counter was local to each healer invocation, so a deterministically failing workflow run would be rerun every 30 minutes indefinitely. Add a gh api call to read run_attempt before rerunning; skip any run that has already reached the retry ceiling across prior healer invocations. Addresses Codex PR #50 P2 finding. --- .github/workflows/ci-auto-healer.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-auto-healer.yml b/.github/workflows/ci-auto-healer.yml index aedd78649100..1e7b750e29b0 100644 --- a/.github/workflows/ci-auto-healer.yml +++ b/.github/workflows/ci-auto-healer.yml @@ -74,7 +74,16 @@ jobs: continue fi - # Limit number of reruns to prevent infinite loops + # Skip runs that have already exceeded the global retry budget across all + # healer invocations. run_attempt==1 is the original run; each rerun + # increments it, so run_attempt==4 means 3 reruns have already been done. + ATTEMPT=$(gh api /repos/$REPO/actions/runs/$RUN_ID --jq '.run_attempt' 2>/dev/null || echo "1") + if [ "${ATTEMPT:-1}" -ge "$MAX_RERUNS" ] 2>/dev/null; then + echo "Run $RUN_ID already at attempt $ATTEMPT/$MAX_RERUNS — skipping, needs manual review" + continue + fi + + # Limit number of reruns per healer invocation to avoid hammering CI if [ $RERUN_COUNT -ge $MAX_RERUNS ]; then echo "Reached maximum reruns ($MAX_RERUNS), stopping" break