Skip to content

feat: retry Vite+ install on transient network failures#47

Merged
fengmk2 merged 2 commits intomainfrom
feat/install-retry
Apr 21, 2026
Merged

feat: retry Vite+ install on transient network failures#47
fengmk2 merged 2 commits intomainfrom
feat/install-retry

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Apr 21, 2026

Summary

  • Wrap the Vite+ install command (curl | bash on *nix, irm on Windows) in a retry loop — 3 attempts with 2s/4s backoff — so transient network failures like curl: (6) Could not resolve host: viteplus.dev no longer fail the action on the first try.
  • Switch to ignoreReturnCode: true and catch thrown exec errors too, so both non-zero exits and spawn failures are retryable.
  • Emit a warning() between attempts with the failure reason and attempt counter; final error reports "after 3 attempts".

Test plan

  • vp run test — 97 passed (4 new cases in src/install-viteplus.test.ts covering first-try success, retry-then-success, exhaustion, and thrown exec errors)
  • vp run check:fix clean
  • vp run builddist/index.mjs refreshed
  • Observe a real CI run with the new action reference

Note

Low Risk
Low risk: adds a bounded retry/backoff loop around the installer command; main behavior change is potentially longer runtime and slightly different failure messaging when installs consistently fail.

Overview
Makes installVitePlus resilient to transient network/process failures by retrying the Vite+ install command up to 3 times with linear backoff, treating both non-zero exit codes and thrown exec errors as retryable.

Adds warnings between attempts with the failure reason and improves the final error to include the attempt count; includes new unit tests covering success, retry-then-success, retry exhaustion, and thrown exec errors.

Reviewed by Cursor Bugbot for commit 6903c25. Configure here.

The install step invokes a remote script (curl | bash on Linux/macOS,
irm for PowerShell on Windows). Transient network errors such as DNS
resolution failures caused the action to fail on the first attempt.

Wrap the install command in a retry loop (3 attempts, 2s/4s backoff)
and treat both non-zero exits and thrown exec errors as retryable.
Copilot AI review requested due to automatic review settings April 21, 2026 09:00
@fengmk2 fengmk2 self-assigned this Apr 21, 2026
Copy link
Copy Markdown
Contributor

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds retry logic around the Vite+ installer execution to make the GitHub Action resilient to transient network/spawn failures, with warnings between attempts and a final aggregated error after exhaustion.

Changes:

  • Retry the install command up to 3 times with linear backoff (2s/4s) and warnings between attempts.
  • Treat both non-zero exit codes and thrown exec errors as retryable by using ignoreReturnCode: true.
  • Add unit tests covering success, retry-then-success, exhaustion, and thrown exec errors.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/install-viteplus.ts Wraps installer execution in a retry loop and centralizes command execution/error formatting.
src/install-viteplus.test.ts Adds tests validating retry behavior and warning/error conditions.

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

Comment on lines +1 to +15
import { describe, it, expect, afterEach, vi } from "vite-plus/test";
import { exec } from "@actions/exec";
import { warning } from "@actions/core";
import { installVitePlus } from "./install-viteplus.js";
import type { Inputs } from "./types.js";

vi.mock("@actions/core", () => ({
info: vi.fn(),
warning: vi.fn(),
addPath: vi.fn(),
}));

vi.mock("@actions/exec", () => ({
exec: vi.fn(),
}));
Comment thread src/install-viteplus.ts Outdated
@fengmk2
Copy link
Copy Markdown
Member Author

fengmk2 commented Apr 21, 2026

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 6903c25. Configure here.

@fengmk2 fengmk2 merged commit 379deda into main Apr 21, 2026
40 checks passed
@fengmk2 fengmk2 deleted the feat/install-retry branch April 21, 2026 09:52
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