: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(signals): add per-reviewer reason to suggested reviewers (#72125)
Andrew Maguire07a232e88c96
diff --git a/frontend/src/scenes/inbox/components/detail/SuggestedReviewersSection.tsx b/frontend/src/scenes/inbox/components/detail/SuggestedReviewersSection.tsxindex 6e84f387bbfb..dfc03932b612 100644--- a/frontend/src/scenes/inbox/components/detail/SuggestedReviewersSection.tsx+++ b/frontend/src/scenes/inbox/components/detail/SuggestedReviewersSection.tsx@@ -237,7 +237,7 @@ function ReviewerRow({onRemove: () => void}): JSX.Element {const displayName = reviewer.github_name ?? reviewer.user?.first_name ?? reviewer.github_login- const reason = reviewer.relevant_commits[0]?.reason ?? null+ const reason = reviewer.reason ?? reviewer.relevant_commits[0]?.reason ?? nullconst githubUrl = reviewer.github_login ? `https://github.com/${reviewer.github_login}` : nullconst person = (diff --git a/frontend/src/scenes/inbox/types.ts b/frontend/src/scenes/inbox/types.tsindex e2c6cfa3b12b..59b616244104 100644--- a/frontend/src/scenes/inbox/types.ts+++ b/frontend/src/scenes/inbox/types.ts@@ -32,6 +32,8 @@ export interface EnrichedReviewer {github_name: string | nullrelevant_commits: RelevantCommit[]user: SignalReviewerUserInfo | null+ /** Why this reviewer was chosen. Absent on artefacts stored before the field existed. */+ reason?: string | null}/** P0 (highest) – P4 (lowest). Mirrors desktop `SignalReportPriority`. */diff --git a/products/signals/backend/artefact_schemas.py b/products/signals/backend/artefact_schemas.pyindex 2cfa3cb83169..7e57418baeb9 100644--- a/products/signals/backend/artefact_schemas.py+++ b/products/signals/backend/artefact_schemas.py@@ -186,6 +186,10 @@ class SuggestedReviewerEntry(BaseModel):default_factory=list,description="Commit evidence explaining why this reviewer is relevant.",)+ reason: str | None = Field(+ default=None,+ description="Why this reviewer was chosen — the evidence behind the routing (e.g. recent author on the affected surface, human correction precedent).",+ )@field_validator("github_login")@classmethoddiff --git a/products/signals/backend/auto_start.py b/products/signals/backend/auto_start.pyindex cfc5d02f25e7..f2e2ef564319 100644--- a/products/signals/backend/auto_start.py+++ b/products/signals/backend/auto_start.py@@ -53,6 +53,7 @@ class ReviewerContent(TypedDict):github_login: strgithub_name: str | Nonerelevant_commits: list[dict]+ reason: str | None_PRIORITY_RANK: dict[Priority, int] = {@@ -581,6 +582,7 @@ async def _latest_reviewers_content(report_id: str) -> tuple[list[ReviewerContengithub_login=str(entry["github_login"]),github_name=entry.get("github_name"),relevant_commits=entry.get("relevant_commits") or [],+ reason=entry.get("reason"),))return reviewers, editor_user_iddiff --git a/products/signals/backend/contracts.py b/products/signals/backend/contracts.pyindex 023bc5ba04ab..5e3ffeceb1c0 100644--- a/products/signals/backend/contracts.py+++ b/products/signals/backend/contracts.py@@ -426,6 +426,7 @@ class EnrichedReviewer(ContractModel):github_name: str | Nonerelevant_commits: list[RelevantCommit]user: SignalReviewerUserInfo | None+ reason: str | None = None# ── Union over all signal variants ──────────────────────────────────────────────diff --git a/products/signals/backend/management/commands/seed_inbox_data.py b/products/signals/backend/management/commands/seed_inbox_data.pyindex 0252c06f243e..1b61b1f710d2 100644--- a/products/signals/backend/management/commands/seed_inbox_data.py+++ b/products/signals/backend/management/commands/seed_inbox_data.py@@ -249,6 +249,8 @@ class Command(BaseCommand):url=f"https://github.com/{repository}/commit/{(index + i + 1) * 2468013:07x}",)],+ # Alternate so both the reason and no-reason render paths get exercised locally.+ reason="Top recent author on the affected surface." if i % 2 == 0 else None,)for i in range(reviewer_count)]diff --git a/products/signals/backend/scout_harness/prompt.py b/products/signals/backend/scout_harness/prompt.pyindex 2655223008b7..f24ca82a02b1 100644--- a/products/signals/backend/scout_harness/prompt.py+++ b/products/signals/backend/scout_harness/prompt.py@@ -185,11 +185,13 @@ Treat it as an **index into the inbox, never a copy of the report**:_SUGGESTED_REVIEWERS_REPORT = """# Suggested reviewers route the report-This is the single highest-leverage field you set. `suggested_reviewers` (a list of reviewer **objects**, each `{github_login}` and/or `{user_uuid}` — never a bare string) is what actually **routes** a report to the people who can act on it — and, paired with `priority` + `repository`, is what lets an immediately-actionable report open a draft PR automatically (autostart). A report with no suggested reviewers still surfaces in the inbox, but it routes to no one, so it tends to sit unactioned.+This is the single highest-leverage field you set. `suggested_reviewers` (a list of reviewer **objects**, each `{github_login}` and/or `{user_uuid}`, plus an optional `reason` — never a bare string) is what actually **routes** a report to the people who can act on it — and, paired with `priority` + `repository`, is what lets an immediately-actionable report open a draft PR automatically (autostart). A report with no suggested reviewers still surfaces in the inbox, but it routes to no one, so it tends to sit unactioned.- **Always try to set `suggested_reviewers`.** Spend real effort identifying who owns the affected area — lean on the evidence you already gathered (code owners, recent authors on the relevant surface, the team that owns the product) to name the right owner. Each reviewer is an object, identifiable two ways: by `github_login` (a bare lowercase login — `{github_login: "octocat"}`, no `@`, no display name), or — when your evidence already names a PostHog user (an account owner, an entity's creator) — by `user_uuid` (`{user_uuid: "..."}`), which the server resolves to their linked GitHub login for you. Treat "I couldn't find an owner" as a last resort, not a default.+- **Set `reason` on every reviewer you name.** One sentence of the concrete evidence tying this person to the affected surface ("created the affected dashboard", "human correction on the prior tracing report routed to them"). It is persisted on the report, so humans — and future runs — can tell an evidence-backed route from a guess without replaying your transcript. A reviewer you can't write a reason for is a reviewer you haven't verified.- **Don't guess a `github_login`.** The inbox routes by matching it exactly, so a guessed, mis-cased, or display-name handle reaches no one. When you only know the owner as a PostHog member, pass their `user_uuid` and let the server resolve it rather than inventing a handle.- **Check for human corrections first.** When humans edit a report's reviewers in the inbox, the change is recorded with before/after login lists — the project profile's `recent_reviewer_corrections` section carries the recent ones. A human swapping a suggested reviewer for someone else is the strongest ownership evidence there is: treat it as authoritative precedent over commit history, and fold what you learn into your `reviewer:` memory keys. For history beyond the profile window, query `advanced-activity-logs-list` with `scopes=["SignalReport"]`, `activities=["suggested_reviewers_changed"]` (on an org without the audit-logs feature that call fails with a payment-required error — skip it and move on, don't retry).+- **Weigh precedent by its evidence, not its existence.** A comparable report's reviewer entries (via `inbox-report-artefacts-list`) or your own `reviewer:` memory are strong precedent when the entries carry `relevant_commits` (commit-authorship-derived), a concrete `reason`, or a human correction behind them. Entries with none of those are an earlier run's unexplained guess — and precedent is self-reinforcing: every blind reuse becomes the next run's precedent, compounding a mis-route indefinitely. Before reusing evidence-free precedent, try to corroborate ownership from what you gathered this run (an entity's `created_by`, the owning team, recent authors named in the data); if you reuse it anyway, say so in `reason` ("inherited from report X, unverified") rather than presenting it as established ownership.- **No owner in your evidence? List the members.** When the owner isn't already named in what you gathered, call `scout-members-list` to get this project's members — each row carries the member's `email`, name, and resolved `github_login` (pass `search` to narrow a big project). Match the owner by email/name and use their `github_login`; a member whose `github_login` is null can't be routed to at all, so pick a different owner or leave the field empty. The org-scoped `org-member-get-github-login` / `org-members-list` tools are not available in a scout run — this is the in-run lookup path.- **Set `priority` + `priority_explanation`** when the issue is concrete and you can justify the urgency — autostart needs a priority to consider a draft PR.- **Set `repository`** (`owner/repo`) when you know where a fix would land — pass it explicitly rather than leaving it to slower free-form selection. Pass the `NO_REPO` sentinel for a report with no code fix.diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.pyindex 69be3b1cbd8e..0bcdda43db1a 100644--- a/products/signals/backend/scout_harness/serializers.py+++ b/products/signals/backend/scout_harness/serializers.py@@ -648,6 +648,20 @@ class SuggestedReviewerSerializer(serializers.Serializer):),)+ reason = serializers.CharField(+ required=False,+ allow_null=True,+ allow_blank=True,+ max_length=500,+ help_text=(+ "One sentence of evidence for WHY this person: what ties them to the affected surface "+ "(e.g. 'authored 4 of the last 10 commits touching products/tracing/mcp/', 'human "+ "correction routed the prior tracing report to them'). Persisted on the report so the "+ "routing is auditable — always set it when you can name the evidence; 'precedent' alone "+ "is weak, prefer code-derived ownership."+ ),+ )+def validate(self, attrs: dict) -> dict:if not attrs.get("github_login") and not attrs.get("user_uuid"):raise serializers.ValidationError("Each reviewer must include `github_login` or `user_uuid` (or both).")diff --git a/products/signals/backend/scout_harness/tools/report.py b/products/signals/backend/scout_harness/tools/report.pyindex 28cb024e356a..db4d90bbde08 100644--- a/products/signals/backend/scout_harness/tools/report.py+++ b/products/signals/backend/scout_harness/tools/report.py@@ -102,10 +102,14 @@ class ReviewerInput:Mirrors the inbox `SuggestedReviewerEntryWriteSerializer`: at least one of the two must be set. A`user_uuid` is resolved server-side to the org member's linked GitHub login (and wins over asupplied `github_login` when both are given), so a scout that only knows a PostHog user — e.g.- routing a report to an account owner — can route it without first looking up the handle."""+ routing a report to an account owner — can route it without first looking up the handle.+ `reason` is the evidence behind the pick (recent author on the affected surface, human+ correction, …), persisted on the artefact so the routing is auditable without the run+ transcript."""github_login: str | None = Noneuser_uuid: str | None = None+ reason: str | None = None@dataclass(frozen=True)@@ -269,7 +273,7 @@ def _build_suggested_reviewers(team_id: int, reviewers: list[ReviewerInput] | Nouuids_to_resolve = [str(entry.user_uuid) for entry in reviewers if entry.user_uuid]uuid_to_login = get_org_member_github_logins_by_user_uuid(team_id, uuids_to_resolve) if uuids_to_resolve else {}- logins: list[str] = []+ entries: list[SuggestedReviewerEntry] = []seen: set[str] = set()for entry in reviewers:if entry.user_uuid:@@ -286,11 +290,12 @@ def _build_suggested_reviewers(team_id: int, reviewers: list[ReviewerInput] | Noif login in seen:continueseen.add(login)- logins.append(login)+ reason = entry.reason.strip() if entry.reason and entry.reason.strip() else None+ entries.append(SuggestedReviewerEntry(github_login=login, reason=reason))- if not logins:+ if not entries:return None- return SuggestedReviewers(root=[SuggestedReviewerEntry(github_login=login) for login in logins])+ return SuggestedReviewers(root=entries)def _wants_repo_selection(diff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.pyindex ddd5a8ce905a..71af4eec13f1 100644--- a/products/signals/backend/scout_harness/views.py+++ b/products/signals/backend/scout_harness/views.py@@ -298,6 +298,7 @@ def _to_reviewer_inputs(entries: list[dict] | None) -> list[ReviewerInput] | NonReviewerInput(github_login=entry.get("github_login"),user_uuid=str(entry["user_uuid"]) if entry.get("user_uuid") else None,+ reason=entry.get("reason") or None,)for entry in entries]diff --git a/products/signals/backend/scout_report/persistence.py b/products/signals/backend/scout_report/persistence.pyindex 6c5254aacb23..f0d8546d2aa7 100644--- a/products/signals/backend/scout_report/persistence.py+++ b/products/signals/backend/scout_report/persistence.py@@ -23,6 +23,7 @@ test loop) must tolerate this lag.from __future__ import annotations+import jsonimport uuidimport loggingfrom collections.abc import Sequence@@ -32,6 +33,8 @@ from datetime import datetimefrom django.db import transactionfrom django.utils import timezone+from pydantic import ValidationError+from posthog.schema import EmbeddingModelNamefrom posthog.api.embedding_worker import emit_embedding_request@@ -43,6 +46,7 @@ from products.signals.backend.artefact_schemas import (NoteArtefact,PriorityAssessment,SafetyJudgment,+ SuggestedReviewerEntry,SuggestedReviewers,TaskRunArtefact,)@@ -331,6 +335,53 @@ def append_report_note(return report_id+def _merge_forward_reviewer_evidence(*, report_id: str, suggested_reviewers: SuggestedReviewers) -> SuggestedReviewers:+ """Carry evidence from the report's current reviewer list onto a scout-supplied replacement.++ For each supplied login that is already on the latest `suggested_reviewers` artefact, keep the+ prior `relevant_commits` and `github_name`, and keep the prior `reason` unless the scout supplied+ one (an explicit new reason wins; a scout cannot clear a reason). Unparseable prior entries are+ ignored — the supplied entry stands as-is."""+ current = (+ SignalReportArtefact.objects.filter(+ report_id=report_id, type=SignalReportArtefact.ArtefactType.SUGGESTED_REVIEWERS+ )+ .order_by("-created_at")+ .first()+ )+ if current is None:+ return suggested_reviewers+ try:+ prior_content = json.loads(current.content)+ except (json.JSONDecodeError, ValueError):+ return suggested_reviewers+ if not isinstance(prior_content, list):+ return suggested_reviewers+ prior_by_login: dict[str, dict] = {}+ for prior in prior_content:+ if isinstance(prior, dict) and isinstance(prior.get("github_login"), str):+ prior_by_login[prior["github_login"].strip().lower()] = prior++ merged: list[SuggestedReviewerEntry] = []+ for entry in suggested_reviewers.root:+ prior = prior_by_login.get(entry.github_login)+ if prior is None:+ merged.append(entry)+ continue+ candidate = {+ "github_login": entry.github_login,+ "github_name": entry.github_name if entry.github_name is not None else prior.get("github_name"),+ "relevant_commits": entry.relevant_commits or prior.get("relevant_commits") or [],+ "reason": entry.reason if entry.reason is not None else prior.get("reason"),+ }+ try:+ merged.append(SuggestedReviewerEntry.model_validate(candidate))+ except ValidationError:+ # Malformed prior evidence (e.g. hand-crafted commits) must not fail the edit.+ merged.append(entry)+ return SuggestedReviewers(root=merged)++def set_scout_report_reviewers(*,team_id: int,@@ -351,19 +402,26 @@ def set_scout_report_reviewers((`_do_edit_report`) fires `maybe_autostart_from_report_artefacts` after this returns — never in-txn,since it spawns a Task — mirroring `create_scout_report`. Autostart is idempotent, so re-running itfor an already-started report no-ops, while a report that lacked a qualifying reviewer can now open a- draft PR."""+ draft PR.++ Evidence merges forward: a scout can only supply `github_login`/`user_uuid` (+ `reason`), so for+ logins already on the report's current reviewer list, the prior entry's `relevant_commits`,+ `github_name`, and (when the scout supplies none) `reason` are carried over — mirroring the inbox+ PUT. Without this, a reason-only re-route would wipe the commit evidence precedent-weighing runs on."""_validate_report_id(report_id)if len(suggested_reviewers.root) == 0:return Falselogins = [entry.github_login for entry in suggested_reviewers.root]with transaction.atomic():- # Existence is the team-scoped gate; the artefact append itself is keyed by report_id.- if not SignalReport.objects.filter(team_id=team_id, id=report_id).exists():+ # The lock is the team-scoped gate AND serializes the read-merge-append against concurrent+ # reviewer edits (same discipline as the inbox PUT) so an interleaved write isn't lost.+ if not SignalReport.objects.select_for_update().filter(team_id=team_id, id=report_id).exists():raise InvalidScoutReportError(f"report {report_id} not found for team {team_id}")+ merged = _merge_forward_reviewer_evidence(report_id=report_id, suggested_reviewers=suggested_reviewers)SignalReportArtefact.append_status(team_id=team_id,report_id=report_id,- content=suggested_reviewers,+ content=merged,attribution=attribution,reevaluate_autostart=False,)diff --git a/products/signals/backend/serializers.py b/products/signals/backend/serializers.pyindex b57219307f1c..0b7e0d06e3be 100644--- a/products/signals/backend/serializers.py+++ b/products/signals/backend/serializers.py@@ -707,6 +707,16 @@ class SuggestedReviewerEntryWriteSerializer(serializers.Serializer):max_length=200,help_text="Optional human-readable display name. Not backfilled from GitHub by the server.",)+ reason = serializers.CharField(+ required=False,+ allow_blank=True,+ allow_null=True,+ max_length=500,+ help_text=(+ "Optional short evidence for why this reviewer was chosen. Omitted entries keep the "+ "prior reason for reviewers already on the report."+ ),+ )def validate(self, attrs: dict) -> dict:if not attrs.get("github_login") and not attrs.get("user_uuid"):diff --git a/products/signals/backend/temporal/agentic/report.py b/products/signals/backend/temporal/agentic/report.pyindex 154bb974d409..fa454073b9f4 100644--- a/products/signals/backend/temporal/agentic/report.py+++ b/products/signals/backend/temporal/agentic/report.py@@ -225,6 +225,7 @@ def _build_reviewers_content(github_login=reviewer.login.lower(),github_name=reviewer.name,relevant_commits=[dict(commit.model_dump()) for commit in reviewer.commits],+ reason=None,))return reviewers_contentdiff --git a/products/signals/backend/test/test_auto_start.py b/products/signals/backend/test/test_auto_start.pyindex 6be4e4e2b05a..f50515d40ea2 100644--- a/products/signals/backend/test/test_auto_start.py+++ b/products/signals/backend/test/test_auto_start.py@@ -63,7 +63,7 @@ def _create_org_member_with_github(email: str, organization: Organization, logindef _reviewer(login: str) -> ReviewerContent:- return ReviewerContent(github_login=login, github_name=None, relevant_commits=[])+ return ReviewerContent(github_login=login, github_name=None, relevant_commits=[], reason=None)@pytest.mark.django_dbdiff --git a/products/signals/backend/test/test_scout_report_api.py b/products/signals/backend/test/test_scout_report_api.pyindex b61e2bfea6cc..3cd976b22273 100644--- a/products/signals/backend/test/test_scout_report_api.py+++ b/products/signals/backend/test/test_scout_report_api.py@@ -1,3 +1,4 @@+import jsonfrom uuid import uuid4import pytest@@ -14,8 +15,8 @@ from social_django.models import UserSocialAuthfrom posthog.models import Organization, Team, Userfrom posthog.models.organization import OrganizationMembership-from products.signals.backend.artefact_schemas import TaskRunArtefact-from products.signals.backend.models import SignalReport, SignalReportArtefact, SignalSourceConfig+from products.signals.backend.artefact_schemas import SuggestedReviewers, TaskRunArtefact+from products.signals.backend.models import ArtefactAttribution, SignalReport, SignalReportArtefact, SignalSourceConfigfrom products.signals.backend.scout_harness.tools.report import (MAX_SUGGESTED_REVIEWERS,REPORT_KIND_FINDING,@@ -293,6 +294,45 @@ class TestScoutReportAPI(APIBaseTest):run.refresh_from_db()assert run.edited_report_ids == [report_id]+ def test_edit_report_reason_only_reroute_keeps_commit_evidence(self) -> None:+ # A scout re-route rebuilds entries from logins, so without merge-forward a reason-only edit+ # would wipe the pipeline-derived relevant_commits (and prior name) the precedent-weighing+ # guidance runs on. Kept logins must keep their evidence; new logins start clean.+ run = _make_run(self.team)+ with _safe_judge(), patch(EMBED_PATH), patch(AUTOSTART_PATH, new=AsyncMock()):+ created = self.client.post(self._emit_url(str(run.id)), data=self._payload(), format="json").json()+ report_id = created["report_id"]+ commit = {"sha": "abc123f", "url": "https://example.com/c/abc123f", "reason": "touched the hot path"}+ SignalReportArtefact.append_status(+ team_id=self.team.id,+ report_id=report_id,+ content=SuggestedReviewers.model_validate(+ [{"github_login": "alice", "github_name": "Alice A.", "relevant_commits": [commit]}]+ ),+ attribution=ArtefactAttribution.system(),+ reevaluate_autostart=False,+ )+ with patch(AUTOSTART_PATH, new=AsyncMock()):+ response = self.client.post(+ self._edit_url(str(run.id)),+ data={+ "report_id": report_id,+ "suggested_reviewers": [+ {"github_login": "alice", "reason": "confirmed owner via human correction"},+ {"github_login": "dave"},+ ],+ },+ format="json",+ )+ assert response.status_code == status.HTTP_200_OK, response.json()+ artefact = self._latest_artefact(report_id, SignalReportArtefact.ArtefactType.SUGGESTED_REVIEWERS)+ assert artefact is not None+ stored = {entry["github_login"]: entry for entry in json.loads(artefact.content)}+ assert stored["alice"]["relevant_commits"] == [commit]+ assert stored["alice"]["github_name"] == "Alice A."+ assert stored["alice"]["reason"] == "confirmed owner via human correction"+ assert stored["dave"]["relevant_commits"] == []+def test_edit_report_unresolvable_reviewer_does_not_partially_mutate(self) -> None:# A combined edit (title + a bad reviewer) must fail atomically: reviewers resolve before any# write, so an unresolvable user_uuid 400s without the title change leaking through.@@ -523,6 +563,22 @@ class TestBuildSuggestedReviewers(APIBaseTest):assert result is not Noneassert [e.github_login for e in result.root] == ["octocat"]+ def test_reason_persists_on_resolved_entries(self) -> None:+ # The resolver rebuilds entries from resolved logins — a refactor that drops `reason` there+ # silently reverts reviewer routing to unexplained picks. Whitespace-only normalizes to None.+ result = _build_suggested_reviewers(+ self.team.id,+ [+ ReviewerInput(github_login="alice", reason="Top recent author on the affected surface"),+ ReviewerInput(github_login="bob", reason=" "),+ ],+ )+ assert result is not None+ assert [(e.github_login, e.reason) for e in result.root] == [+ ("alice", "Top recent author on the affected surface"),+ ("bob", None),+ ]+def test_resolves_user_uuid_to_linked_login(self) -> None:member = self._github_member("ghhandle")result = _build_suggested_reviewers(self.team.id, [ReviewerInput(user_uuid=str(member.uuid))])diff --git a/products/signals/backend/test/test_signal_report_artefact_api.py b/products/signals/backend/test/test_signal_report_artefact_api.pyindex e97c2f7b98c4..3d667d1acfae 100644--- a/products/signals/backend/test/test_signal_report_artefact_api.py+++ b/products/signals/backend/test/test_signal_report_artefact_api.py@@ -305,6 +305,7 @@ class TestSignalReportArtefactViewSet(APIBaseTest):"github_login": "alice","github_name": "Alice A.","relevant_commits": [{"sha": "abc123", "url": "u", "reason": "r"}],+ "reason": "Top recent author on the affected surface",},{"github_login": "bob",@@ -314,10 +315,12 @@ class TestSignalReportArtefactViewSet(APIBaseTest):],)- # Keep alice (existing commits should survive), add a new reviewer dave (commits empty).+ # Keep alice (existing commits + reason should survive), add dave (explicit reason honoured).response = self.client.put(self._detail_url(str(report.id), str(artefact.id)),- data=json.dumps({"content": [{"github_login": "alice"}, {"github_login": "dave"}]}),+ data=json.dumps(+ {"content": [{"github_login": "alice"}, {"github_login": "dave", "reason": "Owns this area"}]}+ ),content_type="application/json",)assert response.status_code == status.HTTP_200_OK@@ -325,7 +328,9 @@ class TestSignalReportArtefactViewSet(APIBaseTest):stored = {r["github_login"]: r for r in self._latest_reviewers(report)}assert stored["alice"]["relevant_commits"] == [{"sha": "abc123", "url": "u", "reason": "r"}]assert stored["alice"]["github_name"] == "Alice A." # carried over from prior+ assert stored["alice"]["reason"] == "Top recent author on the affected surface" # carried over from priorassert stored["dave"]["relevant_commits"] == []+ assert stored["dave"]["reason"] == "Owns this area"assert "bob" not in storeddef test_put_resolves_user_uuid_to_github_login(self):diff --git a/products/signals/backend/views.py b/products/signals/backend/views.pyindex 77390c920f4d..a4d6540bea9e 100644--- a/products/signals/backend/views.py+++ b/products/signals/backend/views.py@@ -2075,10 +2075,10 @@ class SignalReportArtefactViewSet(# Resolve canonical login per entry. Fail loudly if a user_uuid does not# map to an org member with a GitHub identity on this team.- # The third tuple element distinguishes "github_name explicitly supplied+ # The bool tuple elements distinguish "github_name / reason explicitly supplied# (incl. empty string to clear)" from "field absent" — the merge step below- # only falls back to the prior name when the field is absent.- resolved_entries: list[tuple[str, str | None, bool]] = []+ # only falls back to the prior value when the field is absent.+ resolved_entries: list[tuple[str, str | None, bool, str | None, bool]] = []for idx, entry in enumerate(entries):user_uuid = entry.get("user_uuid")if user_uuid is not None:@@ -2105,7 +2105,9 @@ class SignalReportArtefactViewSet(explicit_name = "github_name" in entrygithub_name = entry.get("github_name") if explicit_name else None- resolved_entries.append((login_lc, github_name, explicit_name))+ explicit_reason = "reason" in entry+ reason = entry.get("reason") if explicit_reason else None+ resolved_entries.append((login_lc, github_name, explicit_name, reason, explicit_reason))# Lock the report for the read-merge-append so concurrent reviewer edits serialize — each# PUT reads the current (latest) reviewers and appends a new row, so without the lock two@@ -2132,6 +2134,7 @@ class SignalReportArtefactViewSet(prior_content = []prior_commits_by_login: dict[str, list] = {}prior_name_by_login: dict[str, str | None] = {}+ prior_reason_by_login: dict[str, str | None] = {}prior_logins: list[str] = []if isinstance(prior_content, list):for prior in prior_content:@@ -2147,21 +2150,27 @@ class SignalReportArtefactViewSet(prior_name = prior.get("github_name")if isinstance(prior_name, str):prior_name_by_login[login] = prior_name+ prior_reason = prior.get("reason")+ if isinstance(prior_reason, str):+ prior_reason_by_login[login] = prior_reason# Dedupe by canonical login, preserve first-seen order.new_content: list[dict] = []- for login_lc, github_name, explicit_name in resolved_entries:+ for login_lc, github_name, explicit_name, reason, explicit_reason in resolved_entries:if login_lc in seen:continueseen.add(login_lc)# If the client supplied github_name (incl. ""), honour it. Otherwise# carry over the prior one so kept reviewers don't lose their name.+ # Same rule for reason.effective_name = github_name if explicit_name else prior_name_by_login.get(login_lc)+ effective_reason = reason if explicit_reason else prior_reason_by_login.get(login_lc)new_content.append({"github_login": login_lc,"github_name": effective_name,"relevant_commits": prior_commits_by_login.get(login_lc, []),+ "reason": effective_reason or None,})diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex 3fc2795c471c..e909ab4726f9 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -1944,6 +1944,12 @@ export interface SuggestedReviewerApi {github_login?: string/** PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Resolved server-side to the member's linked GitHub login — use this when you know the PostHog user but not their GitHub handle. Must be a concrete UUID; the `@me` alias is not valid here. */user_uuid?: string+ /**+ * One sentence of evidence for WHY this person: what ties them to the affected surface (e.g. 'authored 4 of the last 10 commits touching products/tracing/mcp/', 'human correction routed the prior tracing report to them'). Persisted on the report so the routing is auditable — always set it when you can name the evidence; 'precedent' alone is weak, prefer code-derived ownership.+ * @maxLength 500+ * @nullable+ */+ reason?: string | null}/**diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.tsindex c3075354c3e2..1328460c740a 100644--- a/products/signals/frontend/generated/api.zod.ts+++ b/products/signals/frontend/generated/api.zod.ts@@ -300,6 +300,8 @@ export const signalsScoutEditReportBodyTitleMax = 300export const signalsScoutEditReportBodySuggestedReviewersItemGithubLoginMax = 200+export const signalsScoutEditReportBodySuggestedReviewersItemReasonMax = 500+export const signalsScoutEditReportBodySuggestedReviewersMax = 10export const SignalsScoutEditReportBody = /* @__PURE__ */ zod@@ -339,6 +341,13 @@ export const SignalsScoutEditReportBody = /* @__PURE__ */ zod.describe("PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Resolved server-side to the member's linked GitHub login — use this when you know the PostHog user but not their GitHub handle. Must be a concrete UUID; the `@me` alias is not valid here."),+ reason: zod+ .string()+ .max(signalsScoutEditReportBodySuggestedReviewersItemReasonMax)+ .nullish()+ .describe(+ "One sentence of evidence for WHY this person: what ties them to the affected surface (e.g. 'authored 4 of the last 10 commits touching products\/tracing\/mcp\/', 'human correction routed the prior tracing report to them'). Persisted on the report so the routing is auditable — always set it when you can name the evidence; 'precedent' alone is weak, prefer code-derived ownership."+ ),}).describe("One suggested reviewer — identified by `github_login`, `user_uuid`, or both.\n\nThe server canonicalizes each entry to a lowercased GitHub login: a `user_uuid` is resolved to the\norg member's linked GitHub login (and wins over a supplied `github_login` when both are given). A\n`user_uuid` that isn't an org member of this team with a linked GitHub identity is rejected — so a\nreviewer is never silently dropped."@@ -365,6 +374,8 @@ export const signalsScoutEmitReportBodyEvidenceItemWeightMin = 0export const signalsScoutEmitReportBodyAlreadyAddressedDefault = falseexport const signalsScoutEmitReportBodySuggestedReviewersItemGithubLoginMax = 200+export const signalsScoutEmitReportBodySuggestedReviewersItemReasonMax = 500+export const signalsScoutEmitReportBodySuggestedReviewersMax = 10export const SignalsScoutEmitReportBody = /* @__PURE__ */ zod@@ -457,6 +468,13 @@ export const SignalsScoutEmitReportBody = /* @__PURE__ */ zod.describe("PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Resolved server-side to the member's linked GitHub login — use this when you know the PostHog user but not their GitHub handle. Must be a concrete UUID; the `@me` alias is not valid here."),+ reason: zod+ .string()+ .max(signalsScoutEmitReportBodySuggestedReviewersItemReasonMax)+ .nullish()+ .describe(+ "One sentence of evidence for WHY this person: what ties them to the affected surface (e.g. 'authored 4 of the last 10 commits touching products\/tracing\/mcp\/', 'human correction routed the prior tracing report to them'). Persisted on the report so the routing is auditable — always set it when you can name the evidence; 'precedent' alone is weak, prefer code-derived ownership."+ ),}).describe("One suggested reviewer — identified by `github_login`, `user_uuid`, or both.\n\nThe server canonicalizes each entry to a lowercased GitHub login: a `user_uuid` is resolved to the\norg member's linked GitHub login (and wins over a supplied `github_login` when both are given). A\n`user_uuid` that isn't an org member of this team with a linked GitHub identity is rejected — so a\nreviewer is never silently dropped."diff --git a/products/signals/skills/signals-scout-mcp-tool-calls/SKILL.md b/products/signals/skills/signals-scout-mcp-tool-calls/SKILL.mdindex 54338f8fcaf1..87142688f479 100644--- a/products/signals/skills/signals-scout-mcp-tool-calls/SKILL.md+++ b/products/signals/skills/signals-scout-mcp-tool-calls/SKILL.md@@ -123,7 +123,7 @@ Encode the scope in the key prefix so future runs find it with one `text=mcp` se- key `dedupe:mcp_analytics:category:<category>` — _"Filed report on the data-warehouse category 2026-07-09 (4 tools: view-create 41%, view-update 39%, …). Skip unless the tool set or shapes change."_ One stable key per category — update it in place, don't mint a dated variant.- key `addressed:mcp_analytics:<tool>` — _"<tool> 5xx fixed 2026-06-30; back to baseline."_- key `report:mcp_analytics:category:<category>` — _"Report `019f0a96-…` covers the insights category's problem tools (query-run, list-insights). Edit it (append_note fresh numbers / newly-problematic tools) while the category still has problem tools and the report is live; if it was resolved and the category later regresses, that's a fresh report."_-- key `reviewer:mcp_analytics:<category>` — _"insights MCP tools routed to `alice` (GitHub login, from members-list) — reuse without re-resolving."_+- key `reviewer:mcp_analytics:<category>` — _"insights MCP tools routed to `alice` (owns the insights MCP surface per human correction on report `019f…`) — reuse while that evidence stands."_ Record the **evidence**, not just the login: a memory that says only "routed to alice" is indistinguishable from a guess, and blind reuse compounds a mis-route across every future run. Set the same evidence as the reviewer's `reason` when you author.## Decidediff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 0e54d7229c32..c70e2c791928 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -21035,6 +21035,12 @@ export namespace Schemas {github_login?: string;/** PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Resolved server-side to the member's linked GitHub login — use this when you know the PostHog user but not their GitHub handle. Must be a concrete UUID; the `@me` alias is not valid here. */user_uuid?: string;+ /**+ * One sentence of evidence for WHY this person: what ties them to the affected surface (e.g. 'authored 4 of the last 10 commits touching products/tracing/mcp/', 'human correction routed the prior tracing report to them'). Persisted on the report so the routing is auditable — always set it when you can name the evidence; 'precedent' alone is weak, prefer code-derived ownership.+ * @maxLength 500+ * @nullable+ */+ reason?: string | null;}/**diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex 8f6ae2661a10..0f2202f82ffb 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -645,6 +645,8 @@ export const signalsScoutEditReportBodyTitleMax = 300export const signalsScoutEditReportBodySuggestedReviewersItemGithubLoginMax = 200+export const signalsScoutEditReportBodySuggestedReviewersItemReasonMax = 500+export const signalsScoutEditReportBodySuggestedReviewersMax = 10export const SignalsScoutEditReportBody = /* @__PURE__ */ zod@@ -684,6 +686,13 @@ export const SignalsScoutEditReportBody = /* @__PURE__ */ zod.describe("PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Resolved server-side to the member's linked GitHub login — use this when you know the PostHog user but not their GitHub handle. Must be a concrete UUID; the `@me` alias is not valid here."),+ reason: zod+ .string()+ .max(signalsScoutEditReportBodySuggestedReviewersItemReasonMax)+ .nullish()+ .describe(+ "One sentence of evidence for WHY this person: what ties them to the affected surface (e.g. 'authored 4 of the last 10 commits touching products/tracing/mcp/', 'human correction routed the prior tracing report to them'). Persisted on the report so the routing is auditable — always set it when you can name the evidence; 'precedent' alone is weak, prefer code-derived ownership."+ ),}).describe("One suggested reviewer — identified by `github_login`, `user_uuid`, or both.\n\nThe server canonicalizes each entry to a lowercased GitHub login: a `user_uuid` is resolved to the\norg member's linked GitHub login (and wins over a supplied `github_login` when both are given). A\n`user_uuid` that isn't an org member of this team with a linked GitHub identity is rejected — so a\nreviewer is never silently dropped."@@ -745,6 +754,8 @@ export const signalsScoutEmitReportBodyEvidenceItemWeightMin = 0export const signalsScoutEmitReportBodyAlreadyAddressedDefault = falseexport const signalsScoutEmitReportBodySuggestedReviewersItemGithubLoginMax = 200+export const signalsScoutEmitReportBodySuggestedReviewersItemReasonMax = 500+export const signalsScoutEmitReportBodySuggestedReviewersMax = 10export const SignalsScoutEmitReportBody = /* @__PURE__ */ zod@@ -837,6 +848,13 @@ export const SignalsScoutEmitReportBody = /* @__PURE__ */ zod.describe("PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Resolved server-side to the member's linked GitHub login — use this when you know the PostHog user but not their GitHub handle. Must be a concrete UUID; the `@me` alias is not valid here."),+ reason: zod+ .string()+ .max(signalsScoutEmitReportBodySuggestedReviewersItemReasonMax)+ .nullish()+ .describe(+ "One sentence of evidence for WHY this person: what ties them to the affected surface (e.g. 'authored 4 of the last 10 commits touching products/tracing/mcp/', 'human correction routed the prior tracing report to them'). Persisted on the report so the routing is auditable — always set it when you can name the evidence; 'precedent' alone is weak, prefer code-derived ownership."+ ),}).describe("One suggested reviewer — identified by `github_login`, `user_uuid`, or both.\n\nThe server canonicalizes each entry to a lowercased GitHub login: a `user_uuid` is resolved to the\norg member's linked GitHub login (and wins over a supplied `github_login` when both are given). A\n`user_uuid` that isn't an org member of this team with a linked GitHub identity is rejected — so a\nreviewer is never silently dropped."diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-edit-report.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-edit-report.jsonindex 13e11593f001..5f9e24714533 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-edit-report.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-edit-report.json@@ -30,6 +30,18 @@"maxLength": 200,"type": "string"},+ "reason": {+ "anyOf": [+ {+ "maxLength": 500,+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "One sentence of evidence for WHY this person: what ties them to the affected surface (e.g. 'authored 4 of the last 10 commits touching products/tracing/mcp/', 'human correction routed the prior tracing report to them'). Persisted on the report so the routing is auditable — always set it when you can name the evidence; 'precedent' alone is weak, prefer code-derived ownership."+ },"user_uuid": {"description": "PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Resolved server-side to the member's linked GitHub login — use this when you know the PostHog user but not their GitHub handle. Must be a concrete UUID; the `@me` alias is not valid here.","type": "string"diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-emit-report.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-emit-report.jsonindex 3bca8c31791f..9758d3f3f24e 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-emit-report.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-emit-report.json@@ -89,6 +89,18 @@"maxLength": 200,"type": "string"},+ "reason": {+ "anyOf": [+ {+ "maxLength": 500,+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "One sentence of evidence for WHY this person: what ties them to the affected surface (e.g. 'authored 4 of the last 10 commits touching products/tracing/mcp/', 'human correction routed the prior tracing report to them'). Persisted on the report so the routing is auditable — always set it when you can name the evidence; 'precedent' alone is weak, prefer code-derived ownership."+ },"user_uuid": {"description": "PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Resolved server-side to the member's linked GitHub login — use this when you know the PostHog user but not their GitHub handle. Must be a concrete UUID; the `@me` alias is not valid here.","type": "string"diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-edit-report.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-edit-report.jsonindex 13e11593f001..5f9e24714533 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-edit-report.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-edit-report.json@@ -30,6 +30,18 @@"maxLength": 200,"type": "string"},+ "reason": {+ "anyOf": [+ {+ "maxLength": 500,+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "One sentence of evidence for WHY this person: what ties them to the affected surface (e.g. 'authored 4 of the last 10 commits touching products/tracing/mcp/', 'human correction routed the prior tracing report to them'). Persisted on the report so the routing is auditable — always set it when you can name the evidence; 'precedent' alone is weak, prefer code-derived ownership."+ },"user_uuid": {"description": "PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Resolved server-side to the member's linked GitHub login — use this when you know the PostHog user but not their GitHub handle. Must be a concrete UUID; the `@me` alias is not valid here.","type": "string"diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-emit-report.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-emit-report.jsonindex 3bca8c31791f..9758d3f3f24e 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-emit-report.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-emit-report.json@@ -89,6 +89,18 @@"maxLength": 200,"type": "string"},+ "reason": {+ "anyOf": [+ {+ "maxLength": 500,+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "One sentence of evidence for WHY this person: what ties them to the affected surface (e.g. 'authored 4 of the last 10 commits touching products/tracing/mcp/', 'human correction routed the prior tracing report to them'). Persisted on the report so the routing is auditable — always set it when you can name the evidence; 'precedent' alone is weak, prefer code-derived ownership."+ },"user_uuid": {"description": "PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Resolved server-side to the member's linked GitHub login — use this when you know the PostHog user but not their GitHub handle. Must be a concrete UUID; the `@me` alias is not valid here.","type": "string"