From 2929a3175d263149eae6c66ae9c6fe559389cc69 Mon Sep 17 00:00:00 2001 From: Dan Barr <6922515+danbarr@users.noreply.github.com> Date: Tue, 17 Nov 2026 14:19:18 -0500 Subject: [PATCH 1/2] Authenticate thv release lookup and surface errors Anonymous GitHub API calls share a 60/hour per-IP limit that CI runners exhaust, which failed the visual regression job intermittently. Send GITHUB_TOKEN when it's set. The fetch error was also invisible: curl -s hid the HTTP status, and the fallback message was captured by the command substitution instead of reaching the log. Co-Authored-By: Claude Opus 5.5 --- scripts/install-thv.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/install-thv.sh b/scripts/install-thv.sh index ed06451c8..2f70f8a6c 100755 --- a/scripts/install-thv.sh +++ b/scripts/install-thv.sh @@ -19,11 +19,18 @@ else API_ENDPOINT="https://api.github.com/repos/stacklok/toolhive/releases/latest" fi +# Authenticate when a token is available; anonymous API calls share a low +# per-IP rate limit that CI runners regularly exhaust. +CURL_AUTH=() +if [[ -n "${GITHUB_TOKEN:-}" ]]; then + CURL_AUTH=(-H "Authorization: Bearer $GITHUB_TOKEN") +fi + # Fetch release information -RELEASE_JSON=$(curl -sf "$API_ENDPOINT" || { - echo "Failed to fetch release information from GitHub API" +if ! RELEASE_JSON=$(curl -fsS ${CURL_AUTH[@]+"${CURL_AUTH[@]}"} "$API_ENDPOINT"); then + echo "Failed to fetch release information from $API_ENDPOINT" >&2 exit 1 -}) +fi # Print the download URL of the named release asset, or nothing if absent. asset_url() { From a96031824c91daf9a3b3753ef027f1679eff5e46 Mon Sep 17 00:00:00 2001 From: Dan Barr <6922515+danbarr@users.noreply.github.com> Date: Tue, 17 Nov 2026 14:19:18 -0500 Subject: [PATCH 2/2] Track synced ToolHive version in visual tests Read the CLI version from the toolhive entry in .github/upstream-projects.yaml instead of a hardcoded 0.49.0 pin, so it moves with release sync PRs. Pass the job token to the install step to avoid API rate limits. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/_visual-regression.yaml | 19 +++++++++++++----- .../workflows/update-visual-baselines.yaml | 20 +++++++++++++------ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/_visual-regression.yaml b/.github/workflows/_visual-regression.yaml index a0b41cb54..a7d3e2d27 100644 --- a/.github/workflows/_visual-regression.yaml +++ b/.github/workflows/_visual-regression.yaml @@ -21,10 +21,6 @@ jobs: container: image: mcr.microsoft.com/playwright:v1.65.0-noble@sha256:6e3fb709361521eb27161606e6da6d2674e5e89fa16516cb37d6fdd91372273d # v1.63.0-noble options: --ipc=host - env: - # Keep the build-time MCP metadata format stable. The regular site - # build still validates the current ToolHive release independently. - TOOLHIVE_VERSION: '0.49.0' steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -72,7 +68,20 @@ jobs: - name: Install ToolHive CLI env: TOOLHIVE_VERIFY_SIGNATURE: 'true' - run: ./scripts/install-thv.sh + GITHUB_TOKEN: ${{ github.token }} + # Use the ToolHive release the docs are synced to, so the version + # moves with release sync PRs instead of drifting. + run: | + TOOLHIVE_VERSION="$(node -e ' + const fs = require("fs"); + const { parse } = require("yaml"); + const config = parse(fs.readFileSync(".github/upstream-projects.yaml", "utf8")); + const version = config.projects.find((p) => p.id === "toolhive")?.version; + if (!version) throw new Error("No toolhive version in upstream-projects.yaml"); + console.log(version); + ')" + export TOOLHIVE_VERSION + ./scripts/install-thv.sh # SWC's native loader rejects the writable parents of /github/home. # Use a private cache under /tmp, whose sticky bit protects its children. diff --git a/.github/workflows/update-visual-baselines.yaml b/.github/workflows/update-visual-baselines.yaml index 6bac60be9..20f603a17 100644 --- a/.github/workflows/update-visual-baselines.yaml +++ b/.github/workflows/update-visual-baselines.yaml @@ -17,11 +17,6 @@ concurrency: permissions: contents: read -env: - # Must match _visual-regression.yaml so baseline generation and comparison - # use the same build-time MCP metadata format. - TOOLHIVE_VERSION: '0.49.0' - jobs: authorize: name: Authorize the request @@ -108,7 +103,20 @@ jobs: - name: Install ToolHive CLI env: TOOLHIVE_VERIFY_SIGNATURE: 'true' - run: ./scripts/install-thv.sh + GITHUB_TOKEN: ${{ github.token }} + # Use the ToolHive release the docs are synced to, so the version + # moves with release sync PRs instead of drifting. + run: | + TOOLHIVE_VERSION="$(node -e ' + const fs = require("fs"); + const { parse } = require("yaml"); + const config = parse(fs.readFileSync(".github/upstream-projects.yaml", "utf8")); + const version = config.projects.find((p) => p.id === "toolhive")?.version; + if (!version) throw new Error("No toolhive version in upstream-projects.yaml"); + console.log(version); + ')" + export TOOLHIVE_VERSION + ./scripts/install-thv.sh # SWC's native loader rejects the writable parents of /github/home. # Use a private cache under /tmp, whose sticky bit protects its children.