Fix unstable-test rerun being skipped for fork PRs#8929
Merged
Conversation
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.
Contributor
Copilot PR ReviewIteration 2 · Outcome: not-applicable
Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630 No findings were posted for this iteration. Orchestrator pre-filter (13 file(s) excluded)
Findings produced by the Copilot CLI agent against BCQuality at |
mazhelez
previously approved these changes
Jun 30, 2026
mazhelez
approved these changes
Jul 1, 2026
spetersenms
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
The "Rerun Unstable Failures" workflow never reran fork PR builds. Fork PRs require maintainer approval, which GitHub records as attempt 1 with conclusion
action_requiredand zero jobs. This offsets the attempt numbering so the first real build is attempt 2.RerunUnstableFailures.ps1capped reruns atMAX_ATTEMPTS = 1by comparing the rawrun_attempt, so2 > 1caused every fork PR's first failed build to be skipped. Internal-branch PRs have no approval gate, so their first build is attempt 1 and worked fine.This was confirmed against run 28399235429 (fork
arvindbinarystream/BCApps): attempt 1 =action_required/0 jobs, attempt 2 = first real build.Approach
Before the attempt cap, the script now checks whether attempt 1 concluded
action_required(the approval gate). If so, it discounts that one attempt and compares aneffectiveAttemptagainstMaxAttempts. The gate is always attempt 1, so this is a single extra API call only whenrun_attempt > 1. Internal-branch PRs are unaffected (effectiveAttempt == run_attempt).Linked work
AB#640957
How I validated this
What I tested and the outcome
This is a CI helper script (not a BC app). Validated by replaying the new logic against the real fork run 28399235429:
run_attempt = 2, attempt 1 =action_required->gateAttempts = 1,effectiveAttempt = 1, which is not> MaxAttempts (1), so the run is no longer skipped. Also confirmed the script parses with no PowerShell syntax errors. No automated tests exist for this script.Risk & compatibility
Low. Behavior is unchanged for internal-branch PRs. The only new dependency is one
gh apicall to fetch attempt 1's conclusion, guarded so a failed call leavesgateAttempts = 0(falls back to the previous, stricter behavior).