From 9aff1ea0989891c33a3a9e02815a699e6d3ab15e Mon Sep 17 00:00:00 2001 From: Krystie Date: Fri, 3 Jul 2026 18:50:10 -0700 Subject: [PATCH] =?UTF-8?q?ci:=20fix=20Windows=20Tor=20bundle=20=E2=80=94?= =?UTF-8?q?=20drop=20PS7-only=20params=20from=20Invoke-WebRequest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hardened PowerShell retry loop from 2c2efd8 passed -ConnectionTimeout and -OperationTimeout to Invoke-WebRequest. Those are PowerShell 7+ only; GitHub Actions Windows runners ship PowerShell 5.1, which rejected them with 'ParentContainsErrorRecordException / NamedParameterNotFound' on the first iteration of the loop, and the catch block silently counted the syntax error as a 'failed attempt' instead of a script bug. Result on run #28689210122: both Windows jobs (build-windows-qt, build-windows-daemon) failed at 'Download Tor' / 'Bundle Tor for daemon' with exit code 1 before any HTTP traffic happened. macOS + Linux passed. Fix: * Drop -ConnectionTimeout and -OperationTimeout (PS7-only). * Restructure the retry loop: explicit $downloaded flag, remove the part-file on each attempt, throw explicitly at the end if all 3 attempts produced no usable file. The size check (>1MB) still rejects 0-byte / truncated '200 OK' responses. * Add a comment at the top of each step explaining the PS 5.1 limitation so the next agent doesn't re-add the PS7 params. --- .github/workflows/build-all.yml | 50 +++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 925ed21..1de5515 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -288,9 +288,11 @@ jobs: - name: Download Tor # Resilient download: archive.torproject.org occasionally times out # from CI egress (observed 2026-07-03: macOS job exit code 6 after - # exactly 30s of curl hang). Retries cover transient connection - # drops; -SkipHttpErrorCheck surfaces HTTP error bodies so the next - # failure isn't silent. + # exactly 30s of curl hang). Retries cover transient connection drops; + # size check rejects 0-byte "200 OK" responses from broken mirrors. + # NOTE: Invoke-WebRequest on PowerShell 5.1 (default on Windows-latest + # runners) does NOT accept -ConnectionTimeout/-OperationTimeout — those + # are PowerShell 7+. We rely on the retry loop + size check only. shell: powershell run: | $TOR_VERSION = "15.0.9" @@ -298,21 +300,25 @@ jobs: $torPath = "tor-bundle.tar.gz" $attempts = 0 $maxAttempts = 3 - while ($attempts -lt $maxAttempts) { + $downloaded = $false + while ($attempts -lt $maxAttempts -and -not $downloaded) { $attempts++ try { - Invoke-WebRequest -Uri $TOR_URL -OutFile $torPath -UseBasicParsing ` - -ConnectionTimeout 15 -OperationTimeout 120 + if (Test-Path $torPath) { Remove-Item $torPath -ErrorAction SilentlyContinue } + Invoke-WebRequest -Uri $TOR_URL -OutFile $torPath -UseBasicParsing $size = (Get-Item $torPath).Length - if ($size -gt 1MB) { break } - Write-Host "Download too small ($size bytes), retrying..." - Remove-Item $torPath -ErrorAction SilentlyContinue + if ($size -gt 1MB) { + Write-Host "Downloaded $size bytes on attempt $attempts" + $downloaded = $true + } else { + Write-Host "Download too small ($size bytes), retrying..." + } } catch { Write-Host "Download attempt $attempts failed: $_" - if ($attempts -ge $maxAttempts) { throw } Start-Sleep -Seconds 5 } } + if (-not $downloaded) { throw "Tor bundle download failed after $maxAttempts attempts" } New-Item -ItemType Directory -Path tor-extract -Force tar -xzf tor-bundle.tar.gz -C tor-extract New-Item -ItemType Directory -Path tor-files -Force @@ -410,7 +416,11 @@ jobs: - name: Bundle Tor for daemon # Resilient download: archive.torproject.org occasionally times out # from CI egress (observed 2026-07-03: macOS job exit code 6 after - # exactly 30s of curl hang). Retries cover transient connection drops. + # exactly 30s of curl hang). Retries cover transient connection drops; + # size check rejects 0-byte "200 OK" responses from broken mirrors. + # NOTE: Invoke-WebRequest on PowerShell 5.1 (default on Windows-latest + # runners) does NOT accept -ConnectionTimeout/-OperationTimeout — those + # are PowerShell 7+. We rely on the retry loop + size check only. shell: powershell run: | $TOR_VERSION = "15.0.9" @@ -418,21 +428,25 @@ jobs: $torPath = "tor-bundle.tar.gz" $attempts = 0 $maxAttempts = 3 - while ($attempts -lt $maxAttempts) { + $downloaded = $false + while ($attempts -lt $maxAttempts -and -not $downloaded) { $attempts++ try { - Invoke-WebRequest -Uri $TOR_URL -OutFile $torPath -UseBasicParsing ` - -ConnectionTimeout 15 -OperationTimeout 120 + if (Test-Path $torPath) { Remove-Item $torPath -ErrorAction SilentlyContinue } + Invoke-WebRequest -Uri $TOR_URL -OutFile $torPath -UseBasicParsing $size = (Get-Item $torPath).Length - if ($size -gt 1MB) { break } - Write-Host "Download too small ($size bytes), retrying..." - Remove-Item $torPath -ErrorAction SilentlyContinue + if ($size -gt 1MB) { + Write-Host "Downloaded $size bytes on attempt $attempts" + $downloaded = $true + } else { + Write-Host "Download too small ($size bytes), retrying..." + } } catch { Write-Host "Download attempt $attempts failed: $_" - if ($attempts -ge $maxAttempts) { throw } Start-Sleep -Seconds 5 } } + if (-not $downloaded) { throw "Tor bundle download failed after $maxAttempts attempts" } New-Item -ItemType Directory -Path tor-extract -Force tar -xzf tor-bundle.tar.gz -C tor-extract Copy-Item -Recurse tor-extract/tor/* daemon-dist/tor/