: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
fix(review-hog): post old-code should-fix findings on flash follow-ups (#116049)
Julian Bez9e0193d02c36
diff --git a/products/review_hog/ARCHITECTURE.md b/products/review_hog/ARCHITECTURE.mdindex 7b66517150bd..93fcbd749c02 100644--- a/products/review_hog/ARCHITECTURE.md+++ b/products/review_hog/ARCHITECTURE.md@@ -286,7 +286,7 @@ flowchart TD### Single-agent Flash (the Flash default)A Flash turn runs one of two designs, picked by the fetch activity (`select_review_design`, `reviewer/constants.py`).-The **single-agent design** (`reviewhog-flash-2-2`) replaces steps 4, 5, and 8 below with parallel Codex sandbox+The **single-agent design** (`reviewhog-flash-2-3`) replaces steps 4, 5, and 8 below with parallel Codex sandboxsessions, all on `SINGLE_AGENT_FLASH_ARM` (`gpt-6.1-sol` @ medium) and all returning `SingleAgentReview`:- **The main session** (`single_agent_review_activity`) reviews the whole PR. Its system prompt is `core.md` (the@@ -314,9 +314,9 @@ the prompt tells the session to read those files at the head. There is no team sDevEx-owned prompts.Each session persists as one `perspective_result` under a reserved pass (`SINGLE_AGENT_PASS_NUMBER` 2000, lenses 2001-and 2002) and its part. On a follow-up turn, a P2 or P3 finding more than `FLASH_FOLLOW_UP_CHANGE_MARGIN_LINES` (3)+and 2002) and its part. On a follow-up turn, a P3 finding more than `FLASH_FOLLOW_UP_CHANGE_MARGIN_LINES` (3)lines from any code that changed since `completed_head_sha` drops as `old_code` first (`ChangedSinceReview`). The two-heads' PR snapshots are compared by line content per file, so lines a base merge only moved stay old. P0 and P1+heads' PR snapshots are compared by line content per file, so lines a base merge only moved stay old. P0 to P2findings, files whose patch GitHub left out, a first review, and a re-run at the reviewed head skip the check. Step 7 then runs as two dedup calls in parallel (`dedupe_flash_findings`,`tools/single_agent_review.py`), both one-shot OpenAI calls on `FLASH_DEDUP_MODEL` (`gpt-6-luna` @ medium,`run_oneshot_openai_review`): the main findings against earlier turns, and the lens findings against the same plus@@ -514,7 +514,7 @@ pr_metadata.head_branch` is threaded (as explicit kwargs, alongside `team_id` /Turn event IDs distinguish Full and Flash, and the single-agent design from the pipeline, while preserving the legacy Full and pipeline Flash IDs across deployments.Completion-rate calculations match failures and completions by report, turn, and mode; an absent mode means Full for legacy events.After the skill sync, `record_turn_marker_activity` records the turn's version marker: a version id per review mode- and design (`reviewhog-flash-2-2`, built by `reviewhog_version_for_mode` from the manual (major, minor) bumps in+ and design (`reviewhog-flash-2-3`, built by `reviewhog_version_for_mode` from the manual (major, minor) bumps in`REVIEWHOG_VERSIONS`, `reviewer/constants.py`) plus a 7-character fingerprint (`reviewer/fingerprint.py`).Full, Flash pipeline, and Flash single agent evolve separately, so each bumps its own version.The fingerprint hashes the review mode, the review and validator arms, the chunking / dedup / one-shot pins,diff --git a/products/review_hog/DECISIONS.md b/products/review_hog/DECISIONS.mdindex e87afff916ed..fdb6133cd45d 100644--- a/products/review_hog/DECISIONS.md+++ b/products/review_hog/DECISIONS.md@@ -198,6 +198,20 @@ read `FINAL_REPORT.md` there first (config glossary + coverage matrix + ranking)rate drops materially (toward ≤50%) on frozen-PR evals with the valid-finding set intact (item 5'scoverage matrix as the guard); kill if valid findings drop with the noise.+### ✅ BUILT 2026-10-13 — Flash follow-ups drop only P3 findings on unchanged code (`reviewhog-flash-2-3`)++- **What.** The `old_code` rule from `reviewhog-flash-2-1` now drops only P3 findings on code unchanged since the last+ reviewed head. A P2 on old code goes through dedup like any other finding, so it posts unless it repeats a finding+ an earlier turn posted.+- **Why.** Reading the findings the rule dropped showed that many P2s on old code named specific bugs the earlier+ turn had missed, such as unhandled errors on request paths and races, while no other drop rule removed real+ findings. Other review bots on the same PRs raised issues in old code that authors then fixed. The rule existed to+ stop repeats, and dedup against earlier turns' findings already removes a repeat of a finding that posted.+- **Kept.** P3 findings on old code still drop: they are the trickle the rule was built for, and Flash posts P3s+ rarely.+- **Supersedes** the idea of letting an old-code finding through only when two turns raise it independently, which+ would have kept most of these bugs dropped.+### ✅ DECIDED 2026-10-09 — the `review-hog-internal` gate is gone- **What.** `review-hog` is the only ReviewHog flag. Automatic Flash reviews, the label trigger, resolution, manualdiff --git a/products/review_hog/backend/api/reviews.py b/products/review_hog/backend/api/reviews.pyindex 672e860c8ba7..9206ba4796a1 100644--- a/products/review_hog/backend/api/reviews.py+++ b/products/review_hog/backend/api/reviews.py@@ -657,8 +657,9 @@ class ReviewDroppedFindingSerializer(serializers.Serializer):)disposition = serializers.ChoiceField(choices=ReviewDropDisposition.choices,- help_text="Why the turn did not post the finding. `old_code`: a follow-up turn's minor finding on code "- "that did not change since the last reviewed head. `dedup_prior`: repeats an earlier turn's finding. "+ help_text="Why the turn did not post the finding. `old_code`: a follow-up turn's P3 finding on code "+ "that did not change since the last reviewed head (turns before reviewhog-flash-2-3 dropped P2 findings "+ "this way too). `dedup_prior`: repeats an earlier turn's finding. ""`dedup_comment`: repeats a PR comment. `dedup_anchor`: repeats a main-review finding at the same ""spot. `dedup_sibling`: repeats another finding from the same session or lens. `cap`: ranked below ""the per-review finding limit.",diff --git a/products/review_hog/backend/reviewer/constants.py b/products/review_hog/backend/reviewer/constants.pyindex d22c62ab94f1..d8db7b70edba 100644--- a/products/review_hog/backend/reviewer/constants.py+++ b/products/review_hog/backend/reviewer/constants.py@@ -114,12 +114,12 @@ def select_review_design(review_mode: str, *, kill_switch_on: bool) -> ReviewDesREVIEWHOG_VERSIONS: dict[tuple[str, str], tuple[int, int]] = {(REVIEW_MODE_FULL, REVIEW_DESIGN_PIPELINE): (1, 4),(REVIEW_MODE_FLASH, REVIEW_DESIGN_PIPELINE): (1, 4),- (REVIEW_MODE_FLASH, REVIEW_DESIGN_SINGLE_AGENT): (2, 2),+ (REVIEW_MODE_FLASH, REVIEW_DESIGN_SINGLE_AGENT): (2, 3),}def reviewhog_version_for_mode(review_mode: str, review_design: str = REVIEW_DESIGN_PIPELINE) -> str:- """The version id a turn of this mode and design reports, like a model id: `reviewhog-flash-2-2`."""+ """The version id a turn of this mode and design reports, like a model id: `reviewhog-flash-2-3`."""major, minor = REVIEWHOG_VERSIONS[(review_mode, review_design)]return f"reviewhog-{review_mode}-{major}-{minor}"diff --git a/products/review_hog/backend/reviewer/models/issues_review.py b/products/review_hog/backend/reviewer/models/issues_review.pyindex 8bd9edff18d3..5f2790999b12 100644--- a/products/review_hog/backend/reviewer/models/issues_review.py+++ b/products/review_hog/backend/reviewer/models/issues_review.py@@ -80,7 +80,7 @@ class Issue(BaseModel):# Why a single-agent turn drops a finding. A `dedup_*` drop repeats an earlier turn's finding, a main# finding (anchor), or a finding of its own session or lens (sibling). Only records from before Flash# stopped reading PR comments carry `dedup_comment`. `cap` is the cut in `compose_flash_findings`.-# `old_code` is a follow-up turn's P2 or P3 finding on code that did not change since the last reviewed head.+# `old_code` is a follow-up turn's P3 finding on code that did not change since the last reviewed head.DropDisposition = Literal["old_code","dedup_prior",diff --git a/products/review_hog/backend/reviewer/tests/test_single_agent_review.py b/products/review_hog/backend/reviewer/tests/test_single_agent_review.pyindex f010beebabac..4e3273b9468a 100644--- a/products/review_hog/backend/reviewer/tests/test_single_agent_review.py+++ b/products/review_hog/backend/reviewer/tests/test_single_agent_review.py@@ -503,40 +503,37 @@ class TestDedupeFlashFindings:"file,lines,priority,posts",[pytest.param(- "a.py", LineRange(start=30), IssuePriority.SHOULD_FIX, False, id="p2_on_code_the_first_review_saw"+ "a.py", LineRange(start=30), IssuePriority.CONSIDER, False, id="p3_on_code_the_first_review_saw"),+ pytest.param("a.py", LineRange(start=30), IssuePriority.SHOULD_FIX, True, id="p2_on_unchanged_code"),pytest.param("a.py", LineRange(start=16), IssuePriority.CONSIDER, False, id="p3_on_lines_a_base_merge_only_moved"),- pytest.param("a.py", LineRange(start=42), IssuePriority.SHOULD_FIX, True, id="p2_next_to_a_new_line"),+ pytest.param("a.py", LineRange(start=42), IssuePriority.CONSIDER, True, id="p3_next_to_a_new_line"),pytest.param("a.py", LineRange(start=30), IssuePriority.MUST_FIX, True, id="p1_on_unchanged_code"),pytest.param("a.py",LineRange(start=100, end=10**9),- IssuePriority.SHOULD_FIX,+ IssuePriority.CONSIDER,False,- id="p2_with_a_huge_range_is_compared_not_scanned",+ id="p3_with_a_huge_range_is_compared_not_scanned",),+ pytest.param("b.py", LineRange(start=30), IssuePriority.CONSIDER, True, id="p3_in_a_file_without_a_patch"),+ pytest.param("c.py", LineRange(start=10), IssuePriority.CONSIDER, True, id="p3_where_a_guard_was_removed"),pytest.param(- "b.py", LineRange(start=30), IssuePriority.SHOULD_FIX, True, id="p2_in_a_file_without_a_patch"+ "d.py", LineRange(start=10), IssuePriority.CONSIDER, True, id="p3_on_a_copy_above_the_original"),pytest.param(- "c.py", LineRange(start=10), IssuePriority.SHOULD_FIX, True, id="p2_where_a_guard_was_removed"- ),- pytest.param(- "d.py", LineRange(start=10), IssuePriority.SHOULD_FIX, True, id="p2_on_a_copy_above_the_original"- ),- pytest.param(- "e.py", LineRange(start=31), IssuePriority.SHOULD_FIX, True, id="p2_on_a_statement_moved_elsewhere"+ "e.py", LineRange(start=31), IssuePriority.CONSIDER, True, id="p3_on_a_statement_moved_elsewhere"),],)- async def test_a_follow_up_drops_p2_and_p3_findings_on_unchanged_code(+ async def test_a_follow_up_drops_p3_findings_on_unchanged_code(self, pr_metadata: PRMetadata, file: str, lines: LineRange, priority: IssuePriority, posts: bool) -> None:- # A follow-up turn re-reviews the whole PR, so without this it trickles in findings on code the+ # A follow-up turn re-reviews the whole PR, so without this it trickles in minor findings on code the# first review already covered. Moved lines stay old, while a removed guard or a repeated line in a- # new place is new code, and a P1 still posts.+ # new place is new code, and a P2 or P1 still posts.earlier = [_patched("a.py", ("addition", 10, ["x = 1", "y = 2", "z = 3"])),_patched("c.py", ("context", 9, ["def delete(request):"]), ("addition", 10, [" check()", " drop()"])),diff --git a/products/review_hog/backend/reviewer/tools/single_agent_review.py b/products/review_hog/backend/reviewer/tools/single_agent_review.pyindex 058b66d56486..796ad8c02411 100644--- a/products/review_hog/backend/reviewer/tools/single_agent_review.py+++ b/products/review_hog/backend/reviewer/tools/single_agent_review.py@@ -594,14 +594,14 @@ class ChangedSinceReview:def _old_code_findings(issues: list[Issue], changed_since: ChangedSinceReview | None) -> list[Issue]:- """A follow-up turn's P2 and P3 findings on code that did not change since the last reviewed head.+ """A follow-up turn's P3 findings on code that did not change since the last reviewed head.- Authors act on these about half as often as on first-turn findings, because the first review already- covered that code. A P0 or P1 still posts, since a new commit can break code it did not touch.+ A P2 or higher on old code still goes through dedup: the earlier review may have missed it, and dedup+ against earlier turns' findings already removes one that a turn posted before."""if changed_since is None:return []- return [issue for issue in issues if issue.priority != IssuePriority.MUST_FIX and not changed_since.touches(issue)]+ return [issue for issue in issues if issue.priority == IssuePriority.CONSIDER and not changed_since.touches(issue)]async def dedupe_flash_findings(@@ -627,7 +627,7 @@ async def dedupe_flash_findings(it repeats survives (`_resolve_duplicates`). A finding that survives takes the priority of the mostsevere duplicate removed in its favor. `fall_back_on_any_error` lets a dedupcall fall back to the positional pre-filter on any failure, for the activity's last attempt.- On a follow-up turn, `changed_since` drops the P2 and P3 findings on unchanged code before dedup.+ On a follow-up turn, `changed_since` drops the P3 findings on unchanged code before dedup."""old_code = _old_code_findings(issues, changed_since)old_code_ids = {issue.id for issue in old_code}diff --git a/products/review_hog/backend/tests/test_constants.py b/products/review_hog/backend/tests/test_constants.pyindex fa1b5a579f2a..7ab2ec719f05 100644--- a/products/review_hog/backend/tests/test_constants.py+++ b/products/review_hog/backend/tests/test_constants.py@@ -71,7 +71,7 @@ class TestSelectReviewDesign:@parameterized.expand([# Dashboards split Flash by version, so a v2 turn must never report the v1 id or the reverse.- ("flash_single_agent", REVIEW_MODE_FLASH, REVIEW_DESIGN_SINGLE_AGENT, "reviewhog-flash-2-2"),+ ("flash_single_agent", REVIEW_MODE_FLASH, REVIEW_DESIGN_SINGLE_AGENT, "reviewhog-flash-2-3"),("flash_pipeline", REVIEW_MODE_FLASH, REVIEW_DESIGN_PIPELINE, "reviewhog-flash-1-4"),("full_pipeline", REVIEW_MODE_FULL, REVIEW_DESIGN_PIPELINE, "reviewhog-full-1-4"),]diff --git a/products/review_hog/backend/tests/test_fingerprint.py b/products/review_hog/backend/tests/test_fingerprint.pyindex fc4ae376c544..0dc97d6fa254 100644--- a/products/review_hog/backend/tests/test_fingerprint.py+++ b/products/review_hog/backend/tests/test_fingerprint.py@@ -107,7 +107,7 @@ class TestRecordTurnMarker(BaseTest):self._edit_single_agent_prompt(f"{prompt_name}.md")changed = self._record_single_agent(run_index=2)- assert original.version == "reviewhog-flash-2-2"+ assert original.version == "reviewhog-flash-2-3"assert changed.fingerprint != original.fingerprintdef test_the_coordinator_prompt_splits_only_coordinated_cohorts(self) -> None:diff --git a/products/review_hog/frontend/generated/api.schemas.ts b/products/review_hog/frontend/generated/api.schemas.tsindex 5d121aeb18db..713011a2d5f3 100644--- a/products/review_hog/frontend/generated/api.schemas.ts+++ b/products/review_hog/frontend/generated/api.schemas.ts@@ -1040,7 +1040,7 @@ export interface ReviewDroppedFindingApi {* @nullable*/source_perspective: string | null- /** Why the turn did not post the finding. `old_code`: a follow-up turn's minor finding on code that did not change since the last reviewed head. `dedup_prior`: repeats an earlier turn's finding. `dedup_comment`: repeats a PR comment. `dedup_anchor`: repeats a main-review finding at the same spot. `dedup_sibling`: repeats another finding from the same session or lens. `cap`: ranked below the per-review finding limit.+ /** Why the turn did not post the finding. `old_code`: a follow-up turn's P3 finding on code that did not change since the last reviewed head (turns before reviewhog-flash-2-3 dropped P2 findings this way too). `dedup_prior`: repeats an earlier turn's finding. `dedup_comment`: repeats a PR comment. `dedup_anchor`: repeats a main-review finding at the same spot. `dedup_sibling`: repeats another finding from the same session or lens. `cap`: ranked below the per-review finding limit.** * `old_code` - On unchanged code* * `dedup_prior` - Repeat of an earlier reviewdiff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 88b454489a41..25a88265311f 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -96811,7 +96811,7 @@ export namespace Schemas {* @nullable*/source_perspective: string | null;- /** Why the turn did not post the finding. `old_code`: a follow-up turn's minor finding on code that did not change since the last reviewed head. `dedup_prior`: repeats an earlier turn's finding. `dedup_comment`: repeats a PR comment. `dedup_anchor`: repeats a main-review finding at the same spot. `dedup_sibling`: repeats another finding from the same session or lens. `cap`: ranked below the per-review finding limit.+ /** Why the turn did not post the finding. `old_code`: a follow-up turn's P3 finding on code that did not change since the last reviewed head (turns before reviewhog-flash-2-3 dropped P2 findings this way too). `dedup_prior`: repeats an earlier turn's finding. `dedup_comment`: repeats a PR comment. `dedup_anchor`: repeats a main-review finding at the same spot. `dedup_sibling`: repeats another finding from the same session or lens. `cap`: ranked below the per-review finding limit.** * `old_code` - On unchanged code* * `dedup_prior` - Repeat of an earlier review