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.

feat(review-hog): allow labeled reviews on bot-authored prs (#71308)

Alex Lebedev54f5ca8d4c68
diff --git a/.github/workflows/review-hog.yml b/.github/workflows/review-hog.yml
index b48c4b611d9a..57a7dbdf3a4b 100644
--- a/.github/workflows/review-hog.yml
+++ b/.github/workflows/review-hog.yml
@@ -1,16 +1,16 @@
# ReviewHog label trigger.
#
-# When a maintainer adds the `reviewhog` label to a non-fork PR (drafts included), this makes ONE
-# authenticated call to the PostHog `review_hog` trigger endpoint, which starts the review Temporal
-# workflow server-side and publishes the review back to the PR. One label add = one review: pushes
-# and ready-for-review deliberately do NOT re-trigger — re-reviewing is an explicit gesture (remove
-# and re-add the label), so a labeled PR can keep evolving without burning a review per event.
+# When a maintainer adds the `reviewhog` label to a non-fork PR (any author, drafts included), this
+# makes ONE authenticated call to the PostHog `review_hog` trigger endpoint, which starts the review
+# Temporal workflow server-side and publishes the review back to the PR. One label add = one review:
+# pushes and ready-for-review deliberately do NOT re-trigger — re-reviewing is an explicit gesture
+# (remove and re-add the label), so a labeled PR can keep evolving without burning a review per event.
# Unlike Stamphog, the agent does NOT run in CI: there is no checkout, no app token, no Anthropic key
# here — the only secret is the shared trigger token. Publishing happens server-side via the PostHog
# GitHub App installation token.
#
# Safety: `pull_request` (not `pull_request_target`) means fork PRs receive no secrets, so they cannot
-# trigger; the `if:` also hard-gates forks and bots; and applying the label needs write access.
+# trigger; the `if:` also hard-gates forks; and applying the label needs write access.
name: ReviewHog
on:
@@ -30,12 +30,11 @@ jobs:
name: Trigger ReviewHog review
runs-on: ubuntu-latest
timeout-minutes: 5
- # Run only for the `reviewhog` label on a non-fork, human-authored PR (drafts included).
+ # Run only when a human applies the `reviewhog` label to a non-fork PR — any author (drafts
+ # and bots included), but the labeler must be a person: the label is the explicit human request.
if: >-
github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
- && github.event.pull_request.user.type != 'Bot'
- && !contains(github.event.pull_request.user.login, '[bot]')
- && github.event.pull_request.user.login != 'posthog-bot'
+ && github.event.sender.type != 'Bot'
&& github.event.label.name == 'reviewhog'
steps:
- name: Trigger ReviewHog review
diff --git a/products/review_hog/ARCHITECTURE.md b/products/review_hog/ARCHITECTURE.md
index 2e85ed9a760f..e516ee27cc7d 100644
--- a/products/review_hog/ARCHITECTURE.md
+++ b/products/review_hog/ARCHITECTURE.md
@@ -2092,7 +2092,7 @@ pipeline just built + hardened).
```text
reviewhog label on a non-fork PostHog/posthog PR
- └─ .github/workflows/review-hog.yml (gates: label==reviewhog, head.repo==base.repo, non-bot, concurrency; drafts allowed)
+ └─ .github/workflows/review-hog.yml (gates: label==reviewhog by a human, head.repo==base.repo, concurrency; any author)
└─ one authenticated curl → POST /api/review_hog/trigger {repo, pr_number} (Authorization: Bearer <secret>)
└─ endpoint: verify shared secret · validate repo allowlist (forks blocked upstream by the Action
+ downstream by the fetch activity) · resolve team-2 integration + run user
@@ -2158,8 +2158,9 @@ github-actions[bot] trick), and its Action carries **one** secret (no Anthropic
authoritative in the **fetch activity** (`PRMetadata.is_fork`, non-retryable `ApplicationError` before the report
row is created).
4. ✅ **The Action:** `.github/workflows/review-hog.yml` — `on: pull_request [labeled]`,
- `permissions: {}`, per-PR concurrency, `if:` gates (label + non-fork + non-bot; drafts allowed), one `curl` with the
- bearer secret. `pull_request` (not `pull_request_target`) ⇒ forks get no secret ⇒ can't trigger.
+ `permissions: {}`, per-PR concurrency, `if:` gates (human-applied label + non-fork; any author — unmapped authors
+ resolve via the acting-user fallback), one `curl` with the bearer secret. `pull_request` (not
+ `pull_request_target`) ⇒ forks get no secret ⇒ can't trigger.
**2026-07-14 update:** `synchronize` dropped (ADR 0002) — pushes no longer re-trigger; re-review = re-add the
label (or mark an already-labeled draft ready).
5. ⏳ **Later (v2):** label lifecycle (strip-on-non-approval / keep-on-error / dismiss-stale-on-push). (`synchronize` /