Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(ci): document the fork PR policy for depot (#96919)

Raúl Negrón-Otero790d1c59665b
diff --git a/.agents/skills/authoring-ci-workflows/SKILL.md b/.agents/skills/authoring-ci-workflows/SKILL.md
index 35ccf42c9462..d0d4471cd417 100644
--- a/.agents/skills/authoring-ci-workflows/SKILL.md
+++ b/.agents/skills/authoring-ci-workflows/SKILL.md
@@ -338,6 +338,7 @@ Make those runs pass, and never let untrusted code reach a secret.
- Comment or label only on same-repo PRs — the fork token can't write.
- To act on a fork PR with secrets/write (reviewer or label bots), use `pull_request_target`: base-repo permissions, but it must **never check out and run fork code**. That's why those workflows can't fold into a `pull_request` parent.
- First-time contributors need maintainer approval before workflows run (`action_required`) — expected.
+- Depot CI runs no fork PR at all, so the backend router keeps fork PRs on GitHub Actions and the required check stays on the head. Never re-push a fork's head in-repo to get it a Depot run. See [Pull requests from forks](../../../docs/published/handbook/engineering/fork-pull-requests.md).
## Timeouts
diff --git a/.agents/skills/depot-ci/references/posthog-check-run-semantics.md b/.agents/skills/depot-ci/references/posthog-check-run-semantics.md
index 52e43efb5cfa..f1b4d82505b3 100644
--- a/.agents/skills/depot-ci/references/posthog-check-run-semantics.md
+++ b/.agents/skills/depot-ci/references/posthog-check-run-semantics.md
@@ -88,7 +88,7 @@ Depot CI checks out the pull request merge ref (`refs/pull/<n>/merge`) and posts
From Depot's [compatibility page](https://depot.dev/docs/ci/compatibility), not measured here:
-- Fork pull requests are unsupported. Depot lists support as planned.
+- Fork pull requests get no run; Depot lists support as planned. The backend router keeps them on GitHub Actions, see [Pull requests from forks](../../../../docs/published/handbook/engineering/fork-pull-requests.md).
- `environment:` is unsupported, and `uses:` cannot reference a workflow in another repository.
- `secrets.GITHUB_TOKEN` is a GitHub App installation token, not the Actions token. GitHub Packages rejects it. The rate limit it draws on is the app installation's pool, which is shared across repos and is not the per-repo Actions bucket that `monitor-github-rate-limit.yml` watches.
- Non-Depot `runs-on` labels are treated as `depot-ubuntu-latest`.
diff --git a/.agents/skills/merging-prs/SKILL.md b/.agents/skills/merging-prs/SKILL.md
index 895ddc36b780..bb7871b18fbf 100644
--- a/.agents/skills/merging-prs/SKILL.md
+++ b/.agents/skills/merging-prs/SKILL.md
@@ -28,13 +28,14 @@ Resolve the repo slug once if you need it: `REPO=$(gh repo view --json nameWithO
## 1. Preflight
```bash
-gh pr view <n> --json state,isDraft,mergeable,reviewDecision,statusCheckRollup,baseRefName
+gh pr view <n> --json state,isDraft,mergeable,reviewDecision,statusCheckRollup,baseRefName,isCrossRepository
```
- **Not open** (already merged/closed) → report and stop.
- **Draft** → it can't be merged. Ask the developer to confirm, then `gh pr ready <n>` before continuing. Don't un-draft silently.
- **Failing required checks** (`statusCheckRollup`) → the queue will just reject it. Report which checks are red and stop; fix them first. **Pending** checks are fine — the queue waits for them. To work out _why_ a check is red, use `/debugging-ci-failures`.
- **Merge conflicts** (`mergeable == "CONFLICTING"`) → report and stop; merge `master` in first.
+- **Head is on a fork** (`isCrossRepository == true`) → backend CI ran on GitHub Actions, so the required check is on the head as usual. Depot's optional checks are absent; that is expected and needs no action.
- **Missing approval** (`reviewDecision == "REVIEW_REQUIRED"`, or a stamphog approval was dismissed) → apply the `stamphog` label yourself: `gh pr edit <n> --add-label stamphog`. That triggers the automated review-and-approve flow ([the engine README](../../../products/stamphog/packages/pr-approval-agent/README.md)); on an `APPROVED` verdict the Stamphog app posts the approval that satisfies the required review. Re-applying the label is always safe and is the intended retry path — it gets stripped on a `REFUSED`/`ESCALATE` verdict, and after addressing that feedback you re-apply it to request a fresh review. Read the reason first: every verdict is its own review from the Stamphog app, opening with whether it approved. Re-applying the label without changing anything just repeats the same verdict. It stays sticky across ordinary pushes (non-trivial deltas re-review automatically), and it never works on bot-authored PRs.
- **Part of a stack** (`baseRefName != "master"`, or the PR appears in `gh api repos/$REPO/stacks`) → the queue handles stacks natively: enqueueing a PR enqueues it **and every unmerged layer below it**, tests them together, and merges them atomically. After explicit user approval, comment `/trunk merge` on the **top** PR to merge the whole stack, or on the highest layer you want landed to merge just the bottom part. Run this preflight on every layer being merged, not only the one you comment on. `/stacking-prs` covers restack mechanics and the post-merge `gh stack sync --prune`.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 45fee55ac89d..26120cd6cc52 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -18,6 +18,7 @@ We welcome contributions. A few quick notes so you know how we operate:
- The current week's [Support Hero](https://posthog.com/handbook/engineering/support-hero) for the owning team is usually the first point of contact, but customer support takes priority. Reviews can be delayed when support load is high.
- Expect acknowledgement when we have bandwidth; thorough reviews may come later. It's fine if this takes a few days to a couple of weeks depending on load.
- We sometimes close PRs that are out of scope, would add long-term maintenance burden, or go stale. You're always welcome to reopen with updates.
+- Fork pull requests run backend CI on GitHub Actions; Depot's optional checks do not appear on them. See [Pull requests from forks](docs/published/handbook/engineering/fork-pull-requests.md).
Before we do a full review, please:
diff --git a/docs/published/handbook/engineering/fork-pull-requests.md b/docs/published/handbook/engineering/fork-pull-requests.md
new file mode 100644
index 000000000000..3908472490cc
--- /dev/null
+++ b/docs/published/handbook/engineering/fork-pull-requests.md
@@ -0,0 +1,18 @@
+---
+title: Pull requests from forks
+sidebar: Handbook
+---
+
+Backend CI runs on one of two engines per pull request, decided by `.github/scripts/ci_backend_route.py`: GitHub Actions or Depot CI.
+Depot CI never runs a fork's code, so the router sends every fork pull request to GitHub Actions.
+The required `Django Tests Pass` check is a GitHub Actions job on every head, fork or not, and nothing about the merge queue changes for a fork.
+
+What a fork contributor sees:
+
+- Backend CI runs on GitHub Actions, as it always has, and selects the same tests it selects for any other pull request.
+- Depot's optional checks show as skipped. They are not required and nothing waits on them.
+- Steps that need a secret skip, on both engines. The same-repo `if:` guard that makes that safe is in the [CI authoring skill](https://github.com/PostHog/posthog/blob/master/.agents/skills/authoring-ci-workflows/SKILL.md).
+
+Never push a fork's head to a branch inside this repository to get it a Depot run.
+An in-repo branch is trusted: every secret-gated step runs, with the fork's code in control of the job.
+Review the fork PR as it is, and let the merge queue test it on its own branch.