: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(ci): note that cancelled runs block merge (#106616)
Raúl Negrón-Otero446ea3319d14
diff --git a/.agents/skills/depot-ci/references/posthog-check-run-semantics.md b/.agents/skills/depot-ci/references/posthog-check-run-semantics.mdindex 123d6b318409..1bbf30ba647e 100644--- a/.agents/skills/depot-ci/references/posthog-check-run-semantics.md+++ b/.agents/skills/depot-ci/references/posthog-check-run-semantics.md@@ -75,6 +75,8 @@ In the following cancelled runs, an unstarted job received a `cancelled` check wCheck times and `pull_requests` did not pick out the Depot run in these cases, so the event goes into a check name. The Depot wait job's name ends with `(PR <number>, event <pull_request.updated_at>)`, and Depot renders expressions in job names into the check name. `.github/scripts/ci_backend_relay.py` builds the same name from the GitHub run's payload, reads that check, takes the Depot workflow id from its `details_url`, and reads the gate or migration check of that workflow only. Measured 2026-09-24 on PR 105886: Depot posted check `107656013423` named `… (PR 105886, event 2026-09-24T13:33:14Z)`, and GitHub relay job `107655803961` used `EVENT_AT: 2026-09-24T13:33:14Z` and relayed a successful gate.+The newest check per name tells you the verdict. It does not tell you whether the PR can merge. A cancelled run on the same head keeps its checks, and when one of them is a required check, GitHub's merge box and Trunk keep the PR blocked until that run is rerun. `/merging-prs` has the recipe.+## Depot CI CLI recipesThe CLI needs ids that the GitHub API does not carry. Start from a check run's `details_url`, which encodes the workflow id and job id.diff --git a/.agents/skills/merging-prs/SKILL.md b/.agents/skills/merging-prs/SKILL.mdindex da24269fc67e..d534633ca72b 100644--- a/.agents/skills/merging-prs/SKILL.md+++ b/.agents/skills/merging-prs/SKILL.md@@ -34,7 +34,23 @@ gh pr view <n> --json state,isDraft,mergeable,reviewDecision,statusCheckRollup,b- **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.+- **Cancelled runs on the head** → check for these before the failing-checks stop below, because a cancelled run also turns `statusCheckRollup` to `FAILURE`. A push can start two runs of a workflow for one head, and the concurrency group cancels one. GitHub keeps both runs' checks, and a newer green check with the same name does not clear them. A cancelled run that carries a required check (a workflow's `... Tests Pass` gate, or the org-level `semgrep` workflow) keeps the merge box blocked and Trunk at "Not ready". Rerun every cancelled run rather than working out which ones carry one. Reruns need the developer's permission.++ ```bash+ # GitHub Actions. `gh run rerun` returns 404 for the org-level semgrep workflow; the API call works for every run.+ gh api "repos/$REPO/actions/runs?head_sha=<head-sha>&per_page=100" --paginate \+ --jq '.workflow_runs[] | select(.conclusion == "cancelled")+ | select((.pull_requests | length) == 0 or any(.pull_requests[]; .number == <n>))+ | "\(.id)\t\(.name)"'+ gh api -X POST "repos/$REPO/actions/runs/<run-id>/rerun"++ # Depot CI. A run with more than one workflow also needs --workflow <workflow-id>, listed by `depot ci status <run-id>`.+ depot ci run list --repo "$REPO" --sha <head-sha> --status cancelled+ depot ci rerun <run-id>+ ```+- **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) → ask stamphog for a review. Stamphog is 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. Use the MCP route first, and the label only when MCP is not available.