Skip to content

fix: retry HTTP download in install.ps1 on transient failure - #183

Open
juhovainio wants to merge 1 commit into
mainfrom
fix/windows-http-install-retry
Open

fix: retry HTTP download in install.ps1 on transient failure#183
juhovainio wants to merge 1 commit into
mainfrom
fix/windows-http-install-retry

Conversation

@juhovainio

Copy link
Copy Markdown
Collaborator

Summary

  • Save-File's Invoke-WebRequest call had no retry logic: a single transient connection failure (e.g. a connection reset, or the loopback/server-side listener not yet fully ready) aborted the install outright.
  • This is the failure signature behind the intermittent lifecycle-windows-http-install E2E flake seen on main and on PR test(e2e): tolerate intermittent EAI-7423 XPASS on the Strix Halo Ubuntu lane (EAI-7853) #182's merge queue attempt ("An error occurred while sending the request"), and it also affects real-world production HTTP downloads, not just the test's loopback server.
  • Save-File now retries the Invoke-WebRequest call up to 3 times with a short increasing backoff (250ms/500ms) before failing. The local file:// (Copy-Item) branch is untouched since it isn't networked and isn't implicated in the flake.

Why not use expectations.toml's flaky mechanism instead?

I looked into marking the scenario as flaky via the existing xfail matrix, but it doesn't fit this failure shape: flaky only tolerates an unexpected pass of a scenario that's expected to fail as a known bug (an XPASS). lifecycle-windows-http-install is an ordinary ExpectPass scenario that intermittently fails outright — the opposite case, which the reconciliation logic in tests/e2e-cucumber/tests/e2e.rs always treats as a fatal unexpected_fail, with no existing tolerance path.

Reusing/extending that mechanism to also cover unexpected-fail-of-expect-pass was flagged in PR #182's review discussion as a bigger design decision (a quarantine marker with an expiry was suggested as the better long-term shape) that shouldn't be decided ad hoc here. A genuine reliability fix at the actual failure site is more proportionate, and improves the real installer besides.

Test plan

  • CI: Windows E2E lifecycle suite, specifically lifecycle-windows-http-install, should pass reliably (or at minimum no longer show this exact failure signature if it's hit again transiently, since it'll now retry).
  • PSScriptAnalyzer lint check on install.ps1 stays clean.
  • Not locally testable: no pwsh available in this (Linux/WSL) dev environment, and there's no Pester/unit suite for install.ps1 — it's only exercised via the Windows E2E cucumber scenarios in CI.

Invoke-WebRequest had no retry logic, so a single transient
connection failure (e.g. connection reset, or the server-side
listener not yet ready) would abort the install outright. This is
the exact failure signature behind the intermittent
lifecycle-windows-http-install E2E flake, and it also affects real
production HTTP downloads.

The expectations.toml flaky mechanism was considered but doesn't fit
here: it only tolerates an unexpected pass of a known-bug xfail
scenario, not an unexpected fail of an expect-pass scenario, so it
can't be reused to tolerate this failure mode without a design change
to the expectation system itself.

Save-File now retries the Invoke-WebRequest call up to 3 times with
a short increasing backoff before failing. The local file:// (Copy-Item)
path is untouched since it isn't networked and isn't implicated in
the flake.

Signed-off-by: Juho Vainio <juho.vainio@amd.com>
@juhovainio
juhovainio requested a review from a team as a code owner August 5, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant