[codex] ci: retry MSYS2 package installs on Windows#50
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves Windows CI stability by moving MSYS2 package installation out of msys2/setup-msys2’s built-in install: option and into a custom retrying pacman install script, mitigating transient MSYS2 mirror timeouts (notably on Windows ARM64).
Changes:
- Add
scripts/install_msys2_package.shto install a single MSYS2 package with retries and backoff. - Update
.github/workflows/ci.ymlto removeinstall: ${{ matrix.msys_pkg }}frommsys2/setup-msys2and instead call the new script for benchmark, test, and install-smoke Windows jobs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/install_msys2_package.sh | New retry wrapper around pacman -S --needed for a single package. |
| .github/workflows/ci.yml | Switch Windows MSYS2 toolchain installation to an explicit retrying step. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pkg="${1:?usage: install_msys2_package.sh <package>}" | ||
| attempts="${MSYS2_PACMAN_ATTEMPTS:-3}" | ||
| base_delay="${MSYS2_PACMAN_RETRY_DELAY_SECONDS:-5}" | ||
|
|
There was a problem hiding this comment.
attempts and base_delay are treated as integers (used with -le and arithmetic expansion), but they come from env vars and are not validated. If a non-numeric value is provided, the script will fail with a confusing shell error (e.g., “integer expression expected”). Consider validating both vars early (or coercing to defaults) and exiting with a clear message when they’re not positive integers.
| case "$attempts" in | |
| ''|*[!0-9]*) | |
| echo "MSYS2_PACMAN_ATTEMPTS must be a positive integer, got: ${attempts}" >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| if [ "$attempts" -le 0 ]; then | |
| echo "MSYS2_PACMAN_ATTEMPTS must be a positive integer, got: ${attempts}" >&2 | |
| exit 1 | |
| fi | |
| case "$base_delay" in | |
| ''|*[!0-9]*) | |
| echo "MSYS2_PACMAN_RETRY_DELAY_SECONDS must be a positive integer, got: ${base_delay}" >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| if [ "$base_delay" -le 0 ]; then | |
| echo "MSYS2_PACMAN_RETRY_DELAY_SECONDS must be a positive integer, got: ${base_delay}" >&2 | |
| exit 1 | |
| fi |
|
|
||
| attempt=1 | ||
| while [ "$attempt" -le "$attempts" ]; do | ||
| if pacman --noconfirm -S --needed --overwrite '*' "$pkg"; then |
There was a problem hiding this comment.
Using --overwrite '*' allows pacman to overwrite any conflicting files, which can mask real packaging/file-conflict issues and potentially leave the MSYS2 environment in an unexpected state. If overwrites are required, consider narrowing the overwrite glob to the known conflicting paths/files (or documenting why a blanket overwrite is safe/needed here).
| attempt=1 | |
| while [ "$attempt" -le "$attempts" ]; do | |
| if pacman --noconfirm -S --needed --overwrite '*' "$pkg"; then | |
| overwrite_glob="${MSYS2_PACMAN_OVERWRITE:-}" | |
| pacman_args=(--noconfirm -S --needed) | |
| if [ -n "$overwrite_glob" ]; then | |
| pacman_args+=(--overwrite "$overwrite_glob") | |
| fi | |
| attempt=1 | |
| while [ "$attempt" -le "$attempts" ]; do | |
| if pacman "${pacman_args[@]}" "$pkg"; then |
What changed
This moves Windows MSYS2 package installation out of
msys2/setup-msys2and into an explicit retrying step.Root cause
The failing
install-smoke (windows-arm64)job was not broken by the docs diff itself. It failed whilemsys2/setup-msys2was downloading toolchain packages viapacman, with a mirror timeout onmingw-w64-clang-aarch64-zlib.Fix
install:path inmsys2/setup-msys2scripts/install_msys2_package.shpacman -S --neededinstalls for Windows benchmark, test, and install-smoke jobsValidation
bash -n scripts/install_msys2_package.shruby -e 'require "yaml"; YAML.load_file(".github/workflows/ci.yml")'