: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): drafts switch, skip-agent-review label, two fixes (#115205)
Julian Bez6e0021ca78ea
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 105a92b37049..e1303fc2deb8 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -14591,9 +14591,9 @@ snapshots:scenes-code-review--narrow--light:hash: v1.k794b7964.afeef57d84f381c04507c77246b5db937cc7d29187549e6e9b12d2e359fd8d42._EM_TEUS4trBZou9toi4uVqsXW90nXTElFSbERoU1oIscenes-code-review--narrow-settings--dark:- hash: v1.k794b7964.30e27208a1f2cd718962075ca898f14bd761e441ce9036b5ce1399fe2cdbe8e9.Per5PlPRaSDZNkhiLwOJcA_mfCNaA3JGY5USALMsd10+ hash: v1.k794b7964.ee3aaf102030bc766db111d265b0bc219296b19bcc8cc1919e0d25aba6eba1d5.Tf4ojj60u_4fdI-xMcnND_tfe1QJ5WPlKirR-2eAPrAscenes-code-review--narrow-settings--light:- hash: v1.k794b7964.b5b6931c1780d1f0208323cc930d8983e95cb1a63cdeaf9efb9206d3298e6c98.d9mwbeuHYVDPANqB6KZ_ds9NM0ApXckCMMR0iepHugs+ hash: v1.k794b7964.9c96345ea680fc707435ffd6b9638c076143827696e934365a7a58d148783d2d.lBwsKkas0U42cvy0XqCOGz2Qwr83Zxp9COxgjL7OPPkscenes-code-review--review-drawer-deep--dark:hash: v1.k794b7964.b6e8d258613e64e43d690058f64d0137f64e50776ff245fa9e679eb0c4617985.Z_imJ8KRX2pmZPy_KbumlnqY18-GIjBfQbGte1aKroAscenes-code-review--review-drawer-deep--light:@@ -14611,17 +14611,17 @@ snapshots:scenes-code-review--running-review--light:hash: v1.k794b7964.63c1f2fdc259d9f836f7d5d10662a0cf3dcb126782fc5dd79b419650cddff949.Ifn0U5N6KEnj0rsGu6ZFGXiwsvyeUBu9dUcMOn8FlwMscenes-code-review--saved-inbox-opt-ins--dark:- hash: v1.k794b7964.ad93f63add9cc729094908a1c95fd2d5a16cdc3cf60491d478103e0f8ef29e68.XWH14JWiIxuAv5FK2GruOU2sleoiBQ2AX9vCrVT3lk8+ hash: v1.k794b7964.1b565818b29311c553784d4a4ea04799bc71a69b0b0d4889d419095682a92190.ZqVGlc09mmVvHXJzw7IazXHu4AwyFYoqFWj6oKoiNCoscenes-code-review--saved-inbox-opt-ins--light:- hash: v1.k794b7964.714f0ebb4badbf3ca42ddf2f4080d283606079d80335ef139f73668fcb1bcfd0.tC0g5CX-Lw4SWm09tMZKa0O-SNh4hSVZ4pxMfcZ4veU+ hash: v1.k794b7964.d8a027d285ee93057b7256d8ce2ee1e116a365b0356162ca02b31a3a3272ad52._dl5L3t8XkGQDab6pFFpdABnEeP3Xs-7cfVeCnU8OaIscenes-code-review--settings--dark:- hash: v1.k794b7964.f52aa87142614c320e3e4fa13140fb0aad8fb1e95ae1c74032e922bd48df8e52.cULa8ESM4Ww8swwC0QwPsNqgn-rq7W34PqBBV2aBDtU+ hash: v1.k794b7964.f4198c9e89c93c62bb7d64f2629bcadacdc8b6e352213d6745ad6a54777bb458.xhoc_PDteUzfbz3DUoi-zBxWIB6CQpet4qBk-13vkAwscenes-code-review--settings--light:- hash: v1.k794b7964.4f6815289f583cc97333116b9ddf1c28cc2bd233c090026654f93dd5220056f9.Tp15gUzo7MoxHf18x3TYmKGIQT9bl4-SjLMqhGcn1HI+ hash: v1.k794b7964.78509357475fe027053c34b5e616076ba9fe3d796aa971cac23d0032e61e6e10.SlNrPoWV31uBKNWoMAav_BsvIWHwmH4cnmugxStPrHUscenes-code-review--settings-for-member--dark:- hash: v1.k794b7964.345237c1961648e79f137156609f47c1de1fb2f9d9e1705f3ec81d63057a93b7.SfEt_rusUh9-nXQUXWGhhHqZw0r2W7rJkun2z4C8sjY+ hash: v1.k794b7964.f282e87e23f2d86bbaab8bdcf02a9418c994bceefc9904afa640b57628398165.u_xfYtqLwoe8Mprm5AoC0mw2-jimOWxM3qyk3U6Vh4Uscenes-code-review--settings-for-member--light:- hash: v1.k794b7964.966915c0455f7356c4a57fdfaee5c8e1bdd7288bc9b90f44ba6896f3f193c117.JVdMrFkgohPcYCD4WUJepYr-jzydiuniR6l5S0Mg8sg+ hash: v1.k794b7964.0d6092d219336a649c003dfdc791768b35b09bc798f22c2eaecc01e3f38a7937.tsvIc1AHipONPzl-yX1QHXe-mkRo3Z6tpBigBDy_Z8wscenes-dashboards-customize-breakdown-colors--customize-breakdown-colors--dark:hash: v1.k794b7964.cf89a12669d5221b2441fbfb4439b8b1b38191943438a2c1a220444148329954.B4ew6uW3gZCbPU_3vTOggsOyHojRlyvuXxh5FZnlO-0scenes-dashboards-customize-breakdown-colors--customize-breakdown-colors--light:diff --git a/products/review_hog/ARCHITECTURE.md b/products/review_hog/ARCHITECTURE.mdindex 5cf8643acb3e..bf8c651a5479 100644--- a/products/review_hog/ARCHITECTURE.md+++ b/products/review_hog/ARCHITECTURE.md@@ -51,7 +51,7 @@ in flight, with the detail in DECISIONS.md.## Status & nextReviewHog runs end-to-end: label / UI / inbox / automatic authored-PR triggers → the Temporal pipeline → published PR review.-Automatic Standard reviews run on new PRs and pushes, including drafts, in every repository a project reviews, for the authors that the project rule, the repository exceptions, and each person's own choices select (`backend/automatic_review_rules.py`).+Automatic Standard reviews run on new PRs and pushes, including drafts unless the owner turns them off, but never on PRs with the `skip-agent-review` label, in every repository a project reviews, for the authors that the project rule, the repository exceptions, and each person's own choices select (`backend/automatic_review_rules.py`).The per-PR queue serializes reviews and coalesces automatic pushes into a follow-up for the latest head.The current focus is productionizing the reviewer-topology eval and tightening the finder/validator balance(validator strictness, fewer junk candidates, the coverage gap).@@ -839,7 +839,7 @@ See [DECISIONS.md](./DECISIONS.md) for the "reuse the leaf, own the model" bound`backend/preferences.py`: an absent key inherits, unknown keys and invalid values are ignored on read, and a writeequal to the inherited value removes the key. `urgency_threshold` and `celebrate_clean_reviews` inherit from theproject defaults in `ReviewProjectSettings.preferences`, then from the code defaults; the other keys- (`default_review_mode` follow/flash/off, `resolve_comments` default off, the two Inbox opt-ins) inherit from code+ (`default_review_mode` follow/flash/off, `review_drafts` default on, `resolve_comments` default off, the two Inbox opt-ins) inherit from codeonly. Read them with `ReviewUserSettings.load_preferences[_many]`. The older boolean and choice columns on`ReviewUserSettings` are unused. A GET creates no row; the first PATCH does.- **Repository ownership** (`backend/ownership.py`) — a repository belongs to at most one project, like GitHub's@@ -889,7 +889,11 @@ whoever controls the run, the sandbox agent included), **MCP tools**(`review-hog-reviews-{trigger,list,get}`, defined in `products/review_hog/mcp/tools.yaml` and gated on the`review-hog` feature flag) that drive the same reviews viewset with a personal API key or OAuth token, and **automatic authored-PR Flash reviews**.The automatic trigger consumes signed GitHub `pull_request` deliveries through `review_hog_authored_prs` and queues a Celery task for the ownership, identity, and rule checks.-It accepts `opened` and `synchronize` for open PRs whose head and base belong to the delivery's repository, including drafts.+It accepts `opened`, `synchronize`, and `ready_for_review` for open PRs whose head and base belong to the delivery's repository, including drafts.+A draft is skipped (`draft_skipped`) when the PR owner turned `review_drafts` off. Its first automatic review then comes from `ready_for_review`, and `automatic_reviewed_head_sha` keeps a head that was already reviewed as a draft from a second review.+A PR with the `skip-agent-review` label gets no automatic review (`label_skipped`). The task checks the payload labels, and the turn checks the labels its fetch reads from GitHub again, because `gh pr create --label` adds labels after the `opened` delivery.+The turn ends before the status comment, so a skip leaves nothing on the PR. Removing the label does not start a review; apply the `reviewhog` label for one.+The label, the `@posthog review` comment, and the UI button ignore both the switch and the skip label.The webhook handler reads only the cached ownership summary, so the task checks ownership again.Enabling 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.diff --git a/products/review_hog/backend/api/settings.py b/products/review_hog/backend/api/settings.pyindex 80dc494fdaf0..1f4077e2442b 100644--- a/products/review_hog/backend/api/settings.py+++ b/products/review_hog/backend/api/settings.py@@ -38,6 +38,7 @@ def _source_field(key: str) -> serializers.ChoiceField:class ReviewPreferenceSourcesSerializer(serializers.Serializer):default_review_mode = _source_field("default_review_mode")+ review_drafts = _source_field("review_drafts")resolve_comments = _source_field("resolve_comments")urgency_threshold = _source_field("urgency_threshold")celebrate_clean_reviews = _source_field("celebrate_clean_reviews")@@ -63,6 +64,12 @@ class ReviewUserSettingsSerializer(serializers.Serializer):"'follow' (default) uses each repository's rule, 'flash' gives automatic Standard reviews everywhere, and 'off' ""turns automatic reviews off everywhere. A choice for one repository wins over this default.",)+ review_drafts = serializers.BooleanField(+ required=False,+ help_text="Give the user's draft pull requests automatic reviews. On by default. When off, a draft gets "+ "its first automatic review when it is marked ready for review. Applies to automatic reviews only: the "+ "reviewhog label, an @posthog review comment, and the Review button still review drafts.",+ )resolve_comments = serializers.BooleanField(required=False,help_text="After a Deep review of the user's pull requests is published, run the resolution stage: "diff --git a/products/review_hog/backend/automatic_reviews.py b/products/review_hog/backend/automatic_reviews.pyindex 45008d2b6333..18b10caf0d43 100644--- a/products/review_hog/backend/automatic_reviews.py+++ b/products/review_hog/backend/automatic_reviews.py@@ -8,7 +8,7 @@ from posthog.models.integration import Integrationfrom posthog.otel_metrics import OtelInstrumentFactoryfrom products.review_hog.backend.automatic_review_rules import AutomaticReviewReason, decide_automatic_review-from products.review_hog.backend.models import ReviewReport+from products.review_hog.backend.models import ReviewReport, ReviewUserSettingsfrom products.review_hog.backend.ownership import RepositoryOwner, RepositoryOwnership, RepositoryReffrom products.review_hog.backend.pr_owner import is_active_memberfrom products.review_hog.backend.review_request_rules import full_review_published@@ -23,6 +23,8 @@ AuthoredPRReviewOutcome = Literal["bot_no_connector","not_opted_in","full_review_published",+ "draft_skipped",+ "label_skipped","started",]@@ -37,7 +39,7 @@ AUTHORED_PR_REVIEW_TOTAL = Counter()-def _observe_dispatch(outcome: AuthoredPRReviewOutcome) -> None:+def observe_dispatch(outcome: AuthoredPRReviewOutcome) -> None:AUTHORED_PR_REVIEW_TOTAL.labels(outcome=outcome).inc()_otel.record_counter_twin(AUTHORED_PR_REVIEW_TOTAL, 1, {"outcome": outcome})@@ -62,7 +64,7 @@ class AutomaticDispatch:def plan_automatic_review(- repository: RepositoryRef, owner: RepositoryOwner | None, *, author_login: str+ repository: RepositoryRef, owner: RepositoryOwner | None, *, author_login: str, draft: bool = False) -> AutomaticDispatch:"""Whether a push gets an automatic Flash review, in which project, and as which user."""# These clients pull in the signals product; planning a webhook must not load it at import.@@ -101,6 +103,12 @@ def plan_automatic_review(if run_as_user_id is None:return AutomaticDispatch(outcome="bot_no_connector", team_id=team_id)return AutomaticDispatch(outcome="started", team_id=team_id, run_as_user_id=run_as_user_id)+ if (+ draft+ and author_user_id is not None+ and not ReviewUserSettings.load_preferences(team_id, author_user_id).review_drafts+ ):+ return AutomaticDispatch(outcome="draft_skipped", team_id=team_id)return AutomaticDispatch(outcome="started", team_id=team_id, run_as_user_id=author_user_id)@@ -140,6 +148,8 @@ class AuthoredPRReview:pr_number: inthead_sha: strgithub_repo_id: int | None = None+ draft: bool = False+ skip_agent_review: bool = False@propertydef ref(self) -> RepositoryRef:@@ -153,13 +163,19 @@ class AuthoredPRReview:from products.review_hog.backend.temporal.client import start_review_pr_workflow # noqa: PLC0415from products.review_hog.backend.temporal.types import TRIGGER_AUTOMATIC # noqa: PLC0415+ if self.skip_agent_review:+ observe_dispatch("label_skipped")+ returndispatch = plan_automatic_review(- self.ref, RepositoryOwnership.find(self.ref, backfill=True), author_login=self.author_login+ self.ref,+ RepositoryOwnership.find(self.ref, backfill=True),+ author_login=self.author_login,+ draft=self.draft,)if dispatch.team_id is None or dispatch.run_as_user_id is None:# Most pushes get no automatic review, so the counter carries the signal and the logs# stay quiet.- _observe_dispatch(dispatch.outcome)+ observe_dispatch(dispatch.outcome)returnreport = (ReviewReport.objects.for_team(dispatch.team_id)@@ -167,7 +183,7 @@ class AuthoredPRReview:.first())if full_review_published(report):- _observe_dispatch("full_review_published")+ observe_dispatch("full_review_published")returnstart_review_pr_workflow(pr_url=f"https://github.com/{self.repository}/pull/{self.pr_number}",@@ -183,4 +199,4 @@ class AuthoredPRReview:github_repo_id=self.github_repo_id,)# After the start, so a retried task cannot count a dispatch it never made.- _observe_dispatch("started")+ observe_dispatch("started")diff --git a/products/review_hog/backend/preferences.py b/products/review_hog/backend/preferences.pyindex 798d4c6a191d..4bb535d58f1d 100644--- a/products/review_hog/backend/preferences.py+++ b/products/review_hog/backend/preferences.py@@ -62,6 +62,7 @@ PREFERENCE_FIELDS: tuple[PreferenceField, ...] = (PreferenceField(key="default_review_mode", default=DefaultReviewMode.FOLLOW.value, choices=tuple(DefaultReviewMode.values)),+ PreferenceField(key="review_drafts", default=True),PreferenceField(key="resolve_comments", default=False),PreferenceField(key="urgency_threshold",@@ -139,6 +140,7 @@ class ReviewPreferences:"""A person's effective preferences, and where each value comes from."""default_review_mode: DefaultReviewMode+ review_drafts: boolresolve_comments: boolurgency_threshold: UrgencyThresholdcelebrate_clean_reviews: bool@@ -166,6 +168,7 @@ class ReviewPreferences:effective[field.key], sources[field.key] = cls._inherited(field, project)return cls(default_review_mode=DefaultReviewMode(str(effective["default_review_mode"])),+ review_drafts=bool(effective["review_drafts"]),resolve_comments=bool(effective["resolve_comments"]),urgency_threshold=UrgencyThreshold(str(effective["urgency_threshold"])),celebrate_clean_reviews=bool(effective["celebrate_clean_reviews"]),diff --git a/products/review_hog/backend/pull_request_events.py b/products/review_hog/backend/pull_request_events.pyindex 919c38e22369..0f11c1b00e3e 100644--- a/products/review_hog/backend/pull_request_events.py+++ b/products/review_hog/backend/pull_request_events.py@@ -1,20 +1,22 @@"""GitHub `pull_request` deliveries of the PostHog GitHub App, routed by action.-- `opened` / `synchronize`: an automatic review (`automatic_reviews.py`).+- `opened` / `synchronize` / `ready_for_review`: an automatic review (`automatic_reviews.py`).- `labeled` with the `reviewhog` 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."""-from collections.abc import Mapping+from collections.abc import Iterable, Mappingfrom posthog.dataclasses import frozenfrom products.review_hog.backend.ownership import OwnedRepositoryPrefilter, RepositoryRefREVIEWHOG_LABEL = "reviewhog"-AUTOMATIC_REVIEW_ACTIONS = frozenset({"opened", "synchronize"})+# 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"})def _mapping(value: object) -> Mapping[str, object]:@@ -36,6 +38,16 @@ def _text(value: object) -> str | None:return value.strip() if isinstance(value, str) and value.strip() else None+def _label_names(value: object) -> list[object]:+ if not isinstance(value, list):+ return []+ return [_mapping(label).get("name") for label in value]+++def has_skip_agent_review_label(labels: Iterable[object]) -> bool:+ return any(isinstance(label, str) and label.strip().lower() == SKIP_AGENT_REVIEW_LABEL for label in labels)++@frozenclass PullRequestEvent:"""The parts of an open, same-repository pull request delivery that ReviewHog acts on."""@@ -48,6 +60,8 @@ class PullRequestEvent:author_login: strhead_sha: strhead_branch: str+ draft: bool = False+ skip_agent_review: bool = False# Set on `labeled` deliveries only.label_name: str | None = Nonesender_login: str | None = None@@ -86,6 +100,8 @@ class PullRequestEvent:author_login=author_login.lower(),head_sha=head_sha,head_branch=_text(head.get("ref")) or "",+ draft=pull_request.get("draft") is True,+ skip_agent_review=has_skip_agent_review_label(_label_names(pull_request.get("labels"))),label_name=_text(_mapping(payload.get("label")).get("name")),sender_login=_text(sender.get("login")),sender_is_bot=sender.get("type") == "Bot",@@ -122,6 +138,8 @@ def accept_pull_request_event(payload: Mapping[str, object]) -> None:pr_number=event.pr_number,head_sha=event.head_sha,github_repo_id=event.github_repo_id,+ draft=event.draft,+ skip_agent_review=event.skip_agent_review,)returnprocess_label_event.delay(diff --git a/products/review_hog/backend/reviewer/status_comment.py b/products/review_hog/backend/reviewer/status_comment.pyindex e29f23103820..bfa270a8afa6 100644--- a/products/review_hog/backend/reviewer/status_comment.py+++ b/products/review_hog/backend/reviewer/status_comment.py@@ -605,9 +605,10 @@ def _turn_state(team_id: int, report: ReviewReport, run_index: int) -> _TurnStat)-def _render_live_body(team_id: int, report: ReviewReport, review_mode: str, review_design: str, *, failed: bool) -> str:- # The in-flight turn's findings live one run_index ahead of the completed watermark.- state = _turn_state(team_id, report, report.run_count + 1)+def _render_live_body(+ team_id: int, report: ReviewReport, review_mode: str, review_design: str, *, run_index: int, failed: bool+) -> str:+ state = _turn_state(team_id, report, run_index)return render_in_progress_body(str(report.id),progress_payload(team_id, report, state.snapshot, state.turn, state.pairs),@@ -655,7 +656,10 @@ def maybe_refresh_status_comment(returntoken, installation_id = authowner, repo = _split_repository(report.repository)- body = _render_live_body(team_id, report, review_mode, review_design, failed=False)+ # The in-flight turn's findings live one run_index ahead of the completed watermark.+ body = _render_live_body(+ team_id, report, review_mode, review_design, run_index=report.run_count + 1, failed=False+ )_patch_comment(owner, repo, report.status_comment_id, body, token=token, installation_id=installation_id)except Exception:logger.exception("Could not refresh the ReviewHog status comment; the review continues without it")@@ -715,15 +719,18 @@ def finalize_status_comment(input: FinalizeStatusCommentInput) -> None:logger.exception("Could not finalize the ReviewHog status comment; the review is unaffected")-def fail_status_comment(team_id: int, report_id: str, *, review_mode: str = REVIEW_MODE_FULL) -> None:- """Rewrite the status comment as failed, so a dead run never reads as forever in progress."""+def fail_status_comment(team_id: int, report_id: str, *, run_index: int, review_mode: str = REVIEW_MODE_FULL) -> None:+ """Rewrite the status comment as failed, so a dead run never reads as forever in progress.++ `run_index` is the failed turn. A publish that fails after finalize already counts that turn in+ `run_count`, so `run_count + 1` would render the next, empty turn.+ """try:report = ReviewReport.objects.for_team(team_id).filter(id=report_id).first()if report is None or report.status_comment_id is None or report.pr_number is None:return- _edit_and_stamp(- team_id, report, _render_live_body(team_id, report, review_mode, REVIEW_DESIGN_PIPELINE, failed=True)- )+ body = _render_live_body(team_id, report, review_mode, REVIEW_DESIGN_PIPELINE, run_index=run_index, failed=True)+ _edit_and_stamp(team_id, report, body)except Exception:logger.exception("Could not mark the ReviewHog status comment as failed")diff --git a/products/review_hog/backend/tasks.py b/products/review_hog/backend/tasks.pyindex 69970c3b9a30..b8e569fd3916 100644--- a/products/review_hog/backend/tasks.py+++ b/products/review_hog/backend/tasks.py@@ -25,6 +25,8 @@ def process_authored_pr_event(repository: str = "PostHog/posthog",# Messages queued before this argument existed match the repository by name.github_repo_id: int | None = None,+ draft: bool = False,+ skip_agent_review: bool = False,) -> None:AuthoredPRReview(installation_id=installation_id,@@ -33,6 +35,8 @@ def process_authored_pr_event(pr_number=pr_number,head_sha=head_sha,github_repo_id=github_repo_id,+ draft=draft,+ skip_agent_review=skip_agent_review,).start()diff --git a/products/review_hog/backend/temporal/activities.py b/products/review_hog/backend/temporal/activities.pyindex cf6e3ef8577a..36bb8fcd1acd 100644--- a/products/review_hog/backend/temporal/activities.py+++ b/products/review_hog/backend/temporal/activities.py@@ -33,10 +33,11 @@ from posthog.sync import database_sync_to_asyncfrom posthog.temporal.common.scoped import scoped_temporalfrom posthog.temporal.common.utils import close_db_connections-from products.review_hog.backend.automatic_reviews import automatic_flash_allowed+from products.review_hog.backend.automatic_reviews import automatic_flash_allowed, observe_dispatchfrom 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 has_skip_agent_review_labelfrom products.review_hog.backend.review_request_rules import ResolutionGate, ReviewRequestRefusal, full_review_publishedfrom products.review_hog.backend.reviewer.constants import (ALREADY_RAISED_SHOWN,@@ -266,6 +267,8 @@ class ReviewMeta:lens_chunks_capped: bool = False# None means no automatic review has run on the PR, so the push gate stays off for this turn.automatic_reviewed_head_sha: str | None = None+ # An automatic turn on a PR with the skip-agent-review label. Older histories decode as no skip.+ skip_agent_review: bool = False@dataclass(frozen=False)@@ -610,6 +613,8 @@ class StatusCommentInput:report_id: strreview_mode: str = REVIEW_MODE_FULLreview_design: str = REVIEW_DESIGN_PIPELINE+ # The failed turn, for the failure edit. None in payloads from before the field existed.+ run_index: int | None = None# --- Setup activities ------------------------------------------------------------------------------@@ -794,8 +799,16 @@ def _fetch_and_persist(input: FetchPRDataInput) -> ReviewMeta:merge_base_sha=fetched.merge_base_sha,)lens_plan = plan_lens_chunks(fetched.pr_files) if single_agent else None+ # Checked on the fetched labels, because `gh pr create --label` adds labels after the `opened`+ # delivery, so the webhook payload can miss the label.+ skip_agent_review = input.trigger_source == TRIGGER_AUTOMATIC and has_skip_agent_review_label(+ fetched.pr_metadata.labels+ )+ if skip_agent_review:+ observe_dispatch("label_skipped")if already_published or (- input.trigger_source == TRIGGER_AUTOMATIC and (already_completed or fetched.pr_metadata.state != "open")+ input.trigger_source == TRIGGER_AUTOMATIC+ and (already_completed or skip_agent_review or fetched.pr_metadata.state != "open")):ReviewReport.objects.for_team(input.team_id).filter(id=report_id).update(status=ReviewReport.Status.IDLE if fetched.pr_metadata.state == "open" else ReviewReport.Status.CLOSED@@ -823,6 +836,7 @@ def _fetch_and_persist(input: FetchPRDataInput) -> ReviewMeta:lens_chunk_count=len(lens_plan.chunks) if lens_plan is not None else 0,lens_chunks_capped=lens_plan is not None and lens_plan.capped,automatic_reviewed_head_sha=report.automatic_reviewed_head_sha,+ skip_agent_review=skip_agent_review,)@@ -2240,25 +2254,28 @@ async def finalize_status_comment_activity(input: FinalizeStatusCommentInput) ->await database_sync_to_async(finalize_status_comment, thread_sensitive=False)(input)-def _fail_run(team_id: int, report_id: str, review_mode: str = REVIEW_MODE_FULL) -> None:+def _fail_run(team_id: int, report_id: str, review_mode: str = REVIEW_MODE_FULL, run_index: int | None = None) -> None:# The idle write comes first so a GitHub failure below can't skip it: on publishing runs# finalize defers going idle to the publish stage, so a run dying between finalize and publish# would otherwise sit ACTIVE (reading as in-progress in the UI) until the staleness cutoff.ReviewReport.objects.for_team(team_id).filter(id=report_id).update(status=ReviewReport.Status.IDLE)report = ReviewReport.objects.for_team(team_id).filter(id=report_id).first()- if report is not None:- record_run_outcome(- team_id,- report_id,- stage=RUN_STAGE_REVIEW,- outcome=RUN_OUTCOME_FAILED,- reason=REVIEW_FAILED_REASON,- # A run that dies in the publish window already counts its turn in `run_count`.- run_index=report.run_count if in_publish_window(report) else report.run_count + 1,- review_mode=review_mode,- head_sha=report.head_sha,- )- fail_status_comment(team_id, report_id, review_mode=review_mode)+ if report is None:+ return+ if run_index is None:+ # A run that dies in the publish window already counts its turn in `run_count`.+ run_index = report.run_count if in_publish_window(report) else report.run_count + 1+ record_run_outcome(+ team_id,+ report_id,+ stage=RUN_STAGE_REVIEW,+ outcome=RUN_OUTCOME_FAILED,+ reason=REVIEW_FAILED_REASON,+ run_index=run_index,+ review_mode=review_mode,+ head_sha=report.head_sha,+ )+ fail_status_comment(team_id, report_id, run_index=run_index, review_mode=review_mode)@activity.defn@@ -2270,7 +2287,9 @@ async def fail_status_comment_activity(input: StatusCommentInput) -> None:The idle write lives in this activity rather than as its own workflow command so in-flighthistories replay unchanged (new unconditional commands break replay determinism)."""- await database_sync_to_async(_fail_run, thread_sensitive=False)(input.team_id, input.report_id, input.review_mode)+ await database_sync_to_async(_fail_run, thread_sensitive=False)(+ input.team_id, input.report_id, input.review_mode, input.run_index+ )# --- The signals report's code_review receipt --------------------------------------------------------diff --git a/products/review_hog/backend/temporal/workflow.py b/products/review_hog/backend/temporal/workflow.pyindex 8d7fd1a7b0b5..d716632c7811 100644--- a/products/review_hog/backend/temporal/workflow.py+++ b/products/review_hog/backend/temporal/workflow.py@@ -513,6 +513,10 @@ class ReviewPRWorkflow:if inputs.trigger_source == TRIGGER_AUTOMATIC and (meta.already_completed or not meta.pr_open):workflow.logger.info("Automatic review skipped: the PR is closed or this head is already complete")return report_id+ # The patch keeps a history written before the label check on its old command sequence.+ if workflow.patched("reviewhog-skip-agent-review-label-2026-10") and meta.skip_agent_review:+ workflow.logger.info("Automatic review skipped: the PR has the skip-agent-review label")+ return report_id# Resolve the acting user whose enabled perspectives apply: the PR author, or the explicit# override the CLI and inbox triggers set. The label trigger falls back to the default run@@ -798,6 +802,7 @@ class ReviewPRWorkflow:report_id=report_id,review_mode=inputs.review_mode,review_design=review_design,+ run_index=meta.run_index,),start_to_close_timeout=_QUICK_TIMEOUT,retry_policy=_RETRY,diff --git a/products/review_hog/backend/tests/test_automatic_reviews.py b/products/review_hog/backend/tests/test_automatic_reviews.pyindex 073881ddddc9..4c6a4512b88b 100644--- a/products/review_hog/backend/tests/test_automatic_reviews.py+++ b/products/review_hog/backend/tests/test_automatic_reviews.py@@ -57,7 +57,12 @@ def _dispatch_count(outcome: str) -> float:def _payload(- *, action: str = "opened", draft: bool = False, repository: str = "PostHog/posthog", login: str = "OctoCat"+ *,+ action: str = "opened",+ draft: bool = False,+ repository: str = "PostHog/posthog",+ login: str = "OctoCat",+ labels: tuple[str, ...] = (),) -> dict[str, object]:return {"action": action,@@ -67,6 +72,7 @@ def _payload("number": 42,"state": "open","draft": draft,+ "labels": [{"name": label} for label in labels],"merged": False,"user": {"login": login},"head": {"sha": _HEAD_SHA, "ref": "feature", "repo": {"full_name": repository.lower()}},@@ -129,6 +135,7 @@ class TestAuthoredPRWebhook(SimpleTestCase):("opened", True, "PostHog/posthog"),("synchronize", False, "PostHog/posthog"),("synchronize", True, "PostHog/posthog"),+ ("ready_for_review", False, "PostHog/posthog"),])@patch(_QUEUE)@@ -147,6 +154,8 @@ class TestAuthoredPRWebhook(SimpleTestCase):pr_number=42,head_sha=_HEAD_SHA,github_repo_id=_REPO_ID,+ draft=draft,+ skip_agent_review=False,)@parameterized.expand(@@ -256,7 +265,7 @@ class TestAuthoredPRWebhook(SimpleTestCase):@parameterized.expand([- ("ready_for_review", ("action",), "ready_for_review"),+ ("edited", ("action",), "edited"),("closed", ("pull_request", "state"), "closed"),("merged", ("pull_request", "merged"), True),("fork", ("pull_request", "head", "repo", "full_name"), "octocat/posthog"),@@ -308,9 +317,11 @@ class TestAuthoredPRReviewTask(BaseTest):team_id=self.team.id, user_id=self.user.id, preferences={"default_review_mode": "flash"})- def _queued_event(self, login: str = "OctoCat") -> Mapping[str, object]:+ def _queued_event(+ self, login: str = "OctoCat", *, draft: bool = False, labels: tuple[str, ...] = ()+ ) -> Mapping[str, object]:with patch(_QUEUE) as enqueue:- accept_pull_request_event(_payload(login=login))+ accept_pull_request_event(_payload(login=login, draft=draft, labels=labels))enqueue.assert_called_once()return enqueue.call_args.kwargs@@ -329,10 +340,12 @@ class TestAuthoredPRReviewTask(BaseTest):"github_repo_id": _REPO_ID,}- @parameterized.expand([("own_flash_default",), ("listed_by_the_project",), ("repository_exception",)])+ @parameterized.expand(+ [("own_flash_default",), ("listed_by_the_project",), ("repository_exception",), ("draft_by_default",)]+ )@patch(_START)def test_eligible_author_schedules_flash_in_the_owning_project(self, setup: str, start: MagicMock) -> None:- if setup != "own_flash_default":+ if setup not in ("own_flash_default", "draft_by_default"):self.preferences.preferences = {}self.preferences.save(update_fields=["preferences"])if setup == "listed_by_the_project":@@ -345,7 +358,7 @@ class TestAuthoredPRReviewTask(BaseTest):self.repository.save()started_before = _dispatch_count("started")- process_authored_pr_event.run(**self._queued_event())+ process_authored_pr_event.run(**self._queued_event(draft=setup == "draft_by_default"))start.assert_called_once_with(**self._expected_start(team_id=self.team.id, user_id=self.user.id))assert _dispatch_count("started") - started_before == 1.0@@ -362,14 +375,22 @@ class TestAuthoredPRReviewTask(BaseTest):("unmapped", "bot_skipped"),("missing_installation", "installation_mismatch"),("full_review_published", "full_review_published"),+ ("draft_with_drafts_off", "draft_skipped"),+ ("skip_agent_review_label", "label_skipped"),])@patch(_START)def test_queued_events_recheck_ownership_consent_and_membership(self, change: str, expected_outcome: str, start: MagicMock) -> None:- queued = self._queued_event()- if change == "opted_out":+ queued = self._queued_event(+ draft=change == "draft_with_drafts_off",+ labels=("skip-agent-review",) if change == "skip_agent_review_label" else (),+ )+ if change == "draft_with_drafts_off":+ self.preferences.preferences = {"default_review_mode": "flash", "review_drafts": False}+ self.preferences.save(update_fields=["preferences"])+ elif change == "opted_out":self.preferences.preferences = {"default_review_mode": "off"}self.preferences.save(update_fields=["preferences"])elif change == "repository_removed":@@ -390,7 +411,7 @@ class TestAuthoredPRReviewTask(BaseTest):base_branch="master",published_heads_by_mode={"full": _HEAD_SHA},)- else:+ elif change == "unmapped":self.github_identity.delete()outcome_before = _dispatch_count(expected_outcome)diff --git a/products/review_hog/backend/tests/test_fetch_review_tier.py b/products/review_hog/backend/tests/test_fetch_review_tier.pyindex b0e6a2797fa8..af935714024c 100644--- a/products/review_hog/backend/tests/test_fetch_review_tier.py+++ b/products/review_hog/backend/tests/test_fetch_review_tier.py@@ -37,13 +37,29 @@ def _pr_metadata() -> PRMetadata:class TestFetchDecidesTheTier(BaseTest):- @parameterized.expand([(None, "open", False), ("sha1", "open", True), (None, "closed", False)])+ @parameterized.expand(+ [+ (None, "open", [], False, False),+ # A ready_for_review turn after the draft's automatic review at the same head.+ ("sha1", "open", [], True, False),+ (None, "closed", [], False, False),+ # `gh pr create --label` adds the label after the `opened` delivery.+ (None, "open", ["Skip-Agent-Review"], False, True),+ ]+ )@patch(f"{_MODULE}._installation_auth", return_value=("tok", None))@patch(f"{_MODULE}.PRFetcher")def test_automatic_completion_requires_a_successful_publication_step(- self, automatic_head: str | None, state: str, complete: bool, mock_fetcher: MagicMock, _auth: MagicMock+ self,+ automatic_head: str | None,+ state: str,+ labels: list[str],+ complete: bool,+ skipped: bool,+ mock_fetcher: MagicMock,+ _auth: MagicMock,) -> None:- metadata = _pr_metadata().model_copy(update={"state": state})+ metadata = _pr_metadata().model_copy(update={"state": state, "labels": labels})mock_fetcher.return_value.fetch_pr_data.return_value = FetchedPR(pr_metadata=metadata, pr_comments=[], pr_files=[], diff="")@@ -69,7 +85,8 @@ class TestFetchDecidesTheTier(BaseTest):assert meta.already_completed is completeassert meta.pr_open is (state == "open")assert meta.automatic_reviewed_head_sha == automatic_head- expected_status = "closed" if state == "closed" else "idle" if complete else "active"+ assert meta.skip_agent_review is skipped+ expected_status = "closed" if state == "closed" else "idle" if complete or skipped else "active"assert report.status == expected_status@parameterized.expand([("flash", REVIEW_MODE_FLASH, 1), ("full", REVIEW_MODE_FULL, 0)])diff --git a/products/review_hog/backend/tests/test_settings_api.py b/products/review_hog/backend/tests/test_settings_api.pyindex bdb6f3bdf116..4a16c4088962 100644--- a/products/review_hog/backend/tests/test_settings_api.py+++ b/products/review_hog/backend/tests/test_settings_api.py@@ -28,6 +28,7 @@ class TestReviewUserSettingsAPI(APIBaseTest):assert res.status_code == 200assert res.json() == {"default_review_mode": "follow",+ "review_drafts": True,"resolve_comments": False,"urgency_threshold": "consider","celebrate_clean_reviews": True,@@ -35,6 +36,7 @@ class TestReviewUserSettingsAPI(APIBaseTest):"stamphog_review_inbox_prs": False, # opt-in: a real approval must never be a default"sources": {"default_review_mode": "default",+ "review_drafts": "default","resolve_comments": "default","urgency_threshold": "default","celebrate_clean_reviews": "default",diff --git a/products/review_hog/backend/tests/test_status_comment.py b/products/review_hog/backend/tests/test_status_comment.pyindex b8b482c0165b..3513d1c76cc0 100644--- a/products/review_hog/backend/tests/test_status_comment.py+++ b/products/review_hog/backend/tests/test_status_comment.py@@ -471,15 +471,27 @@ class TestFinalizeStatusComment(BaseTest):report_id = upsert_review_report(team_id=self.team.id, repository="o/r", pr_url="u", pr_metadata=_pr_metadata())report = ReviewReport.objects.for_team(self.team.id).get(id=report_id)report.status_comment_id = 555- report.save(update_fields=["status_comment_id"])+ # Finalize already counted turn 1 before its publish failed.+ report.run_count = 1+ report.save(update_fields=["status_comment_id", "run_count"])+ issue = self._issue("1-1-1", IssuePriority.MUST_FIX)+ persist_findings(team_id=self.team.id, report_id=report_id, issues=[issue], run_index=1)+ persist_verdict(+ team_id=self.team.id,+ report_id=report_id,+ issue=issue,+ validation=IssueValidation(is_valid=True, argumentation="a"),+ run_index=1,+ )- fail_status_comment(self.team.id, report_id, review_mode=REVIEW_MODE_FLASH)+ fail_status_comment(self.team.id, report_id, run_index=1, review_mode=REVIEW_MODE_FLASH)assert _patches(mock_request) == ["/repos/o/r/issues/comments/555"]body = mock_request.call_args.kwargs["json"]["body"]# The entry point threads the turn's mode into the renderer; a dropped kwarg here would# leave a dead Standard run reading as a Deep one.assert body.startswith("### PostHog Review · Standard · couldn't finish reviewing ")+ assert "1 kept, 0 dismissed" in body_DONE_BODY = f"### reviewed\n\n| Step | Status | Result |\n|---|---|---|\n| Publish | done | 1 posted |\n\n{status_marker('rid')}"diff --git a/products/review_hog/backend/tests/test_temporal_workflow.py b/products/review_hog/backend/tests/test_temporal_workflow.pyindex 03b7fdf825fe..02c9331aabf8 100644--- a/products/review_hog/backend/tests/test_temporal_workflow.py+++ b/products/review_hog/backend/tests/test_temporal_workflow.py@@ -153,6 +153,7 @@ async def _run_full_review_pr_workflow(fail_lens_units: frozenset[tuple[str, int]] = frozenset(),fail_main_session: bool = False,automatic_reviewed_head_sha: str | None = None,+ skip_agent_review: bool = False,gate_skips: bool = False,fail_gate: bool = False,workflow_max_attempts: int | None = None,@@ -230,6 +231,7 @@ async def _run_full_review_pr_workflow(lens_chunk_count=lens_chunk_count,lens_chunks_capped=lens_chunks_capped,automatic_reviewed_head_sha=automatic_reviewed_head_sha,+ skip_agent_review=skip_agent_review,)gate_calls: list[str] = []@@ -774,11 +776,17 @@ async def test_review_pr_workflow_single_agent_fails_only_on_the_main_session(@pytest.mark.asyncio@pytest.mark.parametrize(- "enabled,completed,pr_open,expected_review",- [(True, False, True, True), (False, False, True, False), (True, True, True, False), (True, False, False, False)],+ "enabled,completed,pr_open,skip_label,expected_review",+ [+ (True, False, True, False, True),+ (False, False, True, False, False),+ (True, True, True, False, False),+ (True, False, False, False, False),+ (True, False, True, True, False),+ ],)async def test_automatic_reviews_recheck_consent_and_skip_completed_or_closed_prs(- enabled: bool, completed: bool, pr_open: bool, expected_review: bool+ enabled: bool, completed: bool, pr_open: bool, skip_label: bool, expected_review: bool) -> None:recorded = await _run_full_review_pr_workflow(publish=True,@@ -787,9 +795,11 @@ async def test_automatic_reviews_recheck_consent_and_skip_completed_or_closed_prreview_authored_prs=enabled,already_completed=completed,pr_open=pr_open,+ skip_agent_review=skip_label,)assert bool(recorded["review"]) is expected_reviewassert bool(recorded["publish"]) is expected_review+ assert bool(recorded["status_posts"]) is expected_review@pytest.mark.asynciodiff --git a/products/review_hog/frontend/CodeReviewScene.stories.tsx b/products/review_hog/frontend/CodeReviewScene.stories.tsxindex 629915bbc64c..d19fd6436d2f 100644--- a/products/review_hog/frontend/CodeReviewScene.stories.tsx+++ b/products/review_hog/frontend/CodeReviewScene.stories.tsx@@ -48,6 +48,7 @@ import { CodeReviewTab } from './reviewHogSettingsLogic'const defaultSettings: ReviewUserSettingsApi = {default_review_mode: 'follow',+ review_drafts: true,resolve_comments: false,urgency_threshold: 'consider',celebrate_clean_reviews: true,@@ -55,6 +56,7 @@ const defaultSettings: ReviewUserSettingsApi = {stamphog_review_inbox_prs: false,sources: {default_review_mode: 'default',+ review_drafts: 'default',resolve_comments: 'default',urgency_threshold: 'default',celebrate_clean_reviews: 'default',diff --git a/products/review_hog/frontend/generated/api.schemas.ts b/products/review_hog/frontend/generated/api.schemas.tsindex 4f55a9dfd1a5..08046cc12fcb 100644--- a/products/review_hog/frontend/generated/api.schemas.ts+++ b/products/review_hog/frontend/generated/api.schemas.ts@@ -1487,6 +1487,12 @@ export interface ReviewPreferenceSourcesApi {* * `project` - Project default* * `default` - Built-in default */default_review_mode: PreferenceSourceEnumApi+ /** Where the effective review_drafts comes from: 'user' (the user set it), 'project' (the project default), or 'default' (the built-in default).+ *+ * * `user` - Set by the user+ * * `project` - Project default+ * * `default` - Built-in default */+ review_drafts: PreferenceSourceEnumApi/** Where the effective resolve_comments comes from: 'user' (the user set it), 'project' (the project default), or 'default' (the built-in default).** * `user` - Set by the user@@ -1537,6 +1543,8 @@ export interface ReviewUserSettingsApi {* * `flash` - On everywhere* * `off` - Off everywhere */default_review_mode?: DefaultReviewModeEnumApi+ /** Give the user's draft pull requests automatic reviews. On by default. When off, a draft gets its first automatic review when it is marked ready for review. Applies to automatic reviews only: the reviewhog label, an @posthog review comment, and the Review button still review drafts. */+ review_drafts?: boolean/** After a Deep review of the user's pull requests is published, run the resolution stage: triage the unresolved review threads, implement the worth-and-safe fixes on the PR branch, and reply on every thread. Off by default. Personal only: no project default applies. */resolve_comments?: boolean/** Minimum priority a validated Deep review finding needs to be published: 'consider' publishes everything, 'should_fix' drops consider-level findings, 'must_fix' publishes only blocking issues. Without the user's own value the project default applies.@@ -1566,6 +1574,8 @@ export interface PatchedReviewUserSettingsApi {* * `flash` - On everywhere* * `off` - Off everywhere */default_review_mode?: DefaultReviewModeEnumApi+ /** Give the user's draft pull requests automatic reviews. On by default. When off, a draft gets its first automatic review when it is marked ready for review. Applies to automatic reviews only: the reviewhog label, an @posthog review comment, and the Review button still review drafts. */+ review_drafts?: boolean/** After a Deep review of the user's pull requests is published, run the resolution stage: triage the unresolved review threads, implement the worth-and-safe fixes on the PR branch, and reply on every thread. Off by default. Personal only: no project default applies. */resolve_comments?: boolean/** Minimum priority a validated Deep review finding needs to be published: 'consider' publishes everything, 'should_fix' drops consider-level findings, 'must_fix' publishes only blocking issues. Without the user's own value the project default applies.diff --git a/products/review_hog/frontend/generated/api.zod.ts b/products/review_hog/frontend/generated/api.zod.tsindex 8953c753e2b1..29007b352c3e 100644--- a/products/review_hog/frontend/generated/api.zod.ts+++ b/products/review_hog/frontend/generated/api.zod.ts@@ -247,6 +247,12 @@ export const ReviewHogSettingsPartialUpdateBody = /* @__PURE__ */ zod.object({.describe("Automatic reviews of the user's own pull requests in every repository this project reviews: 'follow' (default) uses each repository's rule, 'flash' gives automatic Standard reviews everywhere, and 'off' turns automatic reviews off everywhere. A choice for one repository wins over this default.\n\n\* `follow` - Let each repository decide\n\* `flash` - On everywhere\n\* `off` - Off everywhere"),+ review_drafts: zod+ .boolean()+ .optional()+ .describe(+ "Give the user's draft pull requests automatic reviews. On by default. When off, a draft gets its first automatic review when it is marked ready for review. Applies to automatic reviews only: the reviewhog label, an @posthog review comment, and the Review button still review drafts."+ ),resolve_comments: zod.boolean().optional()diff --git a/products/review_hog/frontend/repositories/MyDefaultCell.tsx b/products/review_hog/frontend/repositories/MyDefaultCell.tsxindex 0fd16b0d0693..a49e2b217f90 100644--- a/products/review_hog/frontend/repositories/MyDefaultCell.tsx+++ b/products/review_hog/frontend/repositories/MyDefaultCell.tsx@@ -1,6 +1,6 @@import { useActions, useValues } from 'kea'-import { LemonBanner, LemonSelect } from '@posthog/lemon-ui'+import { LemonBanner, LemonSelect, LemonSwitch } from '@posthog/lemon-ui'import type { DefaultReviewModeEnumApi } from 'products/review_hog/frontend/generated/api.schemas'import { reviewHogSettingsLogic } from 'products/review_hog/frontend/reviewHogSettingsLogic'@@ -13,7 +13,10 @@ export function MyDefaultCell({ className }: { className?: string }): JSX.Elemenconst { settings, settingsLoading } = useValues(reviewHogSettingsLogic)const { overview } = useValues(reviewHogRepositoriesLogic)const { setMyDefault } = useActions(reviewHogRepositoriesLogic)+ const { updateSettings } = useActions(reviewHogSettingsLogic)const value = settings?.default_review_mode ?? 'follow'+ const reviewDrafts = settings?.review_drafts ?? true+ const disabledReason = settings === null ? 'Loading…' : settingsLoading ? 'Saving…' : undefinedconst notice = myDefaultNotice(value, overview?.my_choices_unlike_default ?? null)return (@@ -33,10 +36,26 @@ export function MyDefaultCell({ className }: { className?: string }): JSX.Elemenvalue={value}options={DEFAULT_REVIEW_MODE_OPTIONS}onChange={(mode) => mode !== value && setMyDefault(mode)}- disabledReason={settings === null ? 'Loading…' : settingsLoading ? 'Saving…' : undefined}+ disabledReason={disabledReason}data-attr="review-hog-default-review-mode"/></div>+ <div className="flex flex-col gap-0.5">+ <div className="flex flex-wrap items-center gap-1">+ <YouMark shown={!reviewDrafts} />+ <span className="text-xs text-secondary">Review my draft pull requests</span>+ <LemonSwitch+ aria-label="Review my draft pull requests"+ checked={reviewDrafts}+ onChange={(checked) => updateSettings({ review_drafts: checked })}+ disabledReason={disabledReason}+ data-attr="review-hog-review-drafts"+ />+ </div>+ <span className="pl-10 text-xs text-secondary">+ When off, a draft gets its first automatic review when you mark it ready for review.+ </span>+ </div>{notice && (<LemonBanner type="info" className="text-xs">{notice}diff --git a/products/review_hog/frontend/reviewHogSettingsLogic.test.ts b/products/review_hog/frontend/reviewHogSettingsLogic.test.tsindex 5426617ad60a..554fbc0d0ab1 100644--- a/products/review_hog/frontend/reviewHogSettingsLogic.test.ts+++ b/products/review_hog/frontend/reviewHogSettingsLogic.test.ts@@ -542,6 +542,12 @@ describe('reviewHogSettingsLogic', () => {await expectLogic(logic, () => {jest.advanceTimersByTime(60_000)}).toNotHaveDispatchedActions(['loadReviews'])++ // A triggered review polls even when the reload after the trigger fails and no success arrives.+ logic.actions.startTriggeredReviewWatch()+ await expectLogic(logic, () => {+ jest.advanceTimersByTime(10_000)+ }).toDispatchActions(['loadReviews'])} finally {jest.useRealTimers()}diff --git a/products/review_hog/frontend/reviewHogSettingsLogic.ts b/products/review_hog/frontend/reviewHogSettingsLogic.tsindex f47797aa00fb..a02a2eb3e47f 100644--- a/products/review_hog/frontend/reviewHogSettingsLogic.ts+++ b/products/review_hog/frontend/reviewHogSettingsLogic.ts@@ -1391,6 +1391,12 @@ export const reviewHogSettingsLogic = kea<reviewHogSettingsLogicType>([)return () => clearTimeout(expiryTimer)}, 'triggeredReviewWatch')+ // Armed here too, because a failed first reload never reaches `loadReviewsSuccess`.+ // The next successful load replaces or disposes this poll as usual.+ cache.disposables.add(() => {+ const pollTimer = window.setInterval(() => actions.loadReviews(), IN_PROGRESS_POLL_INTERVAL_MS)+ return () => clearInterval(pollTimer)+ }, 'reviewsPoll')},stopTriggeredReviewWatch: () => {cache.disposables.dispose('triggeredReviewWatch')diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex fbe4f25745b0..5ea3cdc694a9 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -83418,6 +83418,12 @@ export namespace Schemas {* * `project` - Project default* * `default` - Built-in default */default_review_mode: PreferenceSourceEnum;+ /** Where the effective review_drafts comes from: 'user' (the user set it), 'project' (the project default), or 'default' (the built-in default).+ *+ * * `user` - Set by the user+ * * `project` - Project default+ * * `default` - Built-in default */+ review_drafts: PreferenceSourceEnum;/** Where the effective resolve_comments comes from: 'user' (the user set it), 'project' (the project default), or 'default' (the built-in default).** * `user` - Set by the user@@ -83468,6 +83474,8 @@ export namespace Schemas {* * `flash` - On everywhere* * `off` - Off everywhere */default_review_mode?: DefaultReviewModeEnum;+ /** Give the user's draft pull requests automatic reviews. On by default. When off, a draft gets its first automatic review when it is marked ready for review. Applies to automatic reviews only: the reviewhog label, an @posthog review comment, and the Review button still review drafts. */+ review_drafts?: boolean;/** After a Deep review of the user's pull requests is published, run the resolution stage: triage the unresolved review threads, implement the worth-and-safe fixes on the PR branch, and reply on every thread. Off by default. Personal only: no project default applies. */resolve_comments?: boolean;/** Minimum priority a validated Deep review finding needs to be published: 'consider' publishes everything, 'should_fix' drops consider-level findings, 'must_fix' publishes only blocking issues. Without the user's own value the project default applies.@@ -96730,6 +96738,8 @@ export namespace Schemas {* * `flash` - On everywhere* * `off` - Off everywhere */default_review_mode?: DefaultReviewModeEnum;+ /** Give the user's draft pull requests automatic reviews. On by default. When off, a draft gets its first automatic review when it is marked ready for review. Applies to automatic reviews only: the reviewhog label, an @posthog review comment, and the Review button still review drafts. */+ review_drafts?: boolean;/** After a Deep review of the user's pull requests is published, run the resolution stage: triage the unresolved review threads, implement the worth-and-safe fixes on the PR branch, and reply on every thread. Off by default. Personal only: no project default applies. */resolve_comments?: boolean;/** Minimum priority a validated Deep review finding needs to be published: 'consider' publishes everything, 'should_fix' drops consider-level findings, 'must_fix' publishes only blocking issues. Without the user's own value the project default applies.