:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(ci): retry transient curl fetch failures (#83712)
Raúl Negrón-Otero30300b14bb50
diff --git a/.agents/skills/authoring-ci-workflows/SKILL.md b/.agents/skills/authoring-ci-workflows/SKILL.mdindex 744f9552eade..152bba058506 100644--- a/.agents/skills/authoring-ci-workflows/SKILL.md+++ b/.agents/skills/authoring-ci-workflows/SKILL.md@@ -159,6 +159,19 @@ Default to shallow; go deep only for real merge-base or version math, and even tSparse-checkout `.nvmrc` if the job has no checkout.- **Pin `setup-uv`'s `version:`** — an unpinned `setup-uv` calls the GitHub API on every job and burns the rate limit.+## Network fetches++Downloads from outside the runner need retries, or a transient reset becomes a red check with no findings ([actionlint died on `curl: (35)`](https://github.com/PostHog/posthog/actions/runs/32022348027/job/95364480249)).++```bash+curl -fsSL --retry 5 --retry-all-errors --retry-max-time 60 --connect-timeout 10 -o "$out" "$url"+```++- `--retry-all-errors` is the part that catches a reset; plain `--retry` covers only timeouts and 408/429/5xx, and `--retry-connrefused` adds `ECONNREFUSED`, not `ECONNRESET`.+- Drop it on GitHub API calls: with `-f` it also retries 403 and 404, spending five more requests on an already-empty token bucket.+- No `--retry-delay` (it replaces exponential backoff with a fixed wait). Keep `-f`, or an error page lands in your output file at exit 0.+- Don't retry anything non-idempotent (webhook posts, telemetry), or where a shell loop or readiness wait already retries.+## Tokens — dedicated App tokens for high-volume calls`GITHUB_TOKEN` shares one ~15k req/hr bucket across every job of every run in the repo; it goes hot at merge peaks and change-detection jobs fail before real work starts.@@ -233,6 +246,7 @@ Roll out a new blocking lint the same way: ship `continue-on-error`, clear the i- [ ] `timeout-minutes` on every job (except reusable-caller jobs).- [ ] Checkout is shallow, or bounded `1000 + blob:none` for base diffing.- [ ] Third-party actions SHA-pinned; Node from `.nvmrc`; `setup-uv` version pinned.+- [ ] External fetches retry (`--retry-all-errors`), except where a repeat has a side effect.- [ ] High-volume API calls on a dedicated App token with `|| github.token` fork fallback.- [ ] Fork PRs handled: secret-needing steps guarded with the same-repo `if:`; no secret-injecting build runs on forks.- [ ] Caching through the shared composites; writes gated to master.diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.ymlindex 5a1b06e0f0e8..8e4dc539dea6 100644--- a/.depot/workflows/ci-backend.yml+++ b/.depot/workflows/ci-backend.yml@@ -1761,7 +1761,10 @@ jobs:# changed (requirements.txt has the already-published version)run: |sudo apt-get install unzip cmake curl uuid pkg-config- curl --fail --location https://www.antlr.org/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip || curl --fail --location https://raw.githubusercontent.com/antlr/website-antlr4/gh-pages/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip+ # Short budget: the `||` mirror is the real fallback for a host that is down.+ fetch=(curl --fail --location --retry 3 --retry-all-errors --retry-max-time 30 --connect-timeout 10)+ "${fetch[@]}" https://www.antlr.org/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip \+ || "${fetch[@]}" https://raw.githubusercontent.com/antlr/website-antlr4/gh-pages/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip# Check that the downloaded archive is the expected runtime - a security measureanltr_known_md5sum="c875c148991aacd043f733827644a76f"antlr_found_ms5sum="$(md5sum antlr4-source.zip | cut -d' ' -f1)"diff --git a/.github/actions/get-pr-labels/action.yml b/.github/actions/get-pr-labels/action.ymlindex e74a1992526e..fee556d75d9c 100644--- a/.github/actions/get-pr-labels/action.yml+++ b/.github/actions/get-pr-labels/action.yml@@ -42,7 +42,7 @@ runs:echo labels="[]" >> $GITHUB_OUTPUTexit 0fi- LABELS=$(curl \+ LABELS=$(curl -fsS --retry 5 --retry-max-time 60 --connect-timeout 10 \-H "Authorization: Bearer $GITHUB_TOKEN" \-H "Accept: application/vnd.github.v3+json" \https://api.github.com/repos/$REPOSITORY/issues/$PR_NUMBER/labels | jq -rc '[.[].name]')diff --git a/.github/workflows/ci-actionlint.yml b/.github/workflows/ci-actionlint.ymlindex 454fdb934571..4fd414d33a57 100644--- a/.github/workflows/ci-actionlint.yml+++ b/.github/workflows/ci-actionlint.yml@@ -32,7 +32,8 @@ jobs:run: |set -euo pipefailmkdir -p ./.bin- curl -fsSL -o ./download-actionlint.bash \+ curl -fsSL --retry 5 --retry-all-errors --retry-max-time 60 --connect-timeout 10 \+ -o ./download-actionlint.bash \"https://raw.githubusercontent.com/rhysd/actionlint/${ACTIONLINT_SCRIPT_REF}/scripts/download-actionlint.bash"bash ./download-actionlint.bash "${ACTIONLINT_VERSION}" ./.bin./.bin/actionlint -versiondiff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.ymlindex 1e0f6aafeeb5..d54f60cce5e8 100644--- a/.github/workflows/ci-backend.yml+++ b/.github/workflows/ci-backend.yml@@ -2772,7 +2772,10 @@ jobs:# changed (requirements.txt has the already-published version)run: |sudo apt-get install unzip cmake curl uuid pkg-config- curl --fail --location https://www.antlr.org/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip || curl --fail --location https://raw.githubusercontent.com/antlr/website-antlr4/gh-pages/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip+ # Short budget: the `||` mirror is the real fallback for a host that is down.+ fetch=(curl --fail --location --retry 3 --retry-all-errors --retry-max-time 30 --connect-timeout 10)+ "${fetch[@]}" https://www.antlr.org/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip \+ || "${fetch[@]}" https://raw.githubusercontent.com/antlr/website-antlr4/gh-pages/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip# Check that the downloaded archive is the expected runtime - a security measureanltr_known_md5sum="c875c148991aacd043f733827644a76f"antlr_found_ms5sum="$(md5sum antlr4-source.zip | cut -d' ' -f1)"diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.ymlindex fdd4e60b5f6b..0f657cedd482 100644--- a/.github/workflows/ci-e2e-playwright.yml+++ b/.github/workflows/ci-e2e-playwright.yml@@ -644,7 +644,10 @@ jobs:# changed (requirements.txt has the already-published version)run: |sudo apt-get install unzip cmake curl uuid pkg-config- curl --fail --location https://www.antlr.org/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip || curl --fail --location https://raw.githubusercontent.com/antlr/website-antlr4/gh-pages/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip+ # Short budget: the `||` mirror is the real fallback for a host that is down.+ fetch=(curl --fail --location --retry 3 --retry-all-errors --retry-max-time 30 --connect-timeout 10)+ "${fetch[@]}" https://www.antlr.org/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip \+ || "${fetch[@]}" https://raw.githubusercontent.com/antlr/website-antlr4/gh-pages/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip# Check that the downloaded archive is the expected runtime - a security measureanltr_known_md5sum="c875c148991aacd043f733827644a76f"antlr_found_ms5sum="$(md5sum antlr4-source.zip | cut -d' ' -f1)"diff --git a/.github/workflows/ci-hog.yml b/.github/workflows/ci-hog.ymlindex 2dafe863fc52..74af503264c6 100644--- a/.github/workflows/ci-hog.yml+++ b/.github/workflows/ci-hog.yml@@ -120,7 +120,10 @@ jobs:sudo apt-get update && sudo apt-get install default-jremkdir antlrcd antlr- curl --fail --location https://www.antlr.org/download/antlr-${ANTLR_VERSION}-complete.jar --output antlr.jar || curl --fail --location https://repo.maven.apache.org/maven2/org/antlr/antlr4/${ANTLR_VERSION}/antlr4-${ANTLR_VERSION}-complete.jar --output antlr.jar+ # Short budget: the `||` mirror is the real fallback for a host that is down.+ fetch=(curl --fail --location --retry 3 --retry-all-errors --retry-max-time 30 --connect-timeout 10)+ "${fetch[@]}" https://www.antlr.org/download/antlr-${ANTLR_VERSION}-complete.jar --output antlr.jar \+ || "${fetch[@]}" https://repo.maven.apache.org/maven2/org/antlr/antlr4/${ANTLR_VERSION}/antlr4-${ANTLR_VERSION}-complete.jar --output antlr.jarexport PWD=`pwd`echo '#!/bin/bash' > antlrecho "java -jar $PWD/antlr.jar \$*" >> antlrdiff --git a/.github/workflows/pr-closed.yml b/.github/workflows/pr-closed.ymlindex 803c590817df..7976aeab5457 100644--- a/.github/workflows/pr-closed.yml+++ b/.github/workflows/pr-closed.yml@@ -162,7 +162,8 @@ jobs:# to fail the whole run and mask real cleanup failures on the# dashboard (4x on 2026-07-09, e.g. run 29040552494). Guard on the# type: degrade to an empty message instead of crashing.- first_commit_message_in_pr=$(curl -s "$PR_HREF" \+ first_commit_message_in_pr=$(curl -s \+ --retry 5 --retry-max-time 60 --connect-timeout 10 "$PR_HREF" \| jq 'if type == "array" and length > 0 then .[0].commit.message else "" end')echo "first_commit_message_in_pr<<EOF" >> $GITHUB_ENVecho "$first_commit_message_in_pr" >> $GITHUB_ENVdiff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.ymlindex 354226322bfc..a7116f16c066 100644--- a/.github/workflows/release-cli.yml+++ b/.github/workflows/release-cli.yml@@ -317,6 +317,7 @@ jobs:run: |installer="$RUNNER_TEMP/cargo-dist-installer.sh"curl --proto '=https' --tlsv1.2 -LsSf \+ --retry 5 --retry-all-errors --retry-max-time 60 --connect-timeout 10 \"https://github.com/axodotdev/cargo-dist/releases/download/v${CARGO_DIST_VERSION}/cargo-dist-installer.sh" \-o "$installer"if command -v sha256sum >/dev/null 2>&1; then@@ -407,6 +408,7 @@ jobs:run: |installer="$RUNNER_TEMP/cargo-dist-installer.sh"curl --proto '=https' --tlsv1.2 -LsSf \+ --retry 5 --retry-all-errors --retry-max-time 60 --connect-timeout 10 \"https://github.com/axodotdev/cargo-dist/releases/download/v${CARGO_DIST_VERSION}/cargo-dist-installer.sh" \-o "$installer"if command -v sha256sum >/dev/null 2>&1; thendiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex d659757a3f75..32e2ccd152c8 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -44,6 +44,7 @@ jobs:run: |installer="$RUNNER_TEMP/cargo-dist-installer.sh"curl --proto '=https' --tlsv1.2 -LsSf \+ --retry 5 --retry-all-errors --retry-max-time 60 --connect-timeout 10 \"https://github.com/axodotdev/cargo-dist/releases/download/v${CARGO_DIST_VERSION}/cargo-dist-installer.sh" \-o "$installer"if command -v sha256sum >/dev/null 2>&1; then@@ -131,6 +132,7 @@ jobs:run: |installer="$RUNNER_TEMP/cargo-dist-installer.sh"curl --proto '=https' --tlsv1.2 -LsSf \+ --retry 5 --retry-all-errors --retry-max-time 60 --connect-timeout 10 \"https://github.com/axodotdev/cargo-dist/releases/download/v${CARGO_DIST_VERSION}/cargo-dist-installer.sh" \-o "$installer"if command -v sha256sum >/dev/null 2>&1; then