: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
feat(review-hog): drop the legacy reviewhog label alias (#122204)
Georges-Antoine Assi749ed767a006
diff --git a/products/review_hog/ARCHITECTURE.md b/products/review_hog/ARCHITECTURE.mdindex 59980d7e8fb3..cf65ec567f68 100644--- a/products/review_hog/ARCHITECTURE.md+++ b/products/review_hog/ARCHITECTURE.md@@ -5,7 +5,7 @@**PostHog Review** is the product name on every outward surface: GitHub comments, MCP tools, API docs, and UI prose.**Code review** is the name of the in-app page and its nav entry only.**ReviewHog** is the internal codename. Code, logs, metric names, keys, and developer docs use it.-The `posthog-review` label starts a review. The legacy `reviewhog` label still works as an alias.+The `posthog-review` label starts a review.The UI and the text PostHog Review posts use the user-facing names. Code, API values, and stored data use the internal names.@@ -936,7 +936,7 @@ See [DECISIONS.md](./DECISIONS.md) for the "reuse the leaf, own the model" bound4. Set the project rule (automatic Flash for everyone, for listed people, or opt-in only) and the bot rule.**Triggers.** Six entry points feed the same per-PR `ReviewPRQueueWorkflow`: the `run_review` CLI (manual / eval), the-`posthog-review` **label** (or the legacy `reviewhog` label) on a PR in a repository that a project reviews (the GitHub App's own `labeled` delivery), a **UI**+`posthog-review` **label** on a PR in a repository that a project reviews (the GitHub App's own `labeled` delivery), a **UI**"Review this PR" field in the Code review scene (any installation-accessible PR; its split button's `run_mode`also carries the review-without-resolving, resolve-only, and **Flash** variants; Flash pins resolution off), an **inbox** trigger (a`TaskRun` receiver auto-reviews self-driving Signals implementations once their PR exists — a pushed branch without@@ -955,7 +955,7 @@ The webhook handler reads only the cached ownership summary, so the task checksEnabling the setting performs no backfill; existing PRs become eligible on their next push.The turn rechecks ownership and the rules before starting. Flash publishes every kept finding (it records `consider` as the turn's threshold) and never starts resolution.**No Flash after Full:** once a PR has a published Full review, automatic dispatch skips it (`full_review_published`), the turn's recheck refuses it, and a manual Flash request answers 409 `flash_after_full`.-The same `review_hog_authored_prs` consumer (the name is the dedup key, so it stays) routes by action through `facade/github.py::accept_pull_request_event` (`backend/pull_request_events.py`): `labeled` with the `posthog-review` or legacy `reviewhog` label queues `process_label_event`.+The same `review_hog_authored_prs` consumer (the name is the dedup key, so it stays) routes by action through `facade/github.py::accept_pull_request_event` (`backend/pull_request_events.py`): `labeled` with the `posthog-review` label queues `process_label_event`.That task finds the owning project and accepts a person or `stamphog[bot]` (Stamphog's hand-off) as the labeler; another bot's label gets an explaining comment, and the app token removes the label that the event named.The review runs as the PR owner, else as the user who connected the installation (`Integration.created_by`) with default settings and no resolution; the workflow removes both labels when the run ends, and a running resolution leaves the label for a later retry.Counters: `posthog_review_hog_authored_pr_review_total` and `posthog_review_hog_label_review_total`, keyed by outcome.diff --git a/products/review_hog/CONTEXT.md b/products/review_hog/CONTEXT.mdindex 843327bae1eb..c599d05dffcf 100644--- a/products/review_hog/CONTEXT.md+++ b/products/review_hog/CONTEXT.md@@ -2,7 +2,7 @@Vocabulary settled while working on the product. Pure vocabulary — no spec, no implementation detail beyond what a term needs to be unambiguous.-- **PostHog Review / Code review / ReviewHog** — three names for one product. **PostHog Review** is the product name on every outward surface (GitHub, MCP, API docs, UI prose). **Code review** is the in-app page and nav name only. **ReviewHog** is the internal codename for code, logs, and developer docs. The `posthog-review` label starts a review, and the legacy `reviewhog` label still works.+- **PostHog Review / Code review / ReviewHog** — three names for one product. **PostHog Review** is the product name on every outward surface (GitHub, MCP, API docs, UI prose). **Code review** is the in-app page and nav name only. **ReviewHog** is the internal codename for code, logs, and developer docs. The `posthog-review` label starts a review.- **Finding body** — the reviewer's description of a problem (`Issue.issue`, persisted as `ReviewIssueFinding.body`). Dual-audience text: it is rendered verbatim in the published comment AND consumed by three downstream LLM stages (the validator's `ISSUE` payload, dedup's fresh/prior finding payloads, and future turns' covered-findings block).- **Validator argumentation** — the validator's why-valid / why-dismissed reasoning (`IssueValidation.argumentation`). For a _valid_ finding it is presentation-only (humans + the copy-paste fix prompt); its only pipeline consumer is dedup's `prior_ruling`, and only when the finding was _dismissed_.- **Published copy** — what humans read on GitHub (inline comment sections, report body) and in the Code review UI. Today it is byte-identical to the pipeline payload; nothing requires that.diff --git a/products/review_hog/backend/label_reviews.py b/products/review_hog/backend/label_reviews.pyindex aefac5380629..1c67c5204315 100644--- a/products/review_hog/backend/label_reviews.py+++ b/products/review_hog/backend/label_reviews.py@@ -1,5 +1,5 @@-"""The label trigger: the `posthog-review` label (or the legacy `reviewhog` label) on a pull request starts a-Standard review, or a Deep one once the pull request has a published Deep review.+"""The label trigger: the `posthog-review` label on a pull request starts a Standard review, or a Deep one+once the pull request has a published Deep review.The PostHog GitHub App's own `labeled` delivery starts it, so the trigger works in every repository theapp is installed on and a project owns (`ownership.py`). One label add is one review: pushes do not@@ -27,7 +27,7 @@ from posthog.permissions import posthog_feature_flag_enabledfrom products.review_hog.backend.automatic_reviews import connector_user_idfrom products.review_hog.backend.ownership import RepositoryOwnership, RepositoryReffrom products.review_hog.backend.pr_owner import PullRequestOwnerResolver-from products.review_hog.backend.pull_request_events import REVIEW_LABEL, REVIEW_LABELS+from products.review_hog.backend.pull_request_events import REVIEW_LABELfrom products.review_hog.backend.review_request_rules import trigger_review_modefrom products.review_hog.backend.reviewer.constants import REVIEW_MODE_FLASH, REVIEW_MODE_FULLfrom products.review_hog.backend.reviewer.persistence import lift_review_tier_for_joined_trigger@@ -157,19 +157,17 @@ class LabelReview:def _refuse_bot_label(self, integration: Integration) -> None:# The label goes first: a failed call retries the task, and the comment must post only once.token = self._github(integration).get_access_token()- # The task does not carry the label name, so a queued task works on old and new workers alike.- for label in sorted(REVIEW_LABELS):- try:- github_api_request(- "DELETE",- f"/repos/{self.repository}/issues/{self.pr_number}/labels/{label}",- token=token,- installation_id=self.installation_id,- endpoint="/repos/{owner}/{repo}/issues/{issue_number}/labels/{name}",- )- except GitHubAPIError as error:- if error.status != 404:- raise+ try:+ github_api_request(+ "DELETE",+ f"/repos/{self.repository}/issues/{self.pr_number}/labels/{REVIEW_LABEL}",+ token=token,+ installation_id=self.installation_id,+ endpoint="/repos/{owner}/{repo}/issues/{issue_number}/labels/{name}",+ )+ except GitHubAPIError as error:+ if error.status != 404:+ raise# A POST can succeed on GitHub and still fail here, so a retry checks for the earlier comment.if self._bot_label_comment_posted(token):returndiff --git a/products/review_hog/backend/pull_request_events.py b/products/review_hog/backend/pull_request_events.pyindex fe16a6d6e0ef..7e357d15ce0a 100644--- a/products/review_hog/backend/pull_request_events.py+++ b/products/review_hog/backend/pull_request_events.py@@ -1,7 +1,7 @@"""GitHub `pull_request` deliveries of the PostHog GitHub App, routed by action.- `opened` / `synchronize` / `ready_for_review`: an automatic review (`automatic_reviews.py`).-- `labeled` with the `posthog-review` label (or the legacy `reviewhog` label): a label review (`label_reviews.py`).+- `labeled` with the `posthog-review` label: a label review (`label_reviews.py`).The webhook handler runs inside the request, so this module only parses the payload, reads thecached ownership summary, and queues a Celery task. The task checks ownership and the rules again.@@ -14,8 +14,6 @@ from posthog.dataclasses import frozenfrom products.review_hog.backend.ownership import OwnedRepositoryPrefilter, RepositoryRefREVIEW_LABEL = "posthog-review"-LEGACY_REVIEW_LABEL = "reviewhog"-REVIEW_LABELS = frozenset({REVIEW_LABEL, LEGACY_REVIEW_LABEL})# Authors and automation apply this label to opt a pull request out of automatic reviews.SKIP_AGENT_REVIEW_LABEL = "skip-agent-review"AUTOMATIC_REVIEW_ACTIONS = frozenset({"opened", "synchronize", "ready_for_review"})@@ -117,7 +115,7 @@ class PullRequestEvent:@propertydef is_label_request(self) -> bool:- return self.action == "labeled" and (self.label_name or "").lower() in REVIEW_LABELS+ return self.action == "labeled" and (self.label_name or "").lower() == REVIEW_LABELdef accept_pull_request_event(payload: Mapping[str, object]) -> None:diff --git a/products/review_hog/backend/temporal/activities.py b/products/review_hog/backend/temporal/activities.pyindex 8635c10f57e1..3ddf53766dd6 100644--- a/products/review_hog/backend/temporal/activities.py+++ b/products/review_hog/backend/temporal/activities.py@@ -49,7 +49,7 @@ from products.review_hog.backend.label_reviews import (from products.review_hog.backend.models import ReviewProjectSettings, ReviewReport, ReviewUserSettingsfrom products.review_hog.backend.pr_owner import PullRequestOwnerResolverfrom products.review_hog.backend.preferences import ReviewPreferences-from products.review_hog.backend.pull_request_events import REVIEW_LABELS, has_skip_agent_review_label+from products.review_hog.backend.pull_request_events import REVIEW_LABEL, has_skip_agent_review_labelfrom products.review_hog.backend.review_request_rules import ResolutionGate, full_review_publishedfrom products.review_hog.backend.reviewer.artefact_content import ReviewIssueFinding, ValidationVerdictfrom products.review_hog.backend.reviewer.constants import (@@ -2145,27 +2145,24 @@ async def publish_review_activity(input: PublishInput) -> PublishResult:def _remove_trigger_label(input: RemoveTriggerLabelInput) -> None:token, installation_id = _installation_auth(input.team_id, f"{input.owner}/{input.repo}")- # The run does not know which label started it, and a label added during the run joins it, so the- # run removes every review label.- for label in sorted(REVIEW_LABELS):- try:- github_api_request(- "DELETE",- f"/repos/{input.owner}/{input.repo}/issues/{input.pr_number}/labels/{label}",- token=token,- endpoint="/repos/{owner}/{repo}/issues/{issue_number}/labels/{name}",- installation_id=installation_id,- )- except GitHubAPIError as error:- if error.status != 404:- raise+ try:+ github_api_request(+ "DELETE",+ f"/repos/{input.owner}/{input.repo}/issues/{input.pr_number}/labels/{REVIEW_LABEL}",+ token=token,+ endpoint="/repos/{owner}/{repo}/issues/{issue_number}/labels/{name}",+ installation_id=installation_id,+ )+ except GitHubAPIError as error:+ if error.status != 404:+ raise@activity.defn@scoped_temporal()@close_db_connectionsasync def remove_trigger_label_activity(input: RemoveTriggerLabelInput) -> None:- """Remove the review labels that started a label-triggered review, if they are still present."""+ """Remove the review label that started a label-triggered review, if it is still present."""await database_sync_to_async(_remove_trigger_label, thread_sensitive=False)(input)diff --git a/products/review_hog/backend/tests/test_automatic_reviews.py b/products/review_hog/backend/tests/test_automatic_reviews.pyindex 85318cd0c0e5..57a0fa1502c8 100644--- a/products/review_hog/backend/tests/test_automatic_reviews.py+++ b/products/review_hog/backend/tests/test_automatic_reviews.py@@ -221,7 +221,7 @@ class TestAuthoredPRWebhook(SimpleTestCase):@parameterized.expand([("person_adds_the_label", "posthog-review", "OctoCat", "User", True),- ("person_adds_the_legacy_label", "reviewhog", "OctoCat", "User", True),+ ("person_adds_the_retired_label", "reviewhog", "OctoCat", "User", False),("label_name_ignores_case", "PostHog-Review", "OctoCat", "User", True),# The task explains the refusal on the pull request and removes the label.("bot_adds_the_label", "posthog-review", "renovate[bot]", "Bot", True),@@ -529,7 +529,6 @@ class TestLabelReviewTask(BaseTest):@parameterized.expand([("another_bot", "posthog-review", "renovate[bot]", False),- ("another_bot_legacy_label", "reviewhog", "renovate[bot]", False),("stamphog_hands_off", "posthog-review", "stamphog[bot]", True),])@@ -543,7 +542,6 @@ class TestLabelReviewTask(BaseTest):else:assert calls == [("DELETE", "/repos/PostHog/posthog/issues/42/labels/posthog-review"),- ("DELETE", "/repos/PostHog/posthog/issues/42/labels/reviewhog"),("POST", "/repos/PostHog/posthog/issues/42/comments"),]@@ -554,10 +552,8 @@ class TestLabelReviewTask(BaseTest):self.github.side_effect = [GitHubAPIError("boom", status=502),gone,- gone,GitHubAPIError("boom", status=502),gone,- gone,]posted = {"body": BOT_LABEL_COMMENT, "user": {"login": "posthog[bot]", "type": "Bot"}}self.github_comments.side_effect = [[], [posted]]@@ -568,7 +564,7 @@ class TestLabelReviewTask(BaseTest):process_label_event.run(**queued)calls = [call.args[0] for call in self.github.call_args_list]- assert calls == ["DELETE", "DELETE", "DELETE", "POST", "DELETE", "DELETE"]+ assert calls == ["DELETE", "DELETE", "POST", "DELETE"]self.start.assert_not_called()@parameterized.expand(diff --git a/products/review_hog/backend/tests/test_installation_auth.py b/products/review_hog/backend/tests/test_installation_auth.pyindex 3aae48d2f49f..d89961292abc 100644--- a/products/review_hog/backend/tests/test_installation_auth.py+++ b/products/review_hog/backend/tests/test_installation_auth.py@@ -56,12 +56,11 @@ class TestInstallationAuth(BaseTest):class TestRemoveTriggerLabel:@patch("products.review_hog.backend.temporal.activities._installation_auth", return_value=("tok", "inst"))@patch("products.review_hog.backend.temporal.activities.github_api_request")- def test_deletes_every_review_label(self, request: MagicMock, _auth: MagicMock) -> None:+ def test_deletes_the_review_label(self, request: MagicMock, _auth: MagicMock) -> None:_remove_trigger_label(RemoveTriggerLabelInput(team_id=1, owner="PostHog", repo="posthog", pr_number=7))assert [call.args for call in request.call_args_list] == [("DELETE", "/repos/PostHog/posthog/issues/7/labels/posthog-review"),- ("DELETE", "/repos/PostHog/posthog/issues/7/labels/reviewhog"),]@patch("products.review_hog.backend.temporal.activities._installation_auth", return_value=("tok", "inst"))