Skip to content

Sync retry/backoff npm install logic to setup-api-client template#1657

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/sub-pr-1656
Closed

Sync retry/backoff npm install logic to setup-api-client template#1657
Copilot wants to merge 4 commits intomainfrom
copilot/sub-pr-1656

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 25, 2026

The template copy of setup-api-client at templates/consumer-repo/.github/actions/setup-api-client/action.yml was missing the exponential-backoff retry loop and pinned lru-cache@10.4.3 added to the main action in #1656, causing template drift.

Changes

  • templates/consumer-repo/.github/actions/setup-api-client/action.yml
    • Replace single-attempt install (with one --legacy-peer-deps fallback) with a 3-attempt loop using exponential backoff (5s → 10s → 20s)
    • Pin lru-cache@10.4.3 (was lru-cache@^10.0.0)
    • Apply --legacy-peer-deps fallback on first failure before sleeping and retrying
    • Fail explicitly with ::error:: after all attempts exhausted

The template now matches the main action exactly:

NPM_MAX_RETRIES=3
NPM_BACKOFF=5  # doubles each retry (5, 10, 20)
npm_installed=false

for (( attempt=1; attempt<=NPM_MAX_RETRIES; attempt++ )); do
  if npm install --no-save --location=project "${NPM_PACKAGES[@]}"; then
    npm_installed=true; break
  fi
  # attempt 1: also retry with --legacy-peer-deps
  # subsequent: sleep with backoff
done

if [ "$npm_installed" != "true" ]; then
  echo "::error::npm install failed after $NPM_MAX_RETRIES attempts"
  exit 1
fi

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

claude and others added 3 commits February 25, 2026 19:12
…query

ERROR_CATEGORIES.RESOURCE was undefined because the error_classifier
exports lowercase keys. This caused the isNotFound check to always fail,
so 404/resource errors from missing workflows were reported as "api_error"
instead of being handled as expected not-found responses.

https://claude.ai/code/session_01JhCWWDJG8PqwaSbVPCGfm6
Transient npm registry 403 errors (e.g. on safe-buffer) can kill the
keepalive loop chain with no recovery. Replace the single-retry logic
with a 3-attempt loop using exponential backoff (5s, 10s, 20s). The
first failure still tries --legacy-peer-deps as before.

https://claude.ai/code/session_01JhCWWDJG8PqwaSbVPCGfm6
Co-authored-by: stranske <23046322+stranske@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix retry with backoff for setup-api-client npm install Sync retry/backoff npm install logic to setup-api-client template Feb 25, 2026
Base automatically changed from claude/fix-task-completion-concerns-I1gRT to main February 25, 2026 20:39
@stranske stranske closed this Feb 25, 2026
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.

3 participants