From c35b10dea954b58530ff684e1d6dd4405f1340f3 Mon Sep 17 00:00:00 2001 From: Chris Burns <29541485+ChrisJBurns@users.noreply.github.com> Date: Wed, 17 Jun 2026 16:21:53 +0100 Subject: [PATCH] fix(skill-build): use --host/--port for thv serve and correct health path The skill-build action started the ToolHive daemon with `thv serve --address`, a flag no released thv supports, so daemon startup failed with "unknown flag: --address" (closes #16). Upstream thv exposes `--host`/`--port` for `thv serve`. Two further latent bugs from upstream drift are fixed alongside it: - The readiness probe polled `/api/v1beta/health`, but the health route is mounted at top-level `/health`. The old path 404s, which would have timed out the 30s wait even after the flag fix. - `/health` returns 503 when no container runtime is present, and `curl -sf` fails on 503. Skill build/push only package OCI artifacts and do not need a container runtime, so readiness now treats any HTTP response (including 503) as "daemon up". This also unblocks runners without Docker (relates to #3). Adds a daily scheduled CI run so future breakage from upstream ToolHive "latest" releases is caught proactively rather than at the next push. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/test.yml | 4 ++++ skill-build/action.yml | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6da9797..e455b9a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,10 @@ on: pull_request: branches: [ main ] workflow_dispatch: + # Run daily so breakage from upstream ToolHive "latest" releases (e.g. renamed + # CLI flags or moved API routes) is caught proactively rather than at next push. + schedule: + - cron: '0 6 * * *' jobs: test-install-action: diff --git a/skill-build/action.yml b/skill-build/action.yml index 32daaef..2f89194 100644 --- a/skill-build/action.yml +++ b/skill-build/action.yml @@ -50,9 +50,12 @@ runs: id: daemon shell: bash run: | - # Check if a daemon is already reachable (e.g., started by run-mcp-server) + # Check if a daemon is already reachable (e.g., started by run-mcp-server). + # Any HTTP response (even 503 when no container runtime is present) means the + # API server is up. Skill build/push package OCI artifacts and do not require + # a container runtime, so we must not gate readiness on the runtime's health. EXISTING_URL="${TOOLHIVE_API_URL:-http://127.0.0.1:8080}" - if curl -sf "${EXISTING_URL}/api/v1beta/health" > /dev/null 2>&1; then + if [ "$(curl -s -o /dev/null -w '%{http_code}' "${EXISTING_URL}/health" 2>/dev/null)" != "000" ]; then echo "ToolHive daemon already running at $EXISTING_URL" PORT=$(echo "$EXISTING_URL" | sed -E 's|.*://[^:]+:([0-9]+).*|\1|') echo "port=$PORT" >> $GITHUB_OUTPUT @@ -67,7 +70,7 @@ runs: } echo "Starting thv serve on port $PORT..." - thv serve --address "127.0.0.1:${PORT}" & + thv serve --host "127.0.0.1" --port "${PORT}" & DAEMON_PID=$! echo "pid=$DAEMON_PID" >> $GITHUB_OUTPUT echo "port=$PORT" >> $GITHUB_OUTPUT @@ -82,7 +85,7 @@ runs: wait "$DAEMON_PID" 2>/dev/null exit 1 fi - if curl -sf "http://127.0.0.1:${PORT}/api/v1beta/health" > /dev/null 2>&1; then + if [ "$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:${PORT}/health" 2>/dev/null)" != "000" ]; then echo "ToolHive daemon is ready (port $PORT)" break fi