Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(review_hog): show the findings a Standard review did not post (#114912)

Julian Bez50cebdb823ff
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 7c099568d73a..fcdb87a96cec 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -14574,6 +14574,10 @@ snapshots:
hash: v1.k794b7964.15d432a648fa4f9c3014fb9eb2575a3fabef538e54a6b1c68ee365c3575c1903.KeVrff6VhdQx8AdPek8I7jfXGtRk5MCEybrtb_ZoCoA
scenes-code-review--review-drawer-standard--light:
hash: v1.k794b7964.b53341de7580b5171efd0dfee295ee2f4ef30dd69a057b3ef14e25b0d31709b3.g6L5bNqhOk1MwKDUX-iRS4LFjAKSrpZ6Znmuhv55FhY
+ scenes-code-review--review-drawer-standard-not-posted--dark:
+ hash: v1.k794b7964.3da9d89ad94f5333211ef5c3cde37558bc75dd9f854fd87cda69b6d404376f0f.uEOCy1EExEg8oV2sGDRMTKDUhhZbqxP0ScaTWrMO5eI
+ scenes-code-review--review-drawer-standard-not-posted--light:
+ hash: v1.k794b7964.c790ba3ca42d480a5302e3bd201ebc014c829ddf55dfbe12be1603c064224006.fmHTLnmtcBwkGjb02XFr1np5mOBjiq-lRNPMlHmD8ck
scenes-code-review--saved-inbox-opt-ins--dark:
hash: v1.k794b7964.ad93f63add9cc729094908a1c95fd2d5a16cdc3cf60491d478103e0f8ef29e68.XWH14JWiIxuAv5FK2GruOU2sleoiBQ2AX9vCrVT3lk8
scenes-code-review--saved-inbox-opt-ins--light:
diff --git a/products/review_hog/backend/api/reviews.py b/products/review_hog/backend/api/reviews.py
index c5013e3c10ef..4db1ab8a2781 100644
--- a/products/review_hog/backend/api/reviews.py
+++ b/products/review_hog/backend/api/reviews.py
@@ -36,6 +36,7 @@ from products.review_hog.backend.requested_reviews import (
)
from products.review_hog.backend.review_request_rules import ReviewRequestRefusal
from products.review_hog.backend.reviewer.artefact_content import (
+ DroppedFindingArtefact,
ReviewIssueCategory,
ReviewIssueFinding,
ValidationVerdict,
@@ -43,7 +44,12 @@ from products.review_hog.backend.reviewer.artefact_content import (
from products.review_hog.backend.reviewer.constants import REVIEW_MODE_FLASH, REVIEW_MODE_FULL, effective_priority
from products.review_hog.backend.reviewer.models.issues_review import IssuePriority
from products.review_hog.backend.reviewer.models.split_pr_into_chunks import ChunksList
-from products.review_hog.backend.reviewer.persistence import TurnFindingsBundle, load_chunk_set, load_findings_bundle
+from products.review_hog.backend.reviewer.persistence import (
+ TurnFindingsBundle,
+ load_chunk_set,
+ load_dropped_findings,
+ load_findings_bundle,
+)
from products.review_hog.backend.reviewer.progress import (
RESOLUTION_COMPLETED,
RESOLUTION_RESOLVING,
@@ -547,6 +553,62 @@ class ReviewFindingSerializer(serializers.Serializer):
)
+# Mirrors `DropDisposition`; `_dropped_finding_payload` fails loudly on a value missing here.
+class ReviewDropDisposition(models.TextChoices):
+ OLD_CODE = "old_code", "On unchanged code"
+ DEDUP_PRIOR = "dedup_prior", "Repeat of an earlier review"
+ DEDUP_COMMENT = "dedup_comment", "Already in a PR comment"
+ DEDUP_ANCHOR = "dedup_anchor", "Same spot as another finding"
+ DEDUP_SIBLING = "dedup_sibling", "Repeat of a finding"
+ CAP = "cap", "Over the limit"
+
+
+class ReviewDroppedFindingPriority(models.TextChoices):
+ MUST_FIX = IssuePriority.MUST_FIX.value, "Must fix"
+ SHOULD_FIX = IssuePriority.SHOULD_FIX.value, "Should fix"
+ CONSIDER = IssuePriority.CONSIDER.value, "Consider"
+
+
+class ReviewDroppedFindingSerializer(serializers.Serializer):
+ title = serializers.CharField(help_text="One-line summary of the finding.")
+ file = serializers.CharField(help_text="Repository-relative path of the affected file.")
+ lines = ReviewFindingLineRangeSerializer(many=True, help_text="Affected line ranges within the file.")
+ body = serializers.CharField(help_text="Description of the problem.")
+ suggestion = serializers.CharField(
+ allow_blank=True,
+ help_text="The specific fix the reviewer proposes. Usually empty: a single-agent finding ends its body "
+ "with the fix direction instead.",
+ )
+ priority = serializers.ChoiceField(
+ choices=ReviewDroppedFindingPriority.choices, help_text="The reviewer's priority for the finding."
+ )
+ source_perspective = serializers.CharField(
+ allow_null=True, help_text="The session that raised the finding: the main review or a lens."
+ )
+ 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. "
+ "`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.",
+ )
+ duplicate_of = serializers.CharField(
+ allow_null=True,
+ help_text="For a dedup drop, what it repeats: an issue key, or `comment:<id>` for a PR comment. "
+ "Null for other dispositions.",
+ )
+ comment_url = serializers.CharField(
+ allow_null=True,
+ help_text="Link to the PR comment the finding repeats, when `duplicate_of` names one and the PR URL is "
+ "known. Null otherwise.",
+ )
+ rank = serializers.IntegerField(
+ allow_null=True,
+ help_text="For a `cap` drop, the finding's 1-based position in the turn's ranked findings. Null otherwise.",
+ )
+
+
class ReviewDetailParamsSerializer(serializers.Serializer):
run_index = serializers.IntegerField(
required=False,
@@ -586,6 +648,11 @@ class ReviewDetailSerializer(ReviewRecentReviewSerializer):
dismissed_findings = ReviewFindingSerializer(
many=True, help_text="The returned turn's findings the validator dismissed, with its reasoning."
)
+ dropped_findings = ReviewDroppedFindingSerializer(
+ many=True,
+ help_text="The returned turn's findings a single-agent (Standard) review raised but did not post, each "
+ "with the reason. Empty for pipeline turns and for turns that predate the record.",
+ )
class ReviewPerspectiveStatItemSerializer(serializers.Serializer):
@@ -722,6 +789,26 @@ def _finding_payload(finding: ReviewIssueFinding, verdict: ValidationVerdict) ->
}
+def _dropped_finding_payload(dropped: DroppedFindingArtefact, pr_url: str | None) -> dict[str, Any]:
+ finding = dropped.finding
+ comment_url = None
+ if pr_url and dropped.duplicate_of and dropped.duplicate_of.startswith("comment:"):
+ comment_url = f"{pr_url}#discussion_r{dropped.duplicate_of.removeprefix('comment:')}"
+ return {
+ "title": finding.title,
+ "file": finding.file,
+ "lines": [{"start": line_range.start, "end": line_range.end} for line_range in finding.lines],
+ "body": finding.body,
+ "suggestion": finding.suggestion,
+ "priority": finding.priority.value,
+ "source_perspective": finding.source_perspective,
+ "disposition": ReviewDropDisposition(dropped.disposition).value,
+ "duplicate_of": dropped.duplicate_of,
+ "comment_url": comment_url,
+ "rank": dropped.rank,
+ }
+
+
def _selection_payload(turn: TurnStats, chunks: ChunksList | None) -> dict[str, Any] | None:
"""The selector's per-chunk plan for the detail drawer, joined with the chunk set's metadata."""
if turn.selection_roster is None or turn.selection_chunks is None:
@@ -1220,6 +1307,10 @@ class ReviewRecentReviewsViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet
or None,
"findings": sorted(valid, key=sort_key),
"dismissed_findings": sorted(dismissed, key=sort_key),
+ "dropped_findings": [
+ _dropped_finding_payload(dropped, report.pr_url)
+ for dropped in load_dropped_findings(team_id=team_id, report_id=report_id, run_index=run_index)
+ ],
"perspective_selection": _selection_payload(turns.get(report_id, TurnStats()), chunk_set),
}
return Response(ReviewDetailSerializer(payload).data)
diff --git a/products/review_hog/backend/reviewer/persistence.py b/products/review_hog/backend/reviewer/persistence.py
index 563bc9440c5c..9c66d37f2325 100644
--- a/products/review_hog/backend/reviewer/persistence.py
+++ b/products/review_hog/backend/reviewer/persistence.py
@@ -663,6 +663,28 @@ def replace_dropped_findings(
)
+def load_dropped_findings(*, team_id: int, report_id: str, run_index: int) -> list[DroppedFindingArtefact]:
+ """The findings a single-agent turn did not keep, in the order the turn recorded them.
+
+ Scoped to `run_index` like `load_turn_findings`. A retry replaces its turn's rows, so no latest-wins step is needed.
+ """
+ rows = (
+ ReviewReportArtefact.objects.for_team(team_id)
+ .filter(report_id=report_id, type=ReviewReportArtefact.ArtefactType.DROPPED_FINDING)
+ .order_by("created_at", "id")
+ )
+ dropped: list[DroppedFindingArtefact] = []
+ for row in rows:
+ try:
+ content = parse_artefact_content(row.type, row.content)
+ except ArtefactContentValidationError as e:
+ logger.warning("Skipping unparseable %s artefact %s: %s", row.type, row.id, e)
+ continue
+ if isinstance(content, DroppedFindingArtefact) and content.finding.run_index == run_index:
+ dropped.append(content)
+ return dropped
+
+
def persist_verdicts(
*, team_id: int, report_id: str, issues: list[Issue], validations: dict[str, IssueValidation], run_index: int
) -> int:
diff --git a/products/review_hog/backend/tests/test_reviews_api.py b/products/review_hog/backend/tests/test_reviews_api.py
index eb0049f4b64a..dda1c4d87b1a 100644
--- a/products/review_hog/backend/tests/test_reviews_api.py
+++ b/products/review_hog/backend/tests/test_reviews_api.py
@@ -1,5 +1,6 @@
import json
from datetime import UTC, datetime, timedelta
+from typing import get_args
import time_machine
from posthog.test.base import APIBaseTest
@@ -12,8 +13,10 @@ from social_django.models import UserSocialAuth
from posthog.models import Team, User
+from products.review_hog.backend.api.reviews import ReviewDropDisposition
from products.review_hog.backend.models import ReviewReport, ReviewReportArtefact
from products.review_hog.backend.reviewer.artefact_content import (
+ DroppedFindingArtefact,
FindingOutcomeArtefact,
ResolutionRunArtefact,
ReviewIssueFinding,
@@ -23,7 +26,13 @@ from products.review_hog.backend.reviewer.artefact_content import (
)
from products.review_hog.backend.reviewer.constants import DEFAULT_REVIEW_ARM, REVIEW_MODE_FLASH, REVIEW_MODE_FULL
from products.review_hog.backend.reviewer.models.github_meta import PRFile, PRMetadata
-from products.review_hog.backend.reviewer.models.issues_review import Issue, IssuePriority, IssuesReview, LineRange
+from products.review_hog.backend.reviewer.models.issues_review import (
+ DropDisposition,
+ Issue,
+ IssuePriority,
+ IssuesReview,
+ LineRange,
+)
from products.review_hog.backend.reviewer.models.perspective_selection import (
ChunkPerspectiveSelection,
PerspectiveSelection,
@@ -82,6 +91,10 @@ def _issues_review(count: int) -> IssuesReview:
)
+def test_drop_disposition_choices_cover_every_pipeline_disposition() -> None:
+ assert set(ReviewDropDisposition.values) == set(get_args(DropDisposition))
+
+
class TestRecentReviewsAPI(APIBaseTest):
def setUp(self) -> None:
super().setUp()
@@ -518,6 +531,85 @@ class TestRecentReviewsAPI(APIBaseTest):
assert [f["title"] for f in detail["dismissed_findings"]] == ["title 1-noise"]
assert detail["perspective_selection"] is None # no selection artefact → the drawer tab shows its empty state
+ def _dropped(
+ self,
+ report: ReviewReport,
+ title: str,
+ *,
+ run_index: int,
+ disposition: DropDisposition,
+ duplicate_of: str | None = None,
+ rank: int | None = None,
+ ) -> None:
+ ReviewReportArtefact.append_dropped_finding(
+ team_id=self.team.id,
+ report_id=str(report.id),
+ content=DroppedFindingArtefact(
+ head_sha="c",
+ finding=ReviewIssueFinding(
+ issue_key=f"{run_index}-{title}",
+ run_index=run_index,
+ title=title,
+ file="f.py",
+ lines=[LineRange(start=3, end=4)],
+ body="b",
+ suggestion="",
+ priority=IssuePriority.CONSIDER,
+ source_perspective="main",
+ ),
+ pass_number=2000,
+ chunk_id=1,
+ disposition=disposition,
+ duplicate_of=duplicate_of,
+ rank=rank,
+ cap=5,
+ lens_part_count=1,
+ ),
+ attribution=ArtefactAttribution.system(),
+ )
+
+ @parameterized.expand(
+ [
+ ("old_code", None, None, None),
+ ("dedup_prior", "1-f.py-10-main-1", None, None),
+ ("dedup_comment", "comment:42", None, "https://github.com/PostHog/posthog/pull/7#discussion_r42"),
+ ("dedup_anchor", "2-f.py-3-main-1", None, None),
+ ("dedup_sibling", "2-f.py-3-lens-1", None, None),
+ ("cap", None, 6, None),
+ ]
+ )
+ def test_retrieve_returns_the_turns_dropped_findings(
+ self,
+ disposition: DropDisposition,
+ duplicate_of: str | None,
+ rank: int | None,
+ comment_url: str | None,
+ ) -> None:
+ # Each turn shows only its own drops, and every recorded disposition must map to a served choice.
+ report = self._report(pr_number=7, acting_user=self.user, run_count=2)
+ self._dropped(report, "older drop", run_index=1, disposition="cap", rank=9)
+ self._dropped(report, "latest drop", run_index=2, disposition=disposition, duplicate_of=duplicate_of, rank=rank)
+
+ latest = self.client.get(f"{self.url}{report.id}/").json()
+ older = self.client.get(f"{self.url}{report.id}/", {"run_index": 1}).json()
+
+ assert latest["dropped_findings"] == [
+ {
+ "title": "latest drop",
+ "file": "f.py",
+ "lines": [{"start": 3, "end": 4}],
+ "body": "b",
+ "suggestion": "",
+ "priority": "consider",
+ "source_perspective": "main",
+ "disposition": disposition,
+ "duplicate_of": duplicate_of,
+ "comment_url": comment_url,
+ "rank": rank,
+ }
+ ]
+ assert [(f["title"], f["rank"]) for f in older["dropped_findings"]] == [("older drop", 9)]
+
def test_in_progress_review_surfaces_with_stage_progress(self) -> None:
# A visibly running first-turn review must appear first with a stage inferred from the
# working state (fetching → chunking → selecting → reviewing n/m → deduplicating →
diff --git a/products/review_hog/frontend/CodeReviewScene.stories.tsx b/products/review_hog/frontend/CodeReviewScene.stories.tsx
index c4ddf1467441..3148230844c3 100644
--- a/products/review_hog/frontend/CodeReviewScene.stories.tsx
+++ b/products/review_hog/frontend/CodeReviewScene.stories.tsx
@@ -25,6 +25,7 @@ import type {
PatchedReviewUserSettingsApi,
ReviewInstallationClaimScopeEnumApi,
ReviewDetailApi,
+ ReviewDroppedFindingApi,
ReviewFindingApi,
ReviewPerspectiveConfigApi,
ReviewPerspectiveStatsApi,
@@ -170,6 +171,7 @@ function reviewDetail(review: ReviewRecentReviewApi, overrides: Partial<ReviewDe
run_urgency_threshold: 'consider',
findings: [],
dismissed_findings: [],
+ dropped_findings: [],
...overrides,
}
}
@@ -260,8 +262,49 @@ const standardReviewDetail = reviewDetail(recentReviews[1], {
validator_note: SINGLE_AGENT_NOTE,
}),
],
+ dropped_findings: [
+ droppedFinding({}),
+ droppedFinding({
+ title: 'Digest email has no plain-text part',
+ file: 'posthog/templates/email/weekly_digest.html',
+ lines: [{ start: 12, end: null }],
+ body: 'Some mail clients show an empty message without a plain-text part.',
+ priority: 'consider',
+ source_perspective: 'flash-single-agent',
+ disposition: 'dedup_comment',
+ duplicate_of: 'comment:1234567',
+ comment_url: 'https://github.com/example-org/example-repo/pull/98#discussion_r1234567',
+ }),
+ droppedFinding({
+ title: 'Digest task logs the full team list',
+ lines: [{ start: 140, end: null }],
+ body: 'The log line prints every team id on each run.',
+ priority: 'consider',
+ source_perspective: 'flash-single-agent',
+ disposition: 'cap',
+ duplicate_of: null,
+ rank: 6,
+ }),
+ ],
})
+function droppedFinding(overrides: Partial<ReviewDroppedFindingApi>): ReviewDroppedFindingApi {
+ return {
+ title: 'Digest skips teams created after midnight UTC',
+ file: 'posthog/tasks/weekly_digest.py',
+ lines: [{ start: 90, end: 92 }],
+ body: 'Teams created late in the day fall outside the window. Compute the window in the team timezone.',
+ suggestion: '',
+ priority: 'should_fix',
+ source_perspective: 'flash-lens-logic-correctness',
+ disposition: 'dedup_sibling',
+ duplicate_of: '1-posthog/tasks/weekly_digest.py-88-flash-single-agent-1',
+ comment_url: null,
+ rank: null,
+ ...overrides,
+ }
+}
+
const reviewDetails: Record<string, ReviewDetailApi> = {
[deepReviewDetail.id]: deepReviewDetail,
[standardReviewDetail.id]: standardReviewDetail,
@@ -830,6 +873,16 @@ export const ReviewDrawerStandard: Story = {
},
}
+export const ReviewDrawerStandardNotPosted: Story = {
+ parameters: { review: standardReviewDetail.id },
+ play: async () => {
+ const body = within(document.body)
+ ;(await body.findByText('Not posted (3)')).click()
+ await expect(await body.findByText('Digest skips teams created after midnight UTC')).toBeVisible()
+ await expect(body.getByText('Over the limit (#6)')).toBeVisible()
+ },
+}
+
export const ReviewDrawerDeep: Story = {
parameters: { review: deepReviewDetail.id },
play: async () => {
diff --git a/products/review_hog/frontend/CodeReviewScene.tsx b/products/review_hog/frontend/CodeReviewScene.tsx
index 8d560e3139a4..0d1e413e383c 100644
--- a/products/review_hog/frontend/CodeReviewScene.tsx
+++ b/products/review_hog/frontend/CodeReviewScene.tsx
@@ -28,6 +28,9 @@ import { SceneContent } from '~/layout/scenes/components/SceneContent'
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import type {
+ ReviewDetailApi,
+ ReviewDropDispositionEnumApi,
+ ReviewDroppedFindingApi,
ReviewFindingApi,
ReviewIssuePriorityEnumApi,
ReviewRecentReviewApi,
@@ -296,10 +299,12 @@ function SingleAgentFindingsLine({ review }: { review: ReviewRecentReviewApi }):
}
/** The drawer header for a single-agent turn: how it ran, and why the posted count can be lower than the raised count. */
-function SingleAgentDrawerSummary({ review }: { review: ReviewRecentReviewApi }): JSX.Element {
+function SingleAgentDrawerSummary({ review }: { review: ReviewDetailApi }): JSX.Element {
+ const { setReviewDrawerTab } = useActions(reviewHogSettingsLogic)
const { posted, raised } = singleAgentCounts(review)
const lenses = singleAgentLensCount(review)
const dropped = raised !== null ? raised - posted : 0
+ const otherLabel = dropped === 1 ? 'The other one' : `The other ${dropped}`
return (
<div className="flex flex-col gap-1 text-sm text-secondary">
<div>
@@ -314,10 +319,15 @@ function SingleAgentDrawerSummary({ review }: { review: ReviewRecentReviewApi })
{raised !== null ? (
<>
{' '}
- of <span className="font-semibold text-default">{raised}</span> issues raised. The other{' '}
- {dropped === 1 ? 'one repeated' : `${dropped} repeated`} another finding or comment,{' '}
- {dropped === 1 ? 'was' : 'were'} on code this pull request did not change, or went over the
- per-review limit.
+ of <span className="font-semibold text-default">{raised}</span> issues raised.{' '}
+ {/* Turns that predate the dropped-finding record have nothing to switch to. */}
+ {review.dropped_findings.length ? (
+ <Link onClick={() => setReviewDrawerTab('not_posted')}>{otherLabel}</Link>
+ ) : (
+ otherLabel
+ )}{' '}
+ repeated another finding or comment, {dropped === 1 ? 'was' : 'were'} on code this pull request
+ did not change, or went over the per-review limit.
</>
) : (
` issue${posted === 1 ? '' : 's'}.`
@@ -744,9 +754,23 @@ function TriggerReviewSection(): JSX.Element {
type FindingSection = 'description' | 'suggestion' | 'validator'
-function FindingCard({ finding, dismissed }: { finding: ReviewFindingApi; dismissed?: boolean }): JSX.Element {
+/** A finding that went through the reviewer's own priority and a verdict, unlike a dropped one. */
+function isJudgedFinding(finding: ReviewFindingApi | ReviewDroppedFindingApi): finding is ReviewFindingApi {
+ return 'validator_note' in finding
+}
+
+function FindingCard({
+ finding,
+ dismissed,
+ reason,
+}: {
+ finding: ReviewFindingApi | ReviewDroppedFindingApi
+ dismissed?: boolean
+ reason?: JSX.Element
+}): JSX.Element {
const { reviewDetail } = useValues(reviewHogSettingsLogic)
- const priority = PRIORITY_TAG[finding.effective_priority]
+ const judged = isJudgedFinding(finding) ? finding : null
+ const priority = PRIORITY_TAG[isJudgedFinding(finding) ? finding.effective_priority : finding.priority]
const location = finding.lines.length
? `${finding.file}:${finding.lines.map((r) => (r.end && r.end !== r.start ? `${r.start}–${r.end}` : `${r.start}`)).join(', ')}`
: finding.file
@@ -764,16 +788,17 @@ function FindingCard({ finding, dismissed }: { finding: ReviewFindingApi; dismis
<LemonTag type={dismissed ? 'muted' : priority.type} size="small">
{priority.label}
</LemonTag>
- {finding.effective_priority !== finding.reviewer_priority && (
+ {judged && judged.effective_priority !== judged.reviewer_priority && (
<LemonTag type="muted" size="small">
- was {PRIORITY_TAG[finding.reviewer_priority].label.toLowerCase()}
+ was {PRIORITY_TAG[judged.reviewer_priority].label.toLowerCase()}
</LemonTag>
)}
- {finding.validator_category && (
+ {judged?.validator_category && (
<LemonTag type="muted" size="small">
- {prettifyCategory(finding.validator_category)}
+ {prettifyCategory(judged.validator_category)}
</LemonTag>
)}
+ {reason}
{finding.source_perspective && (
<span className="text-xs text-tertiary">{perspectiveLabel(finding.source_perspective)}</span>
)}
@@ -804,29 +829,34 @@ function FindingCard({ finding, dismissed }: { finding: ReviewFindingApi; dismis
</LemonMarkdown>
),
},
- {
- key: 'suggestion',
- header: 'Suggested fix',
- content: (
- <LemonMarkdown className="text-sm text-secondary" disableImages>
- {finding.suggestion}
- </LemonMarkdown>
- ),
- },
+ // A single-agent finding ends its description with the fix, so its suggestion is empty.
+ ...(finding.suggestion
+ ? [
+ {
+ key: 'suggestion' as const,
+ header: 'Suggested fix',
+ content: (
+ <LemonMarkdown className="text-sm text-secondary" disableImages>
+ {finding.suggestion}
+ </LemonMarkdown>
+ ),
+ },
+ ]
+ : []),
// A single-agent turn has no validator, so its note is a placeholder, not reasoning.
- ...(isSingleAgentReview(reviewDetail)
- ? []
- : [
+ ...(judged && !isSingleAgentReview(reviewDetail)
+ ? [
{
key: 'validator' as const,
header: dismissed ? 'Why it was dismissed' : "Why we think it's a valid issue",
content: (
<LemonMarkdown className="text-sm text-secondary" disableImages>
- {finding.validator_note}
+ {judged.validator_note}
</LemonMarkdown>
),
},
- ]),
+ ]
+ : []),
]}
/>
</div>
@@ -880,6 +910,69 @@ function DrawerPublishedTab(): JSX.Element {
)
}
+const DROP_REASON_LABEL: Record<ReviewDropDispositionEnumApi, string> = {
+ dedup_sibling: 'Repeat of a finding',
+ dedup_comment: 'Already in a PR comment',
+ dedup_prior: 'Repeat of an earlier review',
+ dedup_anchor: 'Same spot as another finding',
+ old_code: 'On unchanged code',
+ cap: 'Over the limit',
+}
+
+// Display order of the reasons: the label map's key order.
+const DROP_REASON_ORDER = Object.keys(DROP_REASON_LABEL) as ReviewDropDispositionEnumApi[]
+
+function DropReason({ finding }: { finding: ReviewDroppedFindingApi }): JSX.Element {
+ const label = DROP_REASON_LABEL[finding.disposition]
+ return (
+ <>
+ <LemonTag type="muted" size="small">
+ {finding.disposition === 'cap' && finding.rank ? `${label} (#${finding.rank})` : label}
+ </LemonTag>
+ {finding.comment_url && (
+ <Link to={finding.comment_url} target="_blank" targetBlankIcon className="text-xs">
+ View comment
+ </Link>
+ )}
+ </>
+ )
+}
+
+/** The "Not posted" tab for a single-agent turn: findings it raised but dropped as repeats, on unchanged code, or over the limit. */
+function DrawerNotPostedTab(): JSX.Element {
+ const { reviewDetail } = useValues(reviewHogSettingsLogic)
+
+ if (!reviewDetail) {
+ return <DrawerFindingsSkeleton />
+ }
+ if (!reviewDetail.dropped_findings.length) {
+ return (
+ <div className="text-sm text-secondary">
+ {singleAgentCounts(reviewDetail).raised !== null
+ ? "This review didn't record the issues it left out."
+ : 'This review posted every issue it raised.'}
+ </div>
+ )
+ }
+ const dropped = [...reviewDetail.dropped_findings].sort(
+ (a, b) =>
+ DROP_REASON_ORDER.indexOf(a.disposition) - DROP_REASON_ORDER.indexOf(b.disposition) ||
+ (a.rank ?? 0) - (b.rank ?? 0)
+ )
+ return (
+ <div className="flex flex-col gap-2">
+ <p className="m-0 text-xs text-secondary">
+ Raised during this review but not posted to the pull request, each with the reason.
+ </p>
+ <div className="flex flex-col divide-y divide-primary">
+ {dropped.map((finding, i) => (
+ <FindingCard key={i} finding={finding} reason={<DropReason finding={finding} />} />
+ ))}
+ </div>
+ </div>
+ )
+}
+
/** The "Below threshold" tab: findings the validator kept, but the user's urgency bar held back. */
function DrawerBelowThresholdTab(): JSX.Element {
const { reviewFindingsSplit } = useValues(reviewHogSettingsLogic)
@@ -1114,8 +1207,14 @@ function ReviewDetailDrawer(): JSX.Element {
</div>
)}
<LemonTabs<ReviewDrawerTab>
- // Standard has no Dismissed tab, so a stale selection falls back to the posted tab.
- activeKey={singleAgent && reviewDrawerTab === 'dismissed' ? 'published' : reviewDrawerTab}
+ // Standard has no Dismissed tab and Deep has no Not posted tab, so a stale selection
+ // falls back to the posted tab.
+ activeKey={
+ (singleAgent && reviewDrawerTab === 'dismissed') ||
+ (!singleAgent && reviewDrawerTab === 'not_posted')
+ ? 'published'
+ : reviewDrawerTab
+ }
onChange={setReviewDrawerTab}
tabs={[
{
@@ -1129,6 +1228,11 @@ function ReviewDetailDrawer(): JSX.Element {
}`,
content: <DrawerPublishedTab />,
},
+ singleAgent && {
+ key: 'not_posted',
+ label: `Not posted${reviewDetail ? ` (${reviewDetail.dropped_findings.length})` : ''}`,
+ content: <DrawerNotPostedTab />,
+ },
// A single-agent turn publishes at every urgency, so nothing sits below a threshold.
!singleAgent && {
key: 'below_threshold',
diff --git a/products/review_hog/frontend/generated/api.schemas.ts b/products/review_hog/frontend/generated/api.schemas.ts
index 6b69d393e2e9..024f9d2798e8 100644
--- a/products/review_hog/frontend/generated/api.schemas.ts
+++ b/products/review_hog/frontend/generated/api.schemas.ts
@@ -984,6 +984,88 @@ export interface ReviewFindingApi {
validator_note: string
}
+/**
+ * * `must_fix` - Must fix
+ * * `should_fix` - Should fix
+ * * `consider` - Consider
+ */
+export type ReviewDroppedFindingPriorityEnumApi =
+ (typeof ReviewDroppedFindingPriorityEnumApi)[keyof typeof ReviewDroppedFindingPriorityEnumApi]
+
+export const ReviewDroppedFindingPriorityEnumApi = {
+ MustFix: 'must_fix',
+ ShouldFix: 'should_fix',
+ Consider: 'consider',
+} as const
+
+/**
+ * * `old_code` - On unchanged code
+ * * `dedup_prior` - Repeat of an earlier review
+ * * `dedup_comment` - Already in a PR comment
+ * * `dedup_anchor` - Same spot as another finding
+ * * `dedup_sibling` - Repeat of a finding
+ * * `cap` - Over the limit
+ */
+export type ReviewDropDispositionEnumApi =
+ (typeof ReviewDropDispositionEnumApi)[keyof typeof ReviewDropDispositionEnumApi]
+
+export const ReviewDropDispositionEnumApi = {
+ OldCode: 'old_code',
+ DedupPrior: 'dedup_prior',
+ DedupComment: 'dedup_comment',
+ DedupAnchor: 'dedup_anchor',
+ DedupSibling: 'dedup_sibling',
+ Cap: 'cap',
+} as const
+
+export interface ReviewDroppedFindingApi {
+ /** One-line summary of the finding. */
+ title: string
+ /** Repository-relative path of the affected file. */
+ file: string
+ /** Affected line ranges within the file. */
+ lines: ReviewFindingLineRangeApi[]
+ /** Description of the problem. */
+ body: string
+ /** The specific fix the reviewer proposes. Usually empty: a single-agent finding ends its body with the fix direction instead. */
+ suggestion: string
+ /** The reviewer's priority for the finding.
+ *
+ * * `must_fix` - Must fix
+ * * `should_fix` - Should fix
+ * * `consider` - Consider */
+ priority: ReviewDroppedFindingPriorityEnumApi
+ /**
+ * The session that raised the finding: the main review or a lens.
+ * @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.
+ *
+ * * `old_code` - On unchanged code
+ * * `dedup_prior` - Repeat of an earlier review
+ * * `dedup_comment` - Already in a PR comment
+ * * `dedup_anchor` - Same spot as another finding
+ * * `dedup_sibling` - Repeat of a finding
+ * * `cap` - Over the limit */
+ disposition: ReviewDropDispositionEnumApi
+ /**
+ * For a dedup drop, what it repeats: an issue key, or `comment:<id>` for a PR comment. Null for other dispositions.
+ * @nullable
+ */
+ duplicate_of: string | null
+ /**
+ * Link to the PR comment the finding repeats, when `duplicate_of` names one and the PR URL is known. Null otherwise.
+ * @nullable
+ */
+ comment_url: string | null
+ /**
+ * For a `cap` drop, the finding's 1-based position in the turn's ranked findings. Null otherwise.
+ * @nullable
+ */
+ rank: number | null
+}
+
export interface ReviewDetailApi {
/** The review report's id, for fetching the review's detail. */
id: string
@@ -1118,6 +1200,8 @@ export interface ReviewDetailApi {
findings: ReviewFindingApi[]
/** The returned turn's findings the validator dismissed, with its reasoning. */
dismissed_findings: ReviewFindingApi[]
+ /** The returned turn's findings a single-agent (Standard) review raised but did not post, each with the reason. Empty for pipeline turns and for turns that predate the record. */
+ dropped_findings: ReviewDroppedFindingApi[]
}
export interface ReviewPerspectiveStatItemApi {
diff --git a/products/review_hog/frontend/reviewHogSettingsLogic.ts b/products/review_hog/frontend/reviewHogSettingsLogic.ts
index f4771cfa38ba..8aebe05e3a8e 100644
--- a/products/review_hog/frontend/reviewHogSettingsLogic.ts
+++ b/products/review_hog/frontend/reviewHogSettingsLogic.ts
@@ -53,7 +53,14 @@ import type { LLMSkillListApi } from 'products/skills/frontend/generated/api.sch
export type ReviewSkillKind = 'perspective' | 'blind_spots' | 'validator' | 'resolution'
-export type ReviewDrawerTab = 'published' | 'below_threshold' | 'dismissed' | 'chunks' | 'how_it_ran' | 'review'
+export type ReviewDrawerTab =
+ | 'published'
+ | 'not_posted'
+ | 'below_threshold'
+ | 'dismissed'
+ | 'chunks'
+ | 'how_it_ran'
+ | 'review'
export type CodeReviewTab = 'activity' | 'settings'
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 4f27a472cca7..27b7e3572f33 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -95458,6 +95458,88 @@ export namespace Schemas {
validator_note: string;
}
+ /**
+ * * `must_fix` - Must fix
+ * * `should_fix` - Should fix
+ * * `consider` - Consider
+ */
+ export type ReviewDroppedFindingPriorityEnum = typeof ReviewDroppedFindingPriorityEnum[keyof typeof ReviewDroppedFindingPriorityEnum];
+
+
+ export const ReviewDroppedFindingPriorityEnum = {
+ MustFix: 'must_fix',
+ ShouldFix: 'should_fix',
+ Consider: 'consider',
+ } as const;
+
+ /**
+ * * `old_code` - On unchanged code
+ * * `dedup_prior` - Repeat of an earlier review
+ * * `dedup_comment` - Already in a PR comment
+ * * `dedup_anchor` - Same spot as another finding
+ * * `dedup_sibling` - Repeat of a finding
+ * * `cap` - Over the limit
+ */
+ export type ReviewDropDispositionEnum = typeof ReviewDropDispositionEnum[keyof typeof ReviewDropDispositionEnum];
+
+
+ export const ReviewDropDispositionEnum = {
+ OldCode: 'old_code',
+ DedupPrior: 'dedup_prior',
+ DedupComment: 'dedup_comment',
+ DedupAnchor: 'dedup_anchor',
+ DedupSibling: 'dedup_sibling',
+ Cap: 'cap',
+ } as const;
+
+ export interface ReviewDroppedFinding {
+ /** One-line summary of the finding. */
+ title: string;
+ /** Repository-relative path of the affected file. */
+ file: string;
+ /** Affected line ranges within the file. */
+ lines: ReviewFindingLineRange[];
+ /** Description of the problem. */
+ body: string;
+ /** The specific fix the reviewer proposes. Usually empty: a single-agent finding ends its body with the fix direction instead. */
+ suggestion: string;
+ /** The reviewer's priority for the finding.
+ *
+ * * `must_fix` - Must fix
+ * * `should_fix` - Should fix
+ * * `consider` - Consider */
+ priority: ReviewDroppedFindingPriorityEnum;
+ /**
+ * The session that raised the finding: the main review or a lens.
+ * @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.
+ *
+ * * `old_code` - On unchanged code
+ * * `dedup_prior` - Repeat of an earlier review
+ * * `dedup_comment` - Already in a PR comment
+ * * `dedup_anchor` - Same spot as another finding
+ * * `dedup_sibling` - Repeat of a finding
+ * * `cap` - Over the limit */
+ disposition: ReviewDropDispositionEnum;
+ /**
+ * For a dedup drop, what it repeats: an issue key, or `comment:<id>` for a PR comment. Null for other dispositions.
+ * @nullable
+ */
+ duplicate_of: string | null;
+ /**
+ * Link to the PR comment the finding repeats, when `duplicate_of` names one and the PR URL is known. Null otherwise.
+ * @nullable
+ */
+ comment_url: string | null;
+ /**
+ * For a `cap` drop, the finding's 1-based position in the turn's ranked findings. Null otherwise.
+ * @nullable
+ */
+ rank: number | null;
+ }
+
export interface ReviewDetail {
/** The review report's id, for fetching the review's detail. */
id: string;
@@ -95592,6 +95674,8 @@ export namespace Schemas {
findings: ReviewFinding[];
/** The returned turn's findings the validator dismissed, with its reasoning. */
dismissed_findings: ReviewFinding[];
+ /** The returned turn's findings a single-agent (Standard) review raised but did not post, each with the reason. Empty for pipeline turns and for turns that predate the record. */
+ dropped_findings: ReviewDroppedFinding[];
}
export interface ReviewHogSettingsError {