From 80dd87e16b4d74455de668dd151526ae0213f061 Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Tue, 30 Jun 2026 15:27:38 +0200 Subject: [PATCH 1/2] Fix unstable-test rerun being skipped for fork PRs Fork PRs require maintainer approval, which consumes attempt 1 (conclusion 'action_required', 0 jobs). This offsets the attempt numbering so the first real build is attempt 2, which exceeded MAX_ATTEMPTS=1 and caused RerunUnstableFailures to skip every fork PR's first build. Discount the approval-gate attempt when it concluded 'action_required' and compare an effective attempt against MaxAttempts instead. Internal-branch PRs are unaffected. --- build/scripts/RerunUnstableFailures.ps1 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/build/scripts/RerunUnstableFailures.ps1 b/build/scripts/RerunUnstableFailures.ps1 index eecb01caee..7ba478e3e8 100644 --- a/build/scripts/RerunUnstableFailures.ps1 +++ b/build/scripts/RerunUnstableFailures.ps1 @@ -26,8 +26,20 @@ if ($run.conclusion -ne 'failure') { exit 0 } -if ($run.run_attempt -gt $MaxAttempts) { - Write-Host "Run $RunId is on attempt $($run.run_attempt) (max $MaxAttempts). Skipping." +# For PRs from forks, the first attempt is an approval gate that runs no jobs and +# concludes 'action_required'. This offsets the attempt numbering, so the first real +# build is attempt 2. Discount the gate attempt to compute the effective attempt. +$gateAttempts = 0 +if ($run.run_attempt -gt 1) { + $firstAttemptConclusion = gh api "/repos/$Owner/$Repo/actions/runs/$RunId/attempts/1" --jq '.conclusion' 2>&1 + if ($LASTEXITCODE -eq 0 -and $firstAttemptConclusion -eq 'action_required') { + $gateAttempts = 1 + } +} +$effectiveAttempt = $run.run_attempt - $gateAttempts + +if ($effectiveAttempt -gt $MaxAttempts) { + Write-Host "Run $RunId is on attempt $($run.run_attempt) (effective $effectiveAttempt, max $MaxAttempts). Skipping." exit 0 } From 635ba7ad4d994b50048445cbb64794b5e8c16cbb Mon Sep 17 00:00:00 2001 From: aholstrup1 Date: Wed, 1 Jul 2026 08:37:06 +0200 Subject: [PATCH 2/2] Raise MAX_FAILED_JOBS from 3 to 10 for unstable-test rerun --- .github/workflows/RerunUnstableFailures.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/RerunUnstableFailures.yaml b/.github/workflows/RerunUnstableFailures.yaml index 9db574f989..3fe4de7048 100644 --- a/.github/workflows/RerunUnstableFailures.yaml +++ b/.github/workflows/RerunUnstableFailures.yaml @@ -19,7 +19,7 @@ jobs: actions: write contents: read env: - MAX_FAILED_JOBS: 3 # Maximum number of failed jobs in order to consider rerunning + MAX_FAILED_JOBS: 10 # Maximum number of failed jobs in order to consider rerunning MIN_TOTAL_JOBS: 10 # Minimum number of jobs that has run in order to consider rerunning MAX_ATTEMPTS: 1 # Maximum number of attempts to rerun a failed job steps: