Skip to content

fix(skills): retry skill downloads with backoff - #814

Merged
gewenyu99 merged 2 commits into
mainfrom
posthog-code/skill-download-retry-fallback
Jul 7, 2026
Merged

gewenyu99 merged 2 commits into
mainfrom
posthog-code/skill-download-retry-fallback

Conversation

@posthog

@posthog posthog Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Skill downloads are a single fetch with a 30s timeout and no retries. One stalled or flaky connection fails the whole install.

This PR was rebased onto main after #809 replaced curl with fetch. The curl fallback it originally added is gone; the retry logic now wraps the fetch download.

Changes:

  • Retry the skill download up to 3 times with exponential backoff.
  • Raise the per-attempt timeout from 30s to 60s.
  • Include every attempt's error in the failure message.
  • Add unit tests for the retry helper.

Refs #808.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci error-tracking-upload-source-maps
  • /wizard-ci mcp-analytics
  • /wizard-ci misc
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci error-tracking-upload-source-maps/android
  • /wizard-ci error-tracking-upload-source-maps/cicd-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-nested-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-single-stage-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-gitlab-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-pnpm-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-raw-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-ssh-vps-node-raw
  • /wizard-ci error-tracking-upload-source-maps/flutter
  • /wizard-ci error-tracking-upload-source-maps/ios
  • /wizard-ci error-tracking-upload-source-maps/next
  • /wizard-ci error-tracking-upload-source-maps/next-no-posthog
  • /wizard-ci error-tracking-upload-source-maps/node-raw
  • /wizard-ci error-tracking-upload-source-maps/node-rollup
  • /wizard-ci error-tracking-upload-source-maps/node-rollup-typescript-plugin
  • /wizard-ci error-tracking-upload-source-maps/node-webpack
  • /wizard-ci error-tracking-upload-source-maps/nuxt-3-6
  • /wizard-ci error-tracking-upload-source-maps/nuxt-4-3
  • /wizard-ci error-tracking-upload-source-maps/react-native
  • /wizard-ci error-tracking-upload-source-maps/react-vite
  • /wizard-ci error-tracking-upload-source-maps/rust
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci misc/quack-quack
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

@edwinyjlim
edwinyjlim marked this pull request as ready for review July 7, 2026 15:59
@edwinyjlim
edwinyjlim requested a review from a team July 7, 2026 15:59
Skill downloads were a single fetch with a 30s timeout and no retries, so one stalled or flaky connection failed the whole install.

- Retry the download up to 3 times with exponential backoff.
- Raise the per-attempt timeout from 30s to 60s.
- Include every attempt's error in the failure message.
@gewenyu99
gewenyu99 force-pushed the posthog-code/skill-download-retry-fallback branch from ade0e29 to f3e510a Compare July 7, 2026 16:11
@gewenyu99 gewenyu99 changed the title fix(skills): retry + fetch fallback for skill download timeouts fix(skills): retry skill downloads with backoff Jul 7, 2026
@gewenyu99

Copy link
Copy Markdown
Collaborator

Verified: retry recovers transient skill-download failures

Unit + e2e — 30 pass (vitest run src/lib/__tests__/wizard-tools.test.ts):

  • downloadWithRetry: retries 5xx/429/network with backoff [500, 1000]; fails fast on a non-retryable 4xx (404 → 1 attempt, no sleep) — added so a missing skill / bad token doesn't burn the full backoff.
  • downloadSkill e2e over a real HTTP mock server: serves a dummy zip → installs + extracts; and 503-once → retry → recovers.

Live wizard run — mock skills server injecting failures (targeted at the skill .zip only, no global proxy, so health checks stay green):

[mock-skill] 503 transient  1/2  /skills/integration-android.zip
[mock-skill] 503 transient  2/2  /skills/integration-android.zip
[mock-skill] pass-through   hit#3  /skills/integration-android.zip

→ wizard: Skill installed to .claude/skills/integration-android/, health checks healthy (HTTP 200), run proceeded to [agent-runner] START. Two transient 503s absorbed; the third attempt succeeded.

@gewenyu99
gewenyu99 merged commit dd943f7 into main Jul 7, 2026
16 checks passed
@gewenyu99
gewenyu99 deleted the posthog-code/skill-download-retry-fallback branch July 7, 2026 20:36
gewenyu99 added a commit that referenced this pull request Sep 1, 2026
Follow-up to #814. The retry loop treated every non-ok response as transient,
so a 404 (missing skill) or 403 (bad token) burned the full backoff before
failing. Only 5xx, 408, and 429 are worth retrying — the rest propagate
immediately via NonRetryableDownloadError.

Also allow overriding LOCAL_SKILLS_BASE_URL via WIZARD_LOCAL_SKILLS_BASE_URL so
a local context-mill dev server on a non-default port can be pointed at.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant