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): revert Trunk pause docs and gate desktop Trunk uploads (#76456)

Georges-Antoine Assid9e416841117
diff --git a/.github/workflows/desktop-test.yml b/.github/workflows/desktop-test.yml
index 025572e1f411..e0fcf08496db 100644
--- a/.github/workflows/desktop-test.yml
+++ b/.github/workflows/desktop-test.yml
@@ -25,6 +25,9 @@ concurrency:
group: desktop-test-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+env:
+ RUNS_ON_INTERNAL_PR: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
+
jobs:
changes:
runs-on: ubuntu-latest
@@ -127,13 +130,23 @@ jobs:
run: node scripts/rebuild-better-sqlite3-node.mjs
- name: Run tests
+ id: run-tests
+ # continue-on-error so the quarantine gate below is the verdict — it passes when
+ # every failure is an already-quarantined flake, fails otherwise.
+ continue-on-error: true
run: pnpm test
- - name: Upload test results to Trunk
- # Run even when tests fail so flaky/failed results are still reported,
- # but never let an upload problem fail the job.
- if: ${{ !cancelled() }}
+ # Best-effort Trunk upload (continue-on-error); the "Fail on test failure" step below is
+ # the verdict, so a Trunk outage can't red a passing job. Internal PRs only (needs the
+ # secret); cli-version pinned, not 'latest' (skips the release redirect).
+ # TRUNK_UPLOAD_ENABLED is the master kill-switch: when it is not 'true' this gate
+ # skips, so nothing uploads and no known flakes are quarantined. TRUNK_QUARANTINE_ENABLED
+ # splits the two — it defaults off, so set it to 'true' to let the verdict step below mask
+ # known flakes; otherwise any real failure reds the job (quarantining needs upload on too).
+ - name: Quarantine gate
+ id: quarantine_gate
continue-on-error: true
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
# Scope to each package root. A bare **/junit.xml glob descends into
@@ -141,8 +154,18 @@ jobs:
# every report many times over.
junit-paths: 'products/desktop/apps/*/junit.xml,products/desktop/packages/*/junit.xml'
org-slug: posthog-inc
+ cli-version: '0.13.7'
+ quarantine: true
+ previous-step-outcome: ${{ steps.run-tests.outcome }}
token: ${{ secrets.TRUNK_API_TOKEN }}
+ # Verdict: red a real failure the gate didn't clear as a quarantined flake. != 'success'
+ # also covers the skipped gate on fork/Dependabot.
+ - name: Fail on test failure
+ if: ${{ !cancelled() && steps.run-tests.outcome == 'failure' && (vars.TRUNK_QUARANTINE_ENABLED != 'true' || steps.quarantine_gate.outcome != 'success') }}
+ shell: bash
+ run: exit 1
+
integration-test:
needs: changes
# Fail closed: if change detection itself failed, run instead of skipping.
@@ -221,24 +244,39 @@ jobs:
run: pnpm --filter code exec playwright install --with-deps chromium
- name: Run E2E smoke tests
+ id: run-e2e
+ # continue-on-error so the quarantine gate below is the verdict — it passes when
+ # every failure is an already-quarantined flake, fails otherwise.
+ continue-on-error: true
run: pnpm --filter code run test:e2e
env:
CI: true
- - name: Upload test results to Trunk
- # Run even when E2E tests fail so flaky/failed results are still
- # reported, but never let an upload problem fail the job.
- if: ${{ !cancelled() }}
+ # Best-effort Trunk upload (continue-on-error); the "Fail on E2E failure" step below is
+ # the verdict, so a Trunk outage can't red a passing job. Internal PRs only (needs the
+ # secret); cli-version pinned, not 'latest' (skips the release redirect).
+ # TRUNK_UPLOAD_ENABLED is the master kill-switch: when it is not 'true' this gate
+ # skips, so nothing uploads and no known flakes are quarantined. TRUNK_QUARANTINE_ENABLED
+ # splits the two — it defaults off, so set it to 'true' to let the verdict step below mask
+ # known flakes; otherwise any real failure reds the job (quarantining needs upload on too).
+ - name: Quarantine gate
+ id: quarantine_gate
continue-on-error: true
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
junit-paths: 'products/desktop/apps/code/tests/e2e/junit.xml'
org-slug: posthog-inc
+ cli-version: '0.13.7'
+ quarantine: true
+ previous-step-outcome: ${{ steps.run-e2e.outcome }}
token: ${{ secrets.TRUNK_API_TOKEN }}
- name: Upload Playwright report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- if: failure()
+ # Keys off the step outcome, not failure(): the test step is continue-on-error, so a
+ # failing suite no longer reds the job on its own and failure() would never fire here.
+ if: ${{ !cancelled() && steps.run-e2e.outcome == 'failure' }}
with:
name: playwright-report
path: products/desktop/apps/code/playwright-report/
@@ -248,28 +286,42 @@ jobs:
# no Electron packaging. Reuses the cached Chromium above. Runs even if the
# desktop suite failed so both hosts report independently.
- name: Run web E2E smoke tests
+ id: run-web-e2e
if: ${{ !cancelled() }}
+ continue-on-error: true
run: pnpm run test:e2e:web
env:
CI: true
- - name: Upload web test results to Trunk
- if: ${{ !cancelled() }}
+ - name: Quarantine gate (web)
+ id: quarantine_gate_web
continue-on-error: true
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
junit-paths: 'products/desktop/apps/web/tests/e2e/junit.xml'
org-slug: posthog-inc
+ cli-version: '0.13.7'
+ quarantine: true
+ previous-step-outcome: ${{ steps.run-web-e2e.outcome }}
token: ${{ secrets.TRUNK_API_TOKEN }}
- name: Upload web Playwright report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- if: failure()
+ if: ${{ !cancelled() && steps.run-web-e2e.outcome == 'failure' }}
with:
name: web-playwright-report
path: products/desktop/apps/web/playwright-report/
retention-days: 7
+ # Verdict: red a real failure neither gate cleared as a quarantined flake. != 'success'
+ # also covers a skipped gate on fork/Dependabot. Both hosts report independently, so
+ # either one failing is enough to red the job.
+ - name: Fail on E2E failure
+ if: ${{ !cancelled() && ((steps.run-e2e.outcome == 'failure' && (vars.TRUNK_QUARANTINE_ENABLED != 'true' || steps.quarantine_gate.outcome != 'success')) || (steps.run-web-e2e.outcome == 'failure' && (vars.TRUNK_QUARANTINE_ENABLED != 'true' || steps.quarantine_gate_web.outcome != 'success'))) }}
+ shell: bash
+ run: exit 1
+
e2e:
# Live-model e2e for the @posthog/agent adapters (claude + codex). Runs only
# after the unit + integration jobs pass — a red tree never reaches the
diff --git a/AGENTS.md b/AGENTS.md
index 065ab73f5164..091620cd0f78 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -98,7 +98,7 @@ Guarding it inside the workflow is worse: skipping the gate job cascades to the
#### Stacked PRs
Restacking force-pushes every branch, and each push triggers a full CI fan-out.
-If the Trunk merge queue is re-enabled (it is paused, see below), never restack while any branch in the stack is sitting in it: the force-push removes the PR from the queue.
+Never restack while any branch in the stack is sitting in the merge queue — the force-push removes it from the queue.
Pushing a deep stack at once can exceed GitHub's per-repo dispatch cap (500 workflow runs / 10s).
The overflow fails as `startup_failure` and takes unrelated runs in the same window down too.
Draft status doesn't help, since runs are dispatched before draft/skip logic applies.
@@ -115,15 +115,14 @@ In environments without hooks (no `node_modules`), run `hogli ci:preflight --fix
### Merging PRs
-Merges into `master` currently go through `gh pr merge <number> --squash`.
-Squash is the only merge method the repo allows, so `--merge` and `--rebase` are rejected.
+All merges into `master` go through the Trunk merge queue.
+Never run `gh pr merge` or click the GitHub merge button — both are blocked by branch ruleset.
-**The Trunk merge queue is paused.** Its ruleset is disabled, so `/trunk merge` and `/trunk cancel` comments and the `trunk-merge-queue-submit` label are no-ops: no `Trunk Merge Queue (master)` check run appears and the bot never replies. Don't reach for them.
-
-- Branch protection on `master` is unchanged and still enforced: an approving review, code owner review, the required status checks, and signed commits. `gh pr merge` refuses until all of those pass.
-- Shortly after a force-push or a label change, GitHub's mergeability cache can be stale and the first attempt fails with "the base branch policy prohibits the merge". Retrying a moment later works.
-- [`.agents/skills/merging-prs/SKILL.md`](./.agents/skills/merging-prs/SKILL.md) is still written for the Trunk flow, so it's stale pending a follow-up. Its preflight and CI failure-handling advice still applies; its enqueue and queue-watching steps don't.
-- If Trunk is re-enabled, the old flow was: enqueue with `gh pr comment <number> --body "/trunk merge"`, watch the `Trunk Merge Queue (master)` check run on the head commit rather than the PR's own checks, and never force-push while the PR sits in the queue.
+- Enqueue: `gh pr comment <number> --body "/trunk merge"`. Cancel: `gh pr comment <number> --body "/trunk cancel"`.
+- After enqueueing, babysit the PR until it merges or fails — follow [`.agents/skills/merging-prs/SKILL.md`](./.agents/skills/merging-prs/SKILL.md) for the preflight, watch, and failure-handling loop.
+- Queue progress is the `Trunk Merge Queue (master)` check run on the PR's head commit. The PR's own checks don't reflect the queue's testing — it runs CI on a `trunk-merge/**` branch.
+- On failure the Trunk bot comments with links to the failing workflows; fix, push, and re-enqueue.
+- Never force-push a branch while it is in the queue — it removes the PR from the queue.
### Public open source repo guidance
@@ -234,7 +233,7 @@ ALWAYS invoke the matching skill **before** writing or reviewing code in these a
**Invoke when in the area:**
-- `/merging-prs` — merging a PR, or babysitting one through CI (written for the Trunk queue, so partly stale while it's paused)
+- `/merging-prs` — merging a PR, or babysitting one through the Trunk merge queue
- `/implementing-mcp-tools` — adding/modifying endpoints or `tools.yaml`
- `/modifying-taxonomic-filter` — any TaxonomicFilter change
- `/sending-notifications` — adding notification support