feat: retry Vite+ install on transient network failures#47
Conversation
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.
There was a problem hiding this comment.
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
execerrors as retryable by usingignoreReturnCode: 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.
| 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(), | ||
| })); |
|
@cursor review |
There was a problem hiding this comment.
✅ 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.
Summary
curl | bashon *nix,irmon Windows) in a retry loop — 3 attempts with 2s/4s backoff — so transient network failures likecurl: (6) Could not resolve host: viteplus.devno longer fail the action on the first try.ignoreReturnCode: trueand catch thrown exec errors too, so both non-zero exits and spawn failures are retryable.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 insrc/install-viteplus.test.tscovering first-try success, retry-then-success, exhaustion, and thrown exec errors)vp run check:fixcleanvp run build—dist/index.mjsrefreshedNote
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
installVitePlusresilient 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 thrownexecerrors 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
execerrors.Reviewed by Cursor Bugbot for commit 6903c25. Configure here.