From c93f366965bdfad5f25988e2dfc5a4df61de6c38 Mon Sep 17 00:00:00 2001 From: Khaliq Date: Wed, 7 Oct 2026 18:50:07 -0700 Subject: [PATCH 1/3] ci(router): deploy the router only after this commit's web deploy succeeds The router rewrites public paths onto web pages (arelay.to/ -> /u/). When #150 merged, Deploy Router finished first and arelay.to/agent-relay returned 404 for ~10 minutes until Deploy Web caught up. The router job now waits (up to 40 min) for Deploy Web (Cloudflare) on the same commit and refuses to deploy if it failed. Manual dispatch is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/deploy-router.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/deploy-router.yml b/.github/workflows/deploy-router.yml index aee37cf2..b557a3c5 100644 --- a/.github/workflows/deploy-router.yml +++ b/.github/workflows/deploy-router.yml @@ -15,12 +15,37 @@ concurrency: permissions: contents: read + # Read the web deploy's run for this commit (see "Wait for the web deploy"). + actions: read jobs: deploy-router: name: Deploy router runs-on: ubuntu-latest steps: + # The router rewrites public paths onto web pages (arelay.to/ -> + # /u/), so a router that ships before the web deploy of the same + # commit routes to pages that don't exist yet. That took + # arelay.to/agent-relay down for ~10 minutes when #150 merged. Wait for + # this commit's web deploy and refuse to ship if it failed. + - name: Wait for the web deploy of this commit + if: github.event_name == 'push' + env: + GH_TOKEN: ${{ github.token }} + run: | + for _ in $(seq 1 80); do + state=$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/deploy.yml/runs?head_sha=${GITHUB_SHA}&event=push&per_page=1" \ + --jq '.workflow_runs[0] | if . == null then "missing" else "\(.status) \(.conclusion // "")" end') + echo "web deploy for ${GITHUB_SHA::9}: ${state}" + case "$state" in + "completed success") exit 0 ;; + completed*) echo "::error::Deploy Web (Cloudflare) did not succeed for this commit; not deploying the router."; exit 1 ;; + esac + sleep 30 + done + echo "::error::Timed out after 40 minutes waiting for Deploy Web (Cloudflare) for this commit." + exit 1 + - name: Checkout code uses: actions/checkout@v4 From 0f7065b01d87953d333cef7b9e60765191ff59ef Mon Sep 17 00:00:00 2001 From: Khaliq Date: Wed, 7 Oct 2026 18:54:41 -0700 Subject: [PATCH 2/3] ci(router): wait up to 2h for the web deploy and say how to recover Web deploys queue in their own concurrency group, so a 40-minute wait could expire behind a backlog and drop the router release. On timeout the error now says to re-run the workflow. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/deploy-router.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-router.yml b/.github/workflows/deploy-router.yml index b557a3c5..4e1b1f44 100644 --- a/.github/workflows/deploy-router.yml +++ b/.github/workflows/deploy-router.yml @@ -33,7 +33,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - for _ in $(seq 1 80); do + for _ in $(seq 1 240); do state=$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/deploy.yml/runs?head_sha=${GITHUB_SHA}&event=push&per_page=1" \ --jq '.workflow_runs[0] | if . == null then "missing" else "\(.status) \(.conclusion // "")" end') echo "web deploy for ${GITHUB_SHA::9}: ${state}" @@ -43,7 +43,7 @@ jobs: esac sleep 30 done - echo "::error::Timed out after 40 minutes waiting for Deploy Web (Cloudflare) for this commit." + echo "::error::Timed out after 2 hours waiting for Deploy Web (Cloudflare) for this commit. Re-run this workflow once it finishes." exit 1 - name: Checkout code From 6ec26c01c5913cdc41aa30e2df3b368d82f2b5ab Mon Sep 17 00:00:00 2001 From: Khaliq Date: Wed, 7 Oct 2026 19:04:23 -0700 Subject: [PATCH 3/3] ci(router): retry the web-deploy lookup on transient API errors Under bash -eo pipefail a non-2xx from gh api (5xx, rate limit) aborted the wait; treat it as not ready yet and poll again. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/deploy-router.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-router.yml b/.github/workflows/deploy-router.yml index 4e1b1f44..56c23647 100644 --- a/.github/workflows/deploy-router.yml +++ b/.github/workflows/deploy-router.yml @@ -35,7 +35,8 @@ jobs: run: | for _ in $(seq 1 240); do state=$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/deploy.yml/runs?head_sha=${GITHUB_SHA}&event=push&per_page=1" \ - --jq '.workflow_runs[0] | if . == null then "missing" else "\(.status) \(.conclusion // "")" end') + --jq '.workflow_runs[0] | if . == null then "missing" else "\(.status) \(.conclusion // "")" end' \ + || echo "lookup failed (will retry)") echo "web deploy for ${GITHUB_SHA::9}: ${state}" case "$state" in "completed success") exit 0 ;;