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.

fix(reviewhog): explain flash review limits in comments (#104416)

Alex Lebedeva686899f50f3
diff --git a/docs/internal/sandboxes-setup-guide.md b/docs/internal/sandboxes-setup-guide.md
index f3ea226cb8ef..1854dee7f3f7 100644
--- a/docs/internal/sandboxes-setup-guide.md
+++ b/docs/internal/sandboxes-setup-guide.md
@@ -207,7 +207,7 @@ Both review modes instruct the agent to fetch pinned review and validation skill
The agent can fetch referenced bundled files with `skill-file-get`.
Choose **Review in Flash mode** from the Code review page's review menu to run it for one turn without changing the PR's full-review configuration.
Flash requests preserve an existing report's review tier, including when they join a running review.
-Flash labels its GitHub messages with `FLASH MODE` and never starts comment resolution.
+Flash labels its GitHub messages with `FLASH MODE - Faster, but stupid, use regular ReviewHog for a heavy review` and never starts comment resolution.
**Review all your PRs in Flash mode** is off by default.
Turn it on in Code review to review PRs you author in `PostHog/posthog` when they open or receive new commits, including drafts.
diff --git a/products/review_hog/ARCHITECTURE.md b/products/review_hog/ARCHITECTURE.md
index ef7c7bf546bc..51e81c5fcd38 100644
--- a/products/review_hog/ARCHITECTURE.md
+++ b/products/review_hog/ARCHITECTURE.md
@@ -347,7 +347,7 @@ pr_metadata.head_branch` is threaded (as explicit kwargs, alongside `team_id` /
"View them in PostHog" deep link to the exact report (`/project/<team>/code-review?review=<report id>`,
a **permanent public contract** — the frontend URL sync and `report_deep_link` must keep agreeing on it).
Every message a **flash** turn writes — the status comment in each of its states, the promo comment, the
- review body, and each inline comment — opens with `FLASH MODE` + newline (`message_prefix_for_mode`), applied
+ review body, and each inline comment — opens with `FLASH MODE - Faster, but stupid, use regular ReviewHog for a heavy review` + newline (`message_prefix_for_mode`), applied
in `_post_github_review` and the status-comment renderers before redaction.
The workflow captures one **`reviewhog_review_started`** product-analytics event per turn that passed every
gate (`track_review_started_activity`) and, after the publish stage, one **`reviewhog_review_completed`** per
diff --git a/products/review_hog/DECISIONS.md b/products/review_hog/DECISIONS.md
index 6b22c5feeae4..ac34836c4d63 100644
--- a/products/review_hog/DECISIONS.md
+++ b/products/review_hog/DECISIONS.md
@@ -252,7 +252,7 @@ read `FINAL_REPORT.md` there first (config glossary + coverage matrix + ranking)
The mode travels in the workflow payload to each stage, and telemetry reads the same arm-selection helpers as execution.
Cached perspective results carry the reviewer model, preventing a full Sol review from reusing Luna findings.
The existing join-on-running and already-reviewed rules still allow only one review per commit.
-- **Publishing.** Flash prefixes status, promotion, review-body, and inline comments with `FLASH MODE` followed by a newline.
+- **Publishing.** Flash prefixes status, promotion, review-body, and inline comments with `FLASH MODE - Faster, but stupid, use regular ReviewHog for a heavy review` followed by a newline.
It never chains comment resolution.
The UI and generated MCP trigger accept the mode; the CLI exposes it through `run_review --review-mode flash`.
- **Gateway access.** Luna already belongs to the `review_hog` model allowance.
diff --git a/products/review_hog/backend/reviewer/constants.py b/products/review_hog/backend/reviewer/constants.py
index b37eae810589..ab69eeecc6fb 100644
--- a/products/review_hog/backend/reviewer/constants.py
+++ b/products/review_hog/backend/reviewer/constants.py
@@ -75,7 +75,7 @@ FLASH_ARM = ReviewArm(
# Every GitHub message a flash turn writes (status comment, promo, review body, inline comments)
# starts with this, so a reader can tell a flash review from a full one at a glance.
-FLASH_MODE_MESSAGE_PREFIX = "FLASH MODE\n"
+FLASH_MODE_MESSAGE_PREFIX = "FLASH MODE - Faster, but stupid, use regular ReviewHog for a heavy review\n"
def message_prefix_for_mode(review_mode: str) -> str:
diff --git a/products/review_hog/backend/reviewer/tests/test_publish_review.py b/products/review_hog/backend/reviewer/tests/test_publish_review.py
index 9a73239e4487..d4a101b7b7df 100644
--- a/products/review_hog/backend/reviewer/tests/test_publish_review.py
+++ b/products/review_hog/backend/reviewer/tests/test_publish_review.py
@@ -8,7 +8,7 @@ from parameterized import parameterized
from posthog.egress.github.transport import GitHubRateLimitError
from products.review_hog.backend.reviewer.artefact_content import ReviewIssueFinding, ValidationVerdict
-from products.review_hog.backend.reviewer.constants import published_priorities_for
+from products.review_hog.backend.reviewer.constants import FLASH_MODE_MESSAGE_PREFIX, published_priorities_for
from products.review_hog.backend.reviewer.models.issues_review import IssuePriority, LineRange
from products.review_hog.backend.reviewer.tools.github_client import GitHubAPIError
from products.review_hog.backend.reviewer.tools.github_threads import REVIEW_HOG_FINDING_MARKER
@@ -118,14 +118,17 @@ class TestPostGithubReview:
post_promo=True,
marker="m",
promo_marker="pm",
- message_prefix="FLASH MODE\n",
+ message_prefix=FLASH_MODE_MESSAGE_PREFIX,
)
(promo,) = _promo_posts(mock_request)
- assert promo["body"].startswith("FLASH MODE\nPostHog Review alpha")
+ assert promo["body"].startswith(f"{FLASH_MODE_MESSAGE_PREFIX}PostHog Review alpha")
(payload,) = _review_posts(mock_request)
- assert payload["body"] == "FLASH MODE\nbody"
- assert [c["body"] for c in payload["comments"]] == ["FLASH MODE\nfirst", "FLASH MODE\nsecond"]
+ assert payload["body"] == f"{FLASH_MODE_MESSAGE_PREFIX}body"
+ assert [c["body"] for c in payload["comments"]] == [
+ f"{FLASH_MODE_MESSAGE_PREFIX}first",
+ f"{FLASH_MODE_MESSAGE_PREFIX}second",
+ ]
def test_credential_shapes_are_scrubbed_before_posting(
self, mock_request: MagicMock, mock_paginated: MagicMock
diff --git a/products/review_hog/backend/reviewer/tools/publish_review.py b/products/review_hog/backend/reviewer/tools/publish_review.py
index 934fc0ac4f50..df9c94ccc192 100644
--- a/products/review_hog/backend/reviewer/tools/publish_review.py
+++ b/products/review_hog/backend/reviewer/tools/publish_review.py
@@ -427,7 +427,9 @@ def _review_already_posted(
or (
legacy_marker is not None
and legacy_marker in (review.get("body") or "")
- and (review.get("body") or "").startswith(message_prefix_for_mode(REVIEW_MODE_FLASH))
+ and (review.get("body") or "").startswith(
+ ("FLASH MODE\n", message_prefix_for_mode(REVIEW_MODE_FLASH))
+ )
== (review_mode == REVIEW_MODE_FLASH)
)
)
diff --git a/products/review_hog/backend/tests/test_publish_idempotency.py b/products/review_hog/backend/tests/test_publish_idempotency.py
index c3a61cb3a30a..01a5bd46688a 100644
--- a/products/review_hog/backend/tests/test_publish_idempotency.py
+++ b/products/review_hog/backend/tests/test_publish_idempotency.py
@@ -78,22 +78,28 @@ def test_review_already_posted_proceeds_when_readback_fails() -> None:
assert _review_posted(_review_marker("rep-1", "sha1"), [], boom=True) is False
-def test_legacy_markers_only_suppress_reviews_in_the_same_mode() -> None:
+ [
+ ("full", ""),
+ ("flash", "FLASH MODE\n"),
+ ("flash", message_prefix_for_mode("flash")),
+ ]
+)
+def test_legacy_markers_only_suppress_reviews_in_the_same_mode(posted_mode: str, prefix: str) -> None:
legacy = _review_marker("rep-1", "sha1")
- for posted_mode in ("full", "flash"):
- review = {"body": f"{message_prefix_for_mode(posted_mode)}body\n{legacy}", "user": {"type": "Bot"}}
- with patch(_PAGINATED, side_effect=_paginated([review])):
- for requested_mode in ("full", "flash"):
- assert _review_already_posted(
- "o",
- "r",
- 1,
- _review_marker("rep-1", "sha1", requested_mode),
- token="t",
- installation_id=None,
- legacy_marker=legacy,
- review_mode=requested_mode,
- ) is (posted_mode == requested_mode)
+ review = {"body": f"{prefix}body\n{legacy}", "user": {"type": "Bot"}}
+ with patch(_PAGINATED, side_effect=_paginated([review])):
+ for requested_mode in ("full", "flash"):
+ assert _review_already_posted(
+ "o",
+ "r",
+ 1,
+ _review_marker("rep-1", "sha1", requested_mode),
+ token="t",
+ installation_id=None,
+ legacy_marker=legacy,
+ review_mode=requested_mode,
+ ) is (posted_mode == requested_mode)
def test_promo_already_posted_detects_the_markered_comment() -> None:
diff --git a/products/review_hog/backend/tests/test_status_comment.py b/products/review_hog/backend/tests/test_status_comment.py
index 472fc77b15d9..8b645c0d14ee 100644
--- a/products/review_hog/backend/tests/test_status_comment.py
+++ b/products/review_hog/backend/tests/test_status_comment.py
@@ -9,7 +9,11 @@ from django.utils import timezone
from parameterized import parameterized
from products.review_hog.backend.models import ReviewReport
-from products.review_hog.backend.reviewer.constants import REVIEW_MODE_FLASH, REVIEW_MODE_FULL
+from products.review_hog.backend.reviewer.constants import (
+ FLASH_MODE_MESSAGE_PREFIX,
+ REVIEW_MODE_FLASH,
+ REVIEW_MODE_FULL,
+)
from products.review_hog.backend.reviewer.models.github_meta import PRMetadata
from products.review_hog.backend.reviewer.models.issue_validation import IssueValidation
from products.review_hog.backend.reviewer.models.issues_review import Issue, IssuePriority, LineRange
@@ -76,7 +80,7 @@ class TestFlashPrefix:
def test_every_status_body_opens_with_the_prefix_only_in_flash(self, _name: str, render) -> None:
# The status comment is rewritten in every state; a state that forgot the prefix would read
# as a full review mid-run or at the end, and a full run must never carry it.
- assert render(REVIEW_MODE_FLASH).startswith("FLASH MODE\n### ")
+ assert render(REVIEW_MODE_FLASH).startswith(f"{FLASH_MODE_MESSAGE_PREFIX}### ")
assert not render(REVIEW_MODE_FULL).startswith("FLASH MODE")
@@ -254,7 +258,7 @@ class TestEnsureStatusComment(BaseTest):
ensure_status_comment(self.team.id, str(report.id), review_mode=REVIEW_MODE_FLASH)
assert _posts(mock_request) == ["/repos/o/r/issues/123/comments"]
- assert mock_request.call_args.kwargs["json"]["body"].startswith("FLASH MODE\n")
+ assert mock_request.call_args.kwargs["json"]["body"].startswith(FLASH_MODE_MESSAGE_PREFIX)
report.refresh_from_db()
assert report.status_comment_id == 777
assert report.status_comment_edited_at is not None
@@ -417,7 +421,7 @@ class TestFinalizeStatusComment(BaseTest):
assert "couldn't finish this review" in body
# The entry point threads the turn's mode into the renderer; a dropped kwarg here would
# leave a dead flash run reading as a full one.
- assert body.startswith("FLASH MODE\n")
+ assert body.startswith(FLASH_MODE_MESSAGE_PREFIX)
class TestResolutionSection: