PostHog / PostHog/posthog

Docs preview builds cancel each other because every PR deploys the same Vercel git ref

Open
#84,366 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug team-devex
Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
6h 51m
Merged PRs (30d)
232

Description

Problem

A docs preview link posted on a PR often serves "Deployment was cancelled" instead of the page. The reviewer cannot see the docs change before merge, and nothing on the PR shows that the preview died.

Cause

.github/scripts/trigger-vercel-preview.sh creates every deployment against the same git ref:

"gitSource": {
  "type": "github",
  "repoId": "260550412",
  "ref": "master"
}

The PR's own branch is passed only as a build env var, GATSBY_POSTHOG_BRANCH. Vercel auto-cancels superseded deployments for a given ref, so a docs preview triggered by any PR cancels the in-flight previews of every other PR.

Evidence

Eight docs-preview runs outside trunk-merge/** fired in about 80 minutes on 2026-08-18, each triggering a deployment of that one ref, against a build the CI report says takes about 10 minutes:

11:39:08  pawel/billing-mcp-api-groundwork
11:39:09  pawel/billing-mcp-api-groundwork
11:45:00  posthog/retire-historical-migration-tests
12:02:00  posthog/apply-test-account-filter-to-existing-insights
12:16:43  managed-warehouse-dynamic-auth
12:17:11  posthog/apply-test-account-filter-to-existing-insights
12:29:37  posthog/apply-test-account-filter-to-existing-insights
12:58:31  posthog/workflows-slack-message-trigger

All three previews triggered for #83116 served <title>Deployment was cancelled</title>. The runs on trunk-merge/** branches were correctly skipped by the workflow's guard, so they were not involved.

Why this goes unnoticed

  • Vercel serves the cancelled page with HTTP 200, so checking the status code looks healthy.
  • The workflow step reports success, because the trigger succeeded rather than the build.
  • The CI report section says "preview build triggered" and never reports the outcome.

Possible fixes

  • Turn off stale-build auto-cancellation for the posthog.com Vercel project.
  • Give each PR's deployment its own identity, so previews stop sharing one ref.
  • Report the deployment's final state back into the CI report, so a cancelled preview is visible on the PR.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with .github/scripts/trigger-vercel-preview.sh and the docs-preview workflow that invokes it; inspect how the PR branch and git ref reach the deployment request. Reproduce the cancellation behavior with concurrent preview runs, then verify that previews no longer cancel one another and that the CI report exposes a cancelled deployment.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github-actions, shell
Domain
ci-cd, cloud, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.