Skip to content

deploy-preview gives up after 3 minutes, but Pages can take up to 10 minutes to serve a new preview #166

Open

Description

@mithro

Problem

The deploy-preview job in .github/workflows/pr-preview.yml ("Wait for Pages deployment and verify accessibility") polls the preview URL in two phases:

  • Phase 1: 18 attempts × 10 s = 3 minutes waiting for any successful HEAD response, then exit 1 with ERROR: No HTTP response after 3 minutes.
  • Phase 2: 24 attempts × 5 s = 2 minutes waiting for a 200 whose git-commit comment/meta tag matches the PR head.

GitHub Pages deployments of the shared preview.wafer.space repo regularly take longer than 3 minutes to become live, so Phase 1 fails on healthy deployments and the job has to be re-run by hand. Meanwhile the verify-preview job in preview-verification.yml already waits 10 minutes (120 × 5 s) for the same thing, so the two workflows disagree about how long a deployment is allowed to take.

Evidence

PR #165, run 40136141630:

  • 21:54:04 push to the preview repo (33452067..ba0e010b main -> main)
  • 21:54:14 attempt 1/18: HTTP/2 404, x-cache: MISS, age: 0
  • 21:54:25 onwards: every attempt HTTP/2 404, x-cache: HIT, age climbing by 10 s each poll (10, 20, 30 … 172)
  • 21:57:06 ERROR: No HTTP response after 3 minutes. → job failed
  • Re-run (gh run rerun --failed): pushed a new commit at 21:59:05 and attempt 1/18 at 21:59:15 already got a 200 with the right commit. The original deployment had gone live on its own in roughly 5 minutes; only the wait was too short.

Earlier cases of the same failure, each passing on a plain re-run: PRs #140 and #141 on 2026-10-20.

Cache interaction

The age / x-cache: HIT headers show the first poll's 404 being cached by the Pages CDN (Fastly) and served back for the rest of the wait. The step therefore cannot see the deployment going live until the cached 404 expires, which makes the effective wait even shorter than 3 minutes of real polling. The polls should send Cache-Control: no-cache (as the muffet step already does) or add a cache-busting query string, and treat a cached response (age > 0) as not yet conclusive.

Suggested fix

  • Raise the Phase 1 wait to match verify-preview: up to 10 minutes.
  • Make the polls cache-busting so a stale 404 can't mask a finished deployment.
  • Consider polling the Pages deployment status via the API (GET /repos/{owner}/{repo}/pages/deployments/{id} or the deployment_status of the preview repo) instead of guessing from HTTP, and only fall back to HTTP probing after it reports success.
  • Share one wait implementation between pr-preview.yml and preview-verification.yml so the two timeouts can't drift apart again.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UoqExd7xVbfgh9pxd5sjxo

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions