Skip to content

Fix unstable-test rerun being skipped for fork PRs#8929

Merged
aholstrup1 merged 2 commits into
mainfrom
aholstrup1-automatic-fortnight
Jul 1, 2026
Merged

Fix unstable-test rerun being skipped for fork PRs#8929
aholstrup1 merged 2 commits into
mainfrom
aholstrup1-automatic-fortnight

Conversation

@aholstrup1

@aholstrup1 aholstrup1 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

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_required and zero jobs. This offsets the attempt numbering so the first real build is attempt 2. RerunUnstableFailures.ps1 capped reruns at MAX_ATTEMPTS = 1 by comparing the raw run_attempt, so 2 > 1 caused 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 an effectiveAttempt against MaxAttempts. The gate is always attempt 1, so this is a single extra API call only when run_attempt > 1. Internal-branch PRs are unaffected (effectiveAttempt == run_attempt).

Linked work

AB#640957

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

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 api call to fetch attempt 1's conclusion, guarded so a failed call leaves gateAttempts = 0 (falls back to the previous, stricter behavior).

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.
@aholstrup1 aholstrup1 requested review from a team June 30, 2026 13:28
@github-actions github-actions Bot added the Build: scripts & configs Build scripts and configuration files label Jun 30, 2026
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 2 · Outcome: not-applicable

The diff (.github/workflows/RerunUnstableFailures.yaml, build/scripts/RerunUnstableFailures.ps1) contains no AL source changes; every AL sub-skill declined with 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)

  • layer-disabled (knowledge) : 13 file(s)

Findings produced by the Copilot CLI agent against BCQuality at 822cae1b2771ac25f665f73369f69093bd4fd630. Reply 👎 on any inline comment to flag false positives.

mazhelez
mazhelez previously approved these changes Jun 30, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jun 30, 2026
@aholstrup1 aholstrup1 enabled auto-merge June 30, 2026 14:07
@github-actions github-actions Bot added the Build: Automation Workflows and other setup in .github folder label Jul 1, 2026
@aholstrup1 aholstrup1 disabled auto-merge July 1, 2026 07:59
@aholstrup1 aholstrup1 merged commit 0dc5c0c into main Jul 1, 2026
58 checks passed
@aholstrup1 aholstrup1 deleted the aholstrup1-automatic-fortnight branch July 1, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build: Automation Workflows and other setup in .github folder Build: scripts & configs Build scripts and configuration files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants