Skip to content

fix: harden network retries in CI and release workflows - #359

Merged
c-vigo merged 13 commits into
release/0.3.1from
bugfix/357-bounded-retry-network-calls
Mar 18, 2026
Merged

c-vigo merged 13 commits into
release/0.3.1from
bugfix/357-bounded-retry-network-calls

Conversation

@c-vigo

@c-vigo c-vigo commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR hardens network-sensitive release and CI paths by replacing shell retries with the vig-utils Python retry CLI and making retry-safe workflow operations idempotent. It also syncs the same behavior into workspace templates and smoke-test dispatch logic to keep upstream and downstream workflows aligned.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • packages/vig-utils/src/vig_utils/retry.py
    • Added a bounded retry CLI implementation for network-dependent command execution.
  • packages/vig-utils/tests/test_retry.py
    • Added pytest coverage for retry behavior and failure handling.
  • .github/actions/setup-env/action.yml, .github/actions/test-image/action.yml
    • Updated setup/image test paths to use the retry CLI where network calls are sensitive.
  • .github/workflows/release.yml, .github/workflows/prepare-release.yml, .github/workflows/ci.yml, .github/workflows/sync-issues.yml, .github/workflows/sync-main-to-dev.yml
    • Hardened release/sync/CI workflow steps with retry-safe execution and idempotency guards.
  • assets/smoke-test/.github/workflows/repository-dispatch.yml
    • Improved dispatch flow resiliency and safe rerun behavior.
  • assets/workspace/.github/workflows/release-core.yml, assets/workspace/.github/workflows/release-publish.yml, assets/workspace/.github/workflows/release.yml, assets/workspace/.github/workflows/prepare-release.yml, assets/workspace/.github/workflows/sync-issues.yml, assets/workspace/.github/workflows/sync-main-to-dev.yml, assets/workspace/.github/actions/resolve-image/action.yml
    • Synced downstream workflow templates to the retry CLI and image tag resolution updates.
  • CHANGELOG.md, assets/workspace/.devcontainer/CHANGELOG.md, packages/vig-utils/pyproject.toml

Changelog Entry

Fixed

  • Bounded retry added for network-dependent setup and prepare-release calls (#357)
    • Replace shell-based retry helper with pure Python retry CLI in vig-utils (packages/vig-utils/src/vig_utils/retry.py)
    • Update this repository CI workflows to call uv run retry after setup-env dependency sync
    • Update downstream workflow templates to call retry directly in devcontainer jobs and remove source lines
    • Ensure downstream containerized jobs resolve image tags from .vig-os instead of hardcoded latest
    • Bundle idempotency guards for branch/PR/tag/release creation paths to keep retried network calls safe on reruns
    • Remove synced retry.sh artifacts and BATS retry tests in favor of vig-utils pytest coverage

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

N/A

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

N/A

Refs: #357

@c-vigo c-vigo self-assigned this Mar 18, 2026
@c-vigo
c-vigo requested a review from Copilot March 18, 2026 14:01

Copilot AI left a comment

Copy link
Copy Markdown

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 introduces a bounded retry CLI in vig-utils and updates CI/release/sync workflows (including workspace + smoke-test templates) to use it for network-sensitive operations, with additional idempotency guards around GitHub/Git operations to make reruns safer.

Changes:

  • Added vig-utils retry CLI (with pytest coverage) and wired it as a console script.
  • Replaced ad-hoc shell retry loops with uv run retry / retry across CI, release, and sync workflows (plus templates).
  • Updated downstream templates and smoke-test dispatch flows to resolve container image tags from .vig-os and harden API operations.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/vig-utils/src/vig_utils/retry.py New Python retry CLI implementing bounded exponential backoff for command execution.
packages/vig-utils/tests/test_retry.py Pytest coverage for retry behavior, parsing/validation, and module invocation.
packages/vig-utils/pyproject.toml Registers retry as a vig-utils console script.
.github/actions/setup-env/action.yml Wraps network curl calls (hadolint/taplo install) with uv run retry and adds taplo-version sanity check.
.github/actions/test-image/action.yml Replaces manual pull retry loop with uv run retry for podman pull.
.github/workflows/ci.yml Uses uv run retry for installing Safety to reduce transient failure flakiness.
.github/workflows/release.yml Replaces multiple manual retry loops with uv run retry and adds some idempotency guards for tag/release/dispatch steps.
.github/workflows/prepare-release.yml Wraps gh api calls with uv run retry to harden release preparation.
.github/workflows/sync-issues.yml Adds uv run retry around cache deletion API calls.
.github/workflows/sync-main-to-dev.yml Adds uv run retry around networked git fetch and gh API operations for the sync PR automation.
assets/workspace/.github/actions/resolve-image/action.yml Makes image resolution strict: requires .vig-os or explicit override (no silent latest).
assets/workspace/.github/workflows/release-core.yml Adds image-tag resolution job and uses retry inside containerized jobs (plus retries around network checks).
assets/workspace/.github/workflows/release-publish.yml Adds image-tag resolution job; uses containerized execution and adds retry/idempotency around tagging and release creation.
assets/workspace/.github/workflows/release.yml Runs rollback job inside the resolved devcontainer image and uses retry for network-sensitive rollback ops.
assets/workspace/.github/workflows/prepare-release.yml Wraps GitHub API calls with retry and adds idempotency guards for branch/PR creation.
assets/workspace/.github/workflows/sync-issues.yml Adds uv run retry around cache deletion API calls in the workspace template.
assets/workspace/.github/workflows/sync-main-to-dev.yml Adds uv run retry around fetch/API operations in the workspace template sync workflow.
assets/smoke-test/.github/workflows/repository-dispatch.yml Adds image-tag resolution from .vig-os, runs jobs in the resolved devcontainer image, and applies retry to network/API operations.
CHANGELOG.md Adds the #357 “bounded retry” entry to Unreleased.
assets/workspace/.devcontainer/CHANGELOG.md Syncs the same changelog entry into the workspace devcontainer changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/sync-issues.yml Resolved
Comment thread .github/workflows/sync-main-to-dev.yml Resolved
Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved

Copilot AI left a comment

Copy link
Copy Markdown

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 introduces a Python-based bounded retry CLI in vig-utils and updates CI/release automation (including workspace templates and smoke-test dispatch) to use it for network-sensitive operations while adding idempotency guards for retried GitHub/Git operations.

Changes:

  • Added vig-utils retry CLI (bounded exponential backoff) plus pytest coverage.
  • Replaced several workflow shell retry loops with uv run retry ... (bare runners) or retry ... (containerized jobs), and added rerun-safe idempotency checks for branch/PR/tag/release creation.
  • Synced the same retry/idempotency patterns into workspace workflow templates and updated image-tag resolution behavior.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/vig-utils/src/vig_utils/retry.py Implements the retry CLI and core retry loop with bounded exponential backoff.
packages/vig-utils/tests/test_retry.py Adds unit tests for retry behavior, backoff capping, and CLI validation.
packages/vig-utils/pyproject.toml Registers retry as a console script entrypoint.
.github/actions/setup-env/action.yml Wraps network curl calls with uv run retry during tool installation.
.github/actions/test-image/action.yml Replaces podman pull retry loop with uv run retry.
.github/workflows/ci.yml Uses uv run retry around uv pip install for network resilience.
.github/workflows/prepare-release.yml Wraps gh api/PR creation paths with uv run retry.
.github/workflows/release.yml Replaces ad-hoc retries with uv run retry and adds idempotency checks for tag/release operations.
.github/workflows/sync-issues.yml Adds a resolve-image job and runs sync work in the devcontainer image, using retry.
.github/workflows/sync-main-to-dev.yml Adds a resolve-image job and runs merge automation in the devcontainer image, using retry.
assets/workspace/.github/actions/resolve-image/action.yml Changes workspace image-tag resolution to fail fast if .vig-os/override is missing.
assets/workspace/.github/workflows/release-core.yml Adds resolve-image job and switches validation to run in the resolved devcontainer image; adds retries for network calls.
assets/workspace/.github/workflows/release-publish.yml Adds resolve-image job, runs publish steps in container, and adds idempotent tag/release creation with retry.
assets/workspace/.github/workflows/release.yml Runs rollback job in container and wraps network git/gh operations with retry.
assets/workspace/.github/workflows/prepare-release.yml Wraps gh api calls with retry and adds idempotent branch/PR creation behavior.
assets/workspace/.github/workflows/sync-issues.yml Adds resolve-image job, runs containerized, and wraps gh api calls with retry.
assets/workspace/.github/workflows/sync-main-to-dev.yml Adds resolve-image job, runs containerized, and wraps git/gh operations with retry + rerun-safety.
assets/smoke-test/.github/workflows/repository-dispatch.yml Adds resolve-image job, runs in container, and wraps gh/curl operations with retry + rerun-safety.
CHANGELOG.md Adds the #357 “bounded retry” changelog entry.
assets/workspace/.devcontainer/CHANGELOG.md Syncs the same #357 changelog entry into the workspace devcontainer changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/sync-main-to-dev.yml Resolved
Comment thread .github/workflows/sync-issues.yml Resolved
Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/sync-main-to-dev.yml Resolved

Copilot AI left a comment

Copy link
Copy Markdown

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 hardens CI/release automation against transient network/API failures by introducing a shared vig-utils retry CLI and wiring it into upstream workflows, workspace templates, and the smoke-test dispatch pipeline, while also making retried operations (branch/tag/release/PR creation) safer to rerun.

Changes:

  • Added a new vig_utils.retry CLI (bounded exponential backoff) plus pytest coverage.
  • Replaced ad-hoc shell retry loops with uv run retry (host runners) or retry (containerized jobs) across CI/release/sync workflows.
  • Introduced .vig-os-based image-tag resolution and synced the resolver pattern into downstream templates and smoke-test workflows.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/vig-utils/src/vig_utils/retry.py New bounded retry CLI implementation used by workflows.
packages/vig-utils/tests/test_retry.py Pytest coverage for retry behavior, validation, and module invocation.
packages/vig-utils/pyproject.toml Exposes retry as a console script entrypoint.
.github/actions/resolve-image/action.yml New composite action to resolve/validate devcontainer image tag from .vig-os.
.github/actions/setup-env/action.yml Wraps network-sensitive downloads (hadolint/taplo) with uv run retry.
.github/actions/test-image/action.yml Uses uv run retry for network-sensitive podman pull.
.github/workflows/ci.yml Uses uv run retry for network-sensitive installs (e.g., safety).
.github/workflows/release.yml Replaces custom retry loops with uv run retry and adds idempotency guards for tag/release creation.
.github/workflows/prepare-release.yml Wraps gh api calls in uv run retry and adds safe rerun behavior for branch/PR creation.
.github/workflows/sync-issues.yml Runs job in resolved devcontainer image and wraps API calls with retry.
.github/workflows/sync-main-to-dev.yml Runs jobs in resolved devcontainer image and wraps network/API calls with retry plus idempotency guards.
assets/workspace/.github/actions/resolve-image/action.yml Tightens template resolver to require .vig-os (no latest fallback).
assets/workspace/.github/workflows/release-core.yml Adds resolve-image job; runs validate steps in the resolved devcontainer; wraps network calls with retry.
assets/workspace/.github/workflows/release-publish.yml Adds resolve-image job; runs publish in container; hardens tag/release operations with retry + idempotency.
assets/workspace/.github/workflows/release.yml Ensures rollback job runs in resolved container; wraps git/gh network calls with retry.
assets/workspace/.github/workflows/prepare-release.yml Wraps gh api calls with retry and adds safe rerun behavior for branch/PR creation.
assets/workspace/.github/workflows/sync-issues.yml Adds resolve-image job; runs sync job in container; wraps API calls with retry.
assets/workspace/.github/workflows/sync-main-to-dev.yml Adds resolve-image job; runs jobs in container; wraps fetch/API calls with retry + idempotency.
assets/smoke-test/.github/workflows/repository-dispatch.yml Adds image resolution and wraps curl/gh operations with retry and idempotency guards.
assets/smoke-test/.vig-os Provides smoke-test template image tag source for resolution.
.vig-os Adds repo-level image tag source for workflow container resolution.
CHANGELOG.md Records the retry hardening change under Fixed.
assets/workspace/.devcontainer/CHANGELOG.md Syncs the same changelog entry into the workspace template.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +75 to +81
result = subprocess.run(
command,
stdin=sys.stdin,
stdout=sys.stdout,
stderr=sys.stderr,
check=False,
)
Catch OS-level subprocess launch errors so `retry` exits with stable shell-compatible codes instead of crashing with a traceback.

Refs: #357
@c-vigo
c-vigo merged commit 64203ef into release/0.3.1 Mar 18, 2026
12 checks passed
@c-vigo
c-vigo deleted the bugfix/357-bounded-retry-network-calls branch March 18, 2026 18:09
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