Skip to content

[codex] ci: retry MSYS2 package installs on Windows#50

Draft
uchebnick wants to merge 1 commit into
mainfrom
ci/msys2-pacman-retry
Draft

[codex] ci: retry MSYS2 package installs on Windows#50
uchebnick wants to merge 1 commit into
mainfrom
ci/msys2-pacman-retry

Conversation

@uchebnick
Copy link
Copy Markdown
Owner

What changed

This moves Windows MSYS2 package installation out of msys2/setup-msys2 and into an explicit retrying step.

Root cause

The failing install-smoke (windows-arm64) job was not broken by the docs diff itself. It failed while msys2/setup-msys2 was downloading toolchain packages via pacman, with a mirror timeout on mingw-w64-clang-aarch64-zlib.

Fix

  • stop using the built-in install: path in msys2/setup-msys2
  • add scripts/install_msys2_package.sh
  • retry pacman -S --needed installs for Windows benchmark, test, and install-smoke jobs

Validation

  • bash -n scripts/install_msys2_package.sh
  • ruby -e 'require "yaml"; YAML.load_file(".github/workflows/ci.yml")'

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh to install a single MSYS2 package with retries and backoff.
  • Update .github/workflows/ci.yml to remove install: ${{ matrix.msys_pkg }} from msys2/setup-msys2 and 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}"

Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +11

attempt=1
while [ "$attempt" -le "$attempts" ]; do
if pacman --noconfirm -S --needed --overwrite '*' "$pkg"; then
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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

Copilot uses AI. Check for mistakes.
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.

2 participants