Skip to content

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

fix(signals): route reports to reviewers with no GitHub account (#96891)

posthog[bot]dc2a665b8f61
diff --git a/products/desktop/apps/mobile/src/features/inbox/components/SuggestedReviewerAvatarStack.test.tsx b/products/desktop/apps/mobile/src/features/inbox/components/SuggestedReviewerAvatarStack.test.tsx
index 30a73f3ab04c..263f9b642e61 100644
--- a/products/desktop/apps/mobile/src/features/inbox/components/SuggestedReviewerAvatarStack.test.tsx
+++ b/products/desktop/apps/mobile/src/features/inbox/components/SuggestedReviewerAvatarStack.test.tsx
@@ -116,7 +116,7 @@ describe("SuggestedReviewerAvatarStack", () => {
expect(mocks.mutate).toHaveBeenCalledWith({
artefactId: "reviewers-1",
- content: [{ github_login: "bob" }],
+ content: [{ user_uuid: "user-bob" }],
optimisticReviewers: [teammate],
});
expect(mocks.track).toHaveBeenCalledWith(
diff --git a/products/desktop/apps/mobile/src/features/inbox/components/SuggestedReviewers.tsx b/products/desktop/apps/mobile/src/features/inbox/components/SuggestedReviewers.tsx
index ced7aac5ea3a..73030f3bf960 100644
--- a/products/desktop/apps/mobile/src/features/inbox/components/SuggestedReviewers.tsx
+++ b/products/desktop/apps/mobile/src/features/inbox/components/SuggestedReviewers.tsx
@@ -147,43 +147,68 @@ export function SuggestedReviewers({
const displayName =
reviewer.user?.first_name ??
reviewer.github_name ??
- reviewer.github_login;
- return (
- <View
- key={reviewer.user?.uuid ?? reviewer.github_login}
- className="flex-row items-center gap-2 rounded-full border border-gray-6 bg-gray-2 py-1.5 pr-1.5 pl-1.5"
- >
- <Pressable
- onPress={() => {
- fireAction("click_suggested_reviewer", {
- suggested_reviewer_login: reviewer.github_login,
- });
- openExternalUrl(
- `https://github.com/${reviewer.github_login}`,
- );
- }}
- hitSlop={4}
- className="flex-row items-center gap-2 active:opacity-70"
- >
+ reviewer.github_login ??
+ reviewer.user?.email ??
+ "Reviewer";
+ const reviewerBody = (
+ <>
+ {reviewer.github_login ? (
<Image
source={{
uri: `https://github.com/${reviewer.github_login}.png?size=48`,
}}
className="h-6 w-6 rounded-full bg-gray-4"
/>
- <Text className="text-[13px] text-gray-12">
- {displayName}
- </Text>
- {isMe && (
- <View className="rounded bg-status-warning/20 px-1 py-0.5">
- <Eye
- size={10}
- color={themeColors.status.warning}
- weight="bold"
- />
- </View>
- )}
- </Pressable>
+ ) : (
+ <View className="h-6 w-6 items-center justify-center rounded-full bg-gray-4">
+ <Text className="text-[11px] text-gray-11">
+ {displayName.slice(0, 1).toUpperCase()}
+ </Text>
+ </View>
+ )}
+ <Text className="text-[13px] text-gray-12">{displayName}</Text>
+ {isMe && (
+ <View className="rounded bg-status-warning/20 px-1 py-0.5">
+ <Eye
+ size={10}
+ color={themeColors.status.warning}
+ weight="bold"
+ />
+ </View>
+ )}
+ </>
+ );
+ return (
+ <View
+ key={
+ reviewer.user?.uuid ??
+ reviewer.user_uuid ??
+ reviewer.github_login ??
+ displayName
+ }
+ className="flex-row items-center gap-2 rounded-full border border-gray-6 bg-gray-2 py-1.5 pr-1.5 pl-1.5"
+ >
+ {reviewer.github_login ? (
+ <Pressable
+ onPress={() => {
+ fireAction("click_suggested_reviewer", {
+ suggested_reviewer_login:
+ reviewer.github_login ?? undefined,
+ });
+ openExternalUrl(
+ `https://github.com/${reviewer.github_login}`,
+ );
+ }}
+ hitSlop={4}
+ className="flex-row items-center gap-2 active:opacity-70"
+ >
+ {reviewerBody}
+ </Pressable>
+ ) : (
+ <View className="flex-row items-center gap-2">
+ {reviewerBody}
+ </View>
+ )}
<Pressable
onPress={() => removeReviewer(reviewer)}
disabled={isPending}
diff --git a/products/desktop/packages/core/src/inbox/artefacts.test.ts b/products/desktop/packages/core/src/inbox/artefacts.test.ts
index d35891fd0309..57b894a6cb1f 100644
--- a/products/desktop/packages/core/src/inbox/artefacts.test.ts
+++ b/products/desktop/packages/core/src/inbox/artefacts.test.ts
@@ -173,7 +173,16 @@ describe("artefacts", () => {
last_name: "",
},
}),
- expected: [{ github_login: "ada" }],
+ expected: [{ user_uuid: "uuid-1" }],
+ },
+ {
+ name: "stored user uuid",
+ reviewer: makeReviewer({
+ github_login: "stale-login",
+ user_uuid: "uuid-stable",
+ user: null,
+ }),
+ expected: [{ user_uuid: "uuid-stable" }],
},
{
name: "user uuid fallback",
diff --git a/products/desktop/packages/core/src/inbox/artefacts.ts b/products/desktop/packages/core/src/inbox/artefacts.ts
index d5e8294832fa..7d23c7f6d0f5 100644
--- a/products/desktop/packages/core/src/inbox/artefacts.ts
+++ b/products/desktop/packages/core/src/inbox/artefacts.ts
@@ -43,7 +43,12 @@ export function suggestedReviewerDisplayName(
if (name) return name;
if (reviewer.user.email) return reviewer.user.email;
}
- return reviewer.github_name ?? reviewer.github_login;
+ return (
+ reviewer.github_name ??
+ reviewer.github_login ??
+ reviewer.user?.email ??
+ "Reviewer"
+ );
}
export function extractSuggestedReviewers(
@@ -127,8 +132,9 @@ export function toSuggestedReviewerWriteContent(
): SuggestedReviewerWriteEntry[] {
return reviewers
.map((reviewer): SuggestedReviewerWriteEntry | null => {
+ const userUuid = reviewer.user_uuid ?? reviewer.user?.uuid;
+ if (userUuid) return { user_uuid: userUuid };
if (reviewer.github_login) return { github_login: reviewer.github_login };
- if (reviewer.user?.uuid) return { user_uuid: reviewer.user.uuid };
return null;
})
.filter((entry): entry is SuggestedReviewerWriteEntry => entry !== null);
diff --git a/products/desktop/packages/shared/src/domain-types.ts b/products/desktop/packages/shared/src/domain-types.ts
index c44c86ab61f5..1c5137dbb525 100644
--- a/products/desktop/packages/shared/src/domain-types.ts
+++ b/products/desktop/packages/shared/src/domain-types.ts
@@ -1013,7 +1013,10 @@ import type { AvailableSuggestedReviewer } from "./inbox-types";
export type { AvailableSuggestedReviewer };
export interface SuggestedReviewer {
- github_login: string;
+ /** Null for a reviewer with no linked GitHub account — `user` identifies them instead. */
+ github_login: string | null;
+ /** Null on entries written before reviewers carried one; `user` still resolves from the login. */
+ user_uuid?: string | null;
github_name: string | null;
relevant_commits: SuggestedReviewerCommit[];
user: SuggestedReviewerUser | null;
diff --git a/products/desktop/packages/ui/src/features/inbox/components/SuggestedReviewerAvatarStack.test.tsx b/products/desktop/packages/ui/src/features/inbox/components/SuggestedReviewerAvatarStack.test.tsx
index 57e97c45fbe7..6f42c23f31ac 100644
--- a/products/desktop/packages/ui/src/features/inbox/components/SuggestedReviewerAvatarStack.test.tsx
+++ b/products/desktop/packages/ui/src/features/inbox/components/SuggestedReviewerAvatarStack.test.tsx
@@ -155,7 +155,8 @@ describe("SuggestedReviewerAvatarStack", () => {
expect(onCardClick).not.toHaveBeenCalled();
expect(mocks.mutate).toHaveBeenCalledWith(
{
- content: [{ github_login: "bob" }],
+ // The write names the kept reviewer by PostHog user, so it keeps routing if they unlink GitHub.
+ content: [{ user_uuid: "user-bob" }],
optimisticReviewers: [teammate],
},
expect.objectContaining({
diff --git a/products/desktop/packages/ui/src/features/inbox/components/SuggestedReviewerAvatarStack.tsx b/products/desktop/packages/ui/src/features/inbox/components/SuggestedReviewerAvatarStack.tsx
index fcc4a178ec46..25bc36aa6e8c 100644
--- a/products/desktop/packages/ui/src/features/inbox/components/SuggestedReviewerAvatarStack.tsx
+++ b/products/desktop/packages/ui/src/features/inbox/components/SuggestedReviewerAvatarStack.tsx
@@ -17,6 +17,7 @@ import type { InboxReportActionSurface } from "@posthog/shared";
import type {
SignalReport,
SignalReportArtefactsResponse,
+ SuggestedReviewer,
} from "@posthog/shared/types";
import { useOptionalAuthenticatedClient } from "@posthog/ui/features/auth/authClient";
import { useCurrentUser } from "@posthog/ui/features/auth/useCurrentUser";
@@ -65,8 +66,12 @@ export function SuggestedReviewerAvatarStack({
const reviewerArtefact = selectSuggestedReviewersArtefact(
artefacts?.results ?? data?.results ?? [],
);
+ // The stack draws GitHub profile avatars, so it can only show reviewers who have a login. A
+ // reviewer identified by PostHog user alone still routes the report; they just have no avatar
+ // to draw here yet.
const reviewers = (reviewerArtefact?.content ?? []).filter(
- (reviewer) => reviewer.github_login,
+ (reviewer): reviewer is SuggestedReviewer & { github_login: string } =>
+ !!reviewer.github_login,
);
if (reviewers.length === 0) {
return null;
diff --git a/products/desktop/packages/ui/src/features/inbox/components/detail/ArtefactLogList.tsx b/products/desktop/packages/ui/src/features/inbox/components/detail/ArtefactLogList.tsx
index e369c8c33520..cc44db59870b 100644
--- a/products/desktop/packages/ui/src/features/inbox/components/detail/ArtefactLogList.tsx
+++ b/products/desktop/packages/ui/src/features/inbox/components/detail/ArtefactLogList.tsx
@@ -195,7 +195,9 @@ function ReviewersBody({ reviewers }: { reviewers: SuggestedReviewer[] }) {
<Flex direction="column" gap="1">
{reviewers.map((reviewer) => (
<Flex
- key={reviewer.user?.uuid ?? reviewer.github_login}
+ key={
+ reviewer.user?.uuid ?? reviewer.user_uuid ?? reviewer.github_login
+ }
align="center"
gap="2"
wrap="wrap"
@@ -211,9 +213,11 @@ function ReviewersBody({ reviewers }: { reviewers: SuggestedReviewer[] }) {
/>
) : null}
<Text className="text-[13px]">
- {reviewer.user?.first_name ??
- reviewer.github_name ??
- reviewer.github_login}
+ {reviewer.user?.first_name ||
+ reviewer.github_name ||
+ reviewer.github_login ||
+ reviewer.user?.email ||
+ "Unknown reviewer"}
</Text>
{reviewer.github_login ? (
<a
diff --git a/products/signals/backend/artefact_schemas.py b/products/signals/backend/artefact_schemas.py
index 8b0ca4c6f1d0..95851e87e86d 100644
--- a/products/signals/backend/artefact_schemas.py
+++ b/products/signals/backend/artefact_schemas.py
@@ -183,9 +183,25 @@ class RelevantCommit(BaseModel):
class SuggestedReviewerEntry(BaseModel):
- """One reviewer in a `suggested_reviewers` artefact's content list."""
+ """One reviewer in a `suggested_reviewers` artefact's content list.
- github_login: str = Field(description="GitHub login identifying the reviewer (stored lowercased).")
+ A reviewer is a PostHog user; a GitHub login is an attribute some of them have. An entry carries
+ `user_uuid`, `github_login`, or both, and readers match on either — so a teammate who never
+ connected GitHub still routes a report. Entries written before `user_uuid` existed carry a login
+ alone, and read-time enrichment resolves those the way it always did.
+ """
+
+ github_login: str | None = Field(
+ default=None,
+ description=(
+ "GitHub login identifying the reviewer (stored lowercased). Null when the reviewer has "
+ "no linked GitHub account."
+ ),
+ )
+ user_uuid: str | None = Field(
+ default=None,
+ description="UUID of the PostHog user this entry routes to. Null on entries written before reviewers carried one.",
+ )
github_name: str | None = Field(default=None, description="Optional human-readable display name.")
relevant_commits: list[RelevantCommit] = Field(
default_factory=list,
@@ -217,13 +233,33 @@ class SuggestedReviewerEntry(BaseModel):
@field_validator("github_login")
@classmethod
- def github_login_must_not_be_empty(cls, v: str) -> str:
+ def github_login_must_not_be_empty(cls, v: str | None) -> str | None:
+ if v is None:
+ return None
if not v.strip():
raise ValueError("must not be empty or whitespace-only")
# Strip on the way in: read-time enrichment and autostart look logins up with
# `login.lower()` and no strip, so a padded login would persist but never match.
return v.strip()
+ @field_validator("user_uuid")
+ @classmethod
+ def user_uuid_must_be_a_uuid(cls, v: str | None) -> str | None:
+ if v is None:
+ return None
+ # Canonicalize rather than keep the caller's spelling: readers match this value with a jsonb
+ # containment filter, where a differently-formatted UUID for the same user never hits.
+ try:
+ return str(UUID(v.strip()))
+ except (ValueError, AttributeError):
+ raise ValueError("must be a UUID")
+
+ @model_validator(mode="after")
+ def must_identify_a_reviewer(self) -> SuggestedReviewerEntry:
+ if not self.github_login and not self.user_uuid:
+ raise ValueError("must carry a github_login, a user_uuid, or both")
+ return self
+
class SuggestedReviewers(RootModel[list[SuggestedReviewerEntry]]):
"""Content schema for a `suggested_reviewers` artefact — the content root is a JSON list."""
diff --git a/products/signals/backend/auto_start.py b/products/signals/backend/auto_start.py
index d9635cec3afe..d0e599ce9eac 100644
--- a/products/signals/backend/auto_start.py
+++ b/products/signals/backend/auto_start.py
@@ -40,8 +40,10 @@ from products.signals.backend.report_generation.research import (
PriorityAssessment,
)
from products.signals.backend.report_generation.resolve_reviewers import (
+ ReviewerIdentitySet,
get_org_member_github_logins_by_user_uuid,
resolve_org_github_login_to_users,
+ resolve_org_users_by_uuid,
)
from products.signals.backend.report_generation.select_repo import RepoSelectionResult
from products.signals.backend.report_steering import NO_STEERING, ReportSteering, load_report_steering
@@ -71,7 +73,10 @@ IMPLEMENTATION_MCP_SCOPES: McpScopePreset = "signals_implementation"
class ReviewerContent(TypedDict):
- github_login: str
+ # Null for a reviewer with no linked GitHub account: they route the report like anyone else, but
+ # can never be the autostart runner, which mints its session under a GitHub identity.
+ github_login: str | None
+ user_uuid: str | None
github_name: str | None
relevant_commits: list[dict]
reason: str | None
@@ -464,7 +469,9 @@ def _create_implementation_task_if_absent(
return True
-def _live_skill_owner_logins(team: Team, report_id: str, reviewers_content: list[ReviewerContent]) -> set[str]:
+def _live_skill_owner_identities(
+ team: Team, report_id: str, reviewers_content: list[ReviewerContent]
+) -> ReviewerIdentitySet:
"""GitHub logins (lowercased) of the *current* owners of every scout that touched the report.
The `is_skill_owner` stamp on a stored reviewer entry is a write-time snapshot: an owner added
@@ -488,9 +495,13 @@ def _live_skill_owner_logins(team: Team, report_id: str, reviewers_content: list
for skill_name in skill_names:
owner_uuids.update(resolve_skill_owner_user_uuids(team, skill_name))
if not owner_uuids:
- return set()
+ return ReviewerIdentitySet.empty()
uuid_to_login = get_org_member_github_logins_by_user_uuid(team.id, list(owner_uuids))
- return {login for login in uuid_to_login.values() if login} # already lowercased by the resolver
+ return ReviewerIdentitySet(
+ user_uuids=frozenset(owner_uuids),
+ # already lowercased by the resolver
+ github_logins=frozenset(login for login in uuid_to_login.values() if login),
+ )
def _resolve_autostart_assignee(
@@ -498,7 +509,7 @@ def _resolve_autostart_assignee(
report_priority: Priority,
reviewers_content: list[ReviewerContent],
team_default_priority: Priority,
- live_owner_logins: set[str] | None = None,
+ live_owner_identities: ReviewerIdentitySet | None = None,
) -> User | None:
"""Return the first suggested reviewer whose effective priority threshold allows auto-start.
@@ -513,7 +524,7 @@ def _resolve_autostart_assignee(
skill editor name a privileged teammate as owner, steer the scout to pick them, and have the
implementation agent mint an OAuth session under that teammate. They still route the report (they
remain in the artefact); they just can't be the runner. The stored stamp is a write-time snapshot,
- so *live_owner_logins* (the authoring scout's current owner set, resolved by the caller at
+ so *live_owner_identities* (the authoring scout's current owner set, resolved by the caller at
identity time) is excluded too — an owner added after the stamp must not slip through as a stale
``False``.
@@ -525,27 +536,34 @@ def _resolve_autostart_assignee(
# Owner-stamped entries — by the stored stamp or the live owner set — never select the task
# identity (see docstring). Filter before resolving so their logins aren't even looked up as
# candidates.
- owner_logins = live_owner_logins or set()
+ owners = live_owner_identities or ReviewerIdentitySet.empty()
identity_candidates = [
r
for r in reviewers_content
- if not r.get("is_skill_owner") and str(r.get("github_login") or "").strip().lower() not in owner_logins
+ if not r.get("is_skill_owner")
+ and not owners.covers(user_uuid=r.get("user_uuid"), github_login=r.get("github_login"))
]
login_to_user = resolve_org_github_login_to_users(
- team_id, (str(r["github_login"]) for r in identity_candidates if r.get("github_login"))
+ team_id,
+ (str(r["github_login"]) for r in identity_candidates if not r.get("user_uuid") and r.get("github_login")),
+ )
+ uuid_to_user = resolve_org_users_by_uuid(
+ team_id, (str(r["user_uuid"]) for r in identity_candidates if r.get("user_uuid"))
)
report_rank = _priority_rank(report_priority)
# Map reviewer github logins to org members, preserving reviewer order (most relevant first).
candidate_users: list[User] = []
for reviewer in identity_candidates:
+ user_uuid = reviewer.get("user_uuid")
login = reviewer.get("github_login")
- if not login:
+ if user_uuid:
+ candidate = uuid_to_user.get(str(user_uuid))
+ elif login:
+ candidate = login_to_user.get(str(login).strip().lower())
+ else:
continue
- # strip + lower matches the resolver's key normalization, so a legacy padded login
- # (stored before the schema stripped on write) still resolves.
- candidate = login_to_user.get(str(login).strip().lower())
- if isinstance(candidate, User):
+ if isinstance(candidate, User) and candidate.get_github_login():
candidate_users.append(candidate)
if not candidate_users:
@@ -769,16 +787,16 @@ async def maybe_autostart_implementation_task(
else:
# Resolve the authoring scout's current owners at identity time — the stored
# `is_skill_owner` stamp is a write-time snapshot and can be stale (see
- # `_live_skill_owner_logins`). Skipped when no reviewer is up for selection.
- live_owner_logins = (
- await database_sync_to_async(_live_skill_owner_logins, thread_sensitive=False)(
+ # `_live_skill_owner_identities`). Skipped when no reviewer is up for selection.
+ live_owner_identities = (
+ await database_sync_to_async(_live_skill_owner_identities, thread_sensitive=False)(
team, report_id, reviewers_content
)
if reviewers_content
- else set()
+ else ReviewerIdentitySet.empty()
)
task_user = await database_sync_to_async(_resolve_autostart_assignee, thread_sensitive=False)(
- team_id, priority.priority, reviewers_content, team_default_priority, live_owner_logins
+ team_id, priority.priority, reviewers_content, team_default_priority, live_owner_identities
)
if (
task_user is None
@@ -872,11 +890,14 @@ async def _latest_reviewers_content(report_id: str) -> tuple[list[ReviewerConten
return [], editor_user_id
reviewers: list[ReviewerContent] = []
for entry in data:
- if isinstance(entry, dict) and entry.get("github_login"):
+ # Either identity is enough to keep the entry. A reviewer with no login still routes the
+ # report and still carries the owner stamp; only the runner-identity step needs a login.
+ if isinstance(entry, dict) and (entry.get("github_login") or entry.get("user_uuid")):
source_skill = entry.get("source_skill")
reviewers.append(
ReviewerContent(
- github_login=str(entry["github_login"]),
+ github_login=str(entry["github_login"]) if entry.get("github_login") else None,
+ user_uuid=str(entry["user_uuid"]) if entry.get("user_uuid") else None,
github_name=entry.get("github_name"),
relevant_commits=entry.get("relevant_commits") or [],
reason=entry.get("reason"),
diff --git a/products/signals/backend/contracts.py b/products/signals/backend/contracts.py
index 5a6d6017568b..32486bfd4ea3 100644
--- a/products/signals/backend/contracts.py
+++ b/products/signals/backend/contracts.py
@@ -524,7 +524,11 @@ class SignalReviewerUserInfo(ContractModel):
class EnrichedReviewer(ContractModel):
- github_login: str
+ # A reviewer is identified by their PostHog user, their GitHub login, or both. `github_login` is
+ # null for a reviewer with no linked GitHub account; `user_uuid` is null on entries written
+ # before reviewers carried one, where `user` still resolves from the login at read time.
+ github_login: str | None
+ user_uuid: str | None = None
github_name: str | None
relevant_commits: list[RelevantCommit]
user: SignalReviewerUserInfo | None
diff --git a/products/signals/backend/custom_agent/persistence.py b/products/signals/backend/custom_agent/persistence.py
index e7da703da36f..fd50c52edeac 100644
--- a/products/signals/backend/custom_agent/persistence.py
+++ b/products/signals/backend/custom_agent/persistence.py
@@ -110,16 +110,21 @@ def create_custom_agent_ready_report(
# are written after the assignees append, so a registered SuggestedReviewers overrides it —
# including an empty one, which is a persisted "no reviewers" state and must still emit.
reviewer_logins = [assignee.github_login for assignee in final_report.assignees]
+ reviewer_user_uuids: list[str] = []
reviewers_written = bool(final_report.assignees)
for artefact_content in registered_artefacts:
if isinstance(artefact_content, SuggestedReviewers):
reviewers_written = True
- reviewer_logins = [entry.github_login for entry in artefact_content.root]
+ reviewer_logins = [entry.github_login for entry in artefact_content.root if entry.github_login]
+ reviewer_user_uuids = [
+ entry.user_uuid for entry in artefact_content.root if entry.user_uuid and not entry.github_login
+ ]
if reviewers_written:
capture_suggested_reviewers_resolved(
team_id=team_id,
report_id=str(report.id),
github_logins=reviewer_logins,
+ user_uuids=reviewer_user_uuids,
source="custom_agent",
)
diff --git a/products/signals/backend/report_generation/resolve_reviewers.py b/products/signals/backend/report_generation/resolve_reviewers.py
index 9182adf61c65..c9aba3dc964e 100644
--- a/products/signals/backend/report_generation/resolve_reviewers.py
+++ b/products/signals/backend/report_generation/resolve_reviewers.py
@@ -8,6 +8,7 @@ from concurrent.futures import ThreadPoolExecutor, as_completed
from dataclasses import dataclass
from datetime import datetime
from typing import Any, Literal
+from uuid import UUID
from django.db.models import Expression, Prefetch, Q, QuerySet, Subquery, Value
from django.db.models.fields.json import KeyTextTransform, KeyTransform
@@ -111,11 +112,16 @@ def enrich_reviewer_dicts_with_org_members(
reviewer_dicts: list[dict],
*,
login_to_user: Mapping[str, User] | None = None,
+ uuid_to_user: Mapping[str, User] | None = None,
) -> list[dict]:
"""Enrich reviewer dicts (from artefact content) with fresh PostHog user info.
Called at read time so that users who connect their GitHub account after the
artefact was created show up properly.
+
+ An entry's `user_uuid` is tried first and its `github_login` second: the uuid is the reviewer's
+ stable identity, while a login can move to another GitHub account. Entries written before
+ reviewers carried a uuid have only the login, so they keep resolving through it.
"""
if not reviewer_dicts:
return reviewer_dicts
@@ -127,12 +133,22 @@ def enrich_reviewer_dicts_with_org_members(
wanted = normalized_github_logins_from_reviewer_payloads(reviewer_dicts)
resolved_map = resolve_org_github_login_to_users(team_id, wanted) if wanted else {}
+ resolved_by_uuid: Mapping[str, User]
+ if uuid_to_user is not None:
+ resolved_by_uuid = uuid_to_user
+ else:
+ wanted_uuids = normalized_user_uuids_from_reviewer_payloads(reviewer_dicts)
+ resolved_by_uuid = resolve_org_users_by_uuid(team_id, wanted_uuids) if wanted_uuids else {}
+
enriched: list[dict] = []
for r in reviewer_dicts:
- login = r.get("github_login", "")
- # strip + lower matches the resolver's key normalization, so a legacy padded login
- # (stored before the schema stripped on write) still resolves.
- user = resolved_map.get(login.strip().lower()) if login else None
+ login = r.get("github_login") or ""
+ user_uuid = _normalized_reviewer_user_uuid(r.get("user_uuid"))
+ user = resolved_by_uuid.get(user_uuid) if user_uuid else None
+ if user_uuid is None and login:
+ # strip + lower matches the resolver's key normalization, so a legacy padded login
+ # (stored before the schema stripped on write) still resolves.
+ user = resolved_map.get(login.strip().lower())
enriched.append(
{
**r,
@@ -182,6 +198,114 @@ def normalized_github_logins_from_reviewer_payloads(rows: Iterable[object]) -> f
return frozenset(logins)
+def _normalized_reviewer_user_uuid(raw: object) -> str | None:
+ """A reviewer payload's `user_uuid` in the canonical form readers match on, or None.
+
+ Artefact content is JSON written by several paths (and historically by the generic artefact API),
+ so a stored uuid may be padded or upper-cased. Every consumer normalizes through here so a
+ stored value and a live user's uuid compare the same way.
+ """
+ if not raw:
+ return None
+ try:
+ return str(UUID(str(raw).strip()))
+ except (ValueError, AttributeError):
+ return None
+
+
+@frozen
+class ReviewerIdentitySet:
+ """A set of people named the way a reviewer entry names them: by user uuid, by GitHub login, or
+ both. Callers hold one to test whether a reviewer entry falls in the set without caring which
+ identity the entry happens to carry — a member with no linked GitHub account is only ever
+ matched by uuid.
+ """
+
+ user_uuids: frozenset[str]
+ github_logins: frozenset[str]
+
+ @classmethod
+ def empty(cls) -> ReviewerIdentitySet:
+ return cls(user_uuids=frozenset(), github_logins=frozenset())
+
+ def covers(self, *, user_uuid: str | None = None, github_login: str | None = None) -> bool:
+ if user_uuid:
+ return user_uuid in self.user_uuids
+ return bool(github_login and github_login.strip().lower() in self.github_logins)
+
+ def __bool__(self) -> bool:
+ return bool(self.user_uuids or self.github_logins)
+
+
+@frozen
+class ReviewerPayloadIndex:
+ """Reviewer payloads looked up by either identity, for merging a new list onto a stored one.
+
+ A stored entry and the entry replacing it may not share an identity field: the stored one can
+ predate `user_uuid` and carry only a login, while the new one names a PostHog user whose GitHub
+ account is gone. Matching on the uuid first and the login second lets the two still recognize
+ each other, so a reviewer keeps their commit evidence, display name, and reason across an edit.
+ """
+
+ by_user_uuid: dict[str, dict]
+ by_github_login: dict[str, dict]
+
+ @classmethod
+ def build(cls, rows: Iterable[object]) -> ReviewerPayloadIndex:
+ by_user_uuid: dict[str, dict] = {}
+ by_github_login: dict[str, dict] = {}
+ for row in rows:
+ if not isinstance(row, dict):
+ continue
+ user_uuid = _normalized_reviewer_user_uuid(row.get("user_uuid"))
+ if user_uuid:
+ by_user_uuid.setdefault(user_uuid, row)
+ login = str(row.get("github_login") or "").strip().lower()
+ if login:
+ by_github_login.setdefault(login, row)
+ return cls(by_user_uuid=by_user_uuid, by_github_login=by_github_login)
+
+ def get(self, *, user_uuid: str | None = None, github_login: str | None = None) -> dict | None:
+ if user_uuid:
+ match = self.by_user_uuid.get(user_uuid)
+ if match is not None:
+ return match
+ if github_login:
+ return self.by_github_login.get(github_login.strip().lower())
+ return None
+
+ def __bool__(self) -> bool:
+ return bool(self.by_user_uuid or self.by_github_login)
+
+
+def normalized_user_uuids_from_reviewer_payloads(rows: Iterable[object]) -> frozenset[str]:
+ uuids: set[str] = set()
+ for row in rows:
+ if not isinstance(row, dict):
+ continue
+ normalized = _normalized_reviewer_user_uuid(row.get("user_uuid"))
+ if normalized:
+ uuids.add(normalized)
+ return frozenset(uuids)
+
+
+def normalized_user_uuids_from_suggested_reviewer_artefacts(
+ artefacts: Iterable[SignalReportArtefact],
+) -> frozenset[str]:
+ out: set[str] = set()
+ for art in artefacts:
+ if art.type != SignalReportArtefact.ArtefactType.SUGGESTED_REVIEWERS:
+ continue
+ try:
+ parsed_list = json.loads(art.content)
+ except (json.JSONDecodeError, TypeError, ValueError):
+ continue
+ if not isinstance(parsed_list, list):
+ continue
+ out.update(normalized_user_uuids_from_reviewer_payloads(parsed_list))
+ return frozenset(out)
+
+
def resolve_suggested_reviewers(
team_id: int,
repository: str,
@@ -570,29 +694,43 @@ class _ResolvedReviewer:
weight: float
-def get_org_member_github_login_to_user_map(team_id: int) -> dict[str, User] | None:
- """Build a mapping of GitHub login -> PostHog User for the team's org.
+def resolve_org_users_by_uuid(team_id: int, user_uuids: Iterable[str]) -> dict[str, User]:
+ """Map user UUID -> org member ``User`` for the team's organization, GitHub-linked or not.
- Returns None if the team doesn't exist, otherwise a dict (possibly empty).
+ The uuid counterpart of ``resolve_org_github_login_to_users``: reviewer entries route to a
+ PostHog user, so this is what resolves one without asking whether they connected GitHub.
"""
+ wanted = {u for u in (_normalized_reviewer_user_uuid(raw) for raw in user_uuids) if u}
+ if not wanted:
+ return {}
+
try:
org_id = str(Team.objects.values_list("organization_id", flat=True).get(id=team_id))
except Team.DoesNotExist:
- return None
-
- candidate_ids = _candidate_user_ids_for_organization(org_id)
- if not candidate_ids:
return {}
- users = User.objects.filter(id__in=candidate_ids).prefetch_related(*_github_identity_prefetches()).order_by("id")
+ member_ids = OrganizationMembership.objects.filter(organization_id=org_id, user__uuid__in=wanted).values_list(
+ "user_id", flat=True
+ )
+ users = User.objects.filter(id__in=member_ids, is_active=True).order_by("id")
+ return {str(user.uuid): user for user in users}
- login_to_user: dict[str, User] = {}
- for user in users:
- login = user.get_github_login()
- if login:
- login_to_user[login.lower()] = user
- return login_to_user
+def get_org_member_users_by_uuid(team_id: int) -> dict[str, User] | None:
+ """Every active org member on the team's organization, keyed by user UUID.
+
+ Backs the inbox reviewer picker. A linked GitHub identity is not required, so a member who
+ never connected GitHub can be picked (and can pick themselves). Returns None if the team doesn't
+ exist, otherwise a dict (possibly empty).
+ """
+ try:
+ org_id = str(Team.objects.values_list("organization_id", flat=True).get(id=team_id))
+ except Team.DoesNotExist:
+ return None
+
+ member_ids = OrganizationMembership.objects.filter(organization_id=org_id).values_list("user_id", flat=True)
+ users = User.objects.filter(id__in=member_ids, is_active=True).order_by("id")
+ return {str(user.uuid): user for user in users}
def get_org_member_github_logins_by_user_uuid(team_id: int, user_uuids: list[str]) -> dict[str, str]:
@@ -709,26 +847,6 @@ def resolve_org_github_login_to_users(team_id: int, github_logins: Iterable[str]
return login_to_user
-def _candidate_user_ids_for_organization(org_id: str) -> set[int]:
- """Org member IDs that might have any GitHub identity."""
- mid_sq = Subquery(OrganizationMembership.objects.filter(organization_id=org_id).values("user_id"))
- candidates: set[int] = set()
- candidates.update(
- UserSocialAuth.objects.filter(provider="github", user_id__in=mid_sq).values_list("user_id", flat=True)
- )
- candidates.update(
- UserIntegration.objects.filter(kind=UserIntegration.IntegrationKind.GITHUB, user_id__in=mid_sq).values_list(
- "user_id", flat=True
- )
- )
- candidates.update(
- Integration.objects.filter(kind="github", created_by_id__in=mid_sq)
- .exclude(config__connecting_user_github_login=None)
- .values_list("created_by_id", flat=True)
- )
- return candidates
-
-
def _candidate_user_ids_for_org_and_logins(org_id: str, logins_lower: frozenset[str]) -> set[int]:
"""Subset of org members whose stored GitHub identity might match one of ``logins_lower`` (case-insensitive)."""
if not logins_lower:
diff --git a/products/signals/backend/report_generation/reviewer_telemetry.py b/products/signals/backend/report_generation/reviewer_telemetry.py
index b09e0e940f34..d1383ff8c5ed 100644
--- a/products/signals/backend/report_generation/reviewer_telemetry.py
+++ b/products/signals/backend/report_generation/reviewer_telemetry.py
@@ -10,7 +10,9 @@ from posthog.models import Team
from products.signals.backend.report_generation.resolve_reviewers import (
ReviewerResolutionDiagnostics,
+ normalized_user_uuids_from_reviewer_payloads,
resolve_org_github_login_to_users,
+ resolve_org_users_by_uuid,
)
logger = logging.getLogger(__name__)
@@ -26,15 +28,36 @@ ReviewerSuggestionSource = Literal["pipeline", "scout", "scout_edit", "custom_ag
class ReviewerLinkability:
linkable_logins: list[str]
unlinkable_logins: list[str]
+ linkable_user_uuids: list[str]
+ unlinkable_user_uuids: list[str]
+ @property
+ def linkable_count(self) -> int:
+ return len(self.linkable_logins) + len(self.linkable_user_uuids)
-def split_reviewer_linkability(team_id: int, github_logins: list[str]) -> ReviewerLinkability:
- """Split suggested-reviewer GitHub logins by whether they resolve to an org member."""
+ @property
+ def unlinkable_count(self) -> int:
+ return len(self.unlinkable_logins) + len(self.unlinkable_user_uuids)
+
+
+def split_reviewer_linkability(
+ team_id: int, github_logins: list[str], user_uuids: list[str] | None = None
+) -> ReviewerLinkability:
+ """Split suggested reviewers by whether they resolve to an active org member.
+
+ `user_uuids` are the reviewers stored by PostHog user alone. Only the write paths that resolve
+ membership before writing can vouch for them; the generic artefact API stores any well-formed
+ uuid, so they are resolved here the same way logins are rather than trusted.
+ """
normalized = list(dict.fromkeys(login.strip().lower() for login in github_logins if login and login.strip()))
login_to_user = resolve_org_github_login_to_users(team_id, normalized)
+ normalized_uuids = sorted(normalized_user_uuids_from_reviewer_payloads({"user_uuid": u} for u in user_uuids or []))
+ uuid_to_user = resolve_org_users_by_uuid(team_id, normalized_uuids) if normalized_uuids else {}
return ReviewerLinkability(
linkable_logins=[login for login in normalized if login in login_to_user],
unlinkable_logins=[login for login in normalized if login not in login_to_user],
+ linkable_user_uuids=[u for u in normalized_uuids if u in uuid_to_user],
+ unlinkable_user_uuids=[u for u in normalized_uuids if u not in uuid_to_user],
)
@@ -44,16 +67,22 @@ def capture_suggested_reviewers_resolved(
report_id: str,
github_logins: list[str],
source: ReviewerSuggestionSource,
+ user_uuids: list[str] | None = None,
correction_notes_written: int | None = None,
correction_note_targets: int | None = None,
) -> None:
"""Emit `signals_suggested_reviewers_resolved` when a report's suggested reviewers are persisted.
- Suggested reviewers are stored as bare GitHub logins; the login -> PostHog user mapping only
- happens downstream (Slack routing, autostart, API read), where an unmapped login falls through
- silently. A report whose logins map to nobody cannot be routed to a person, yet still counts as
- "assigned" in `suggested_reviewers`-based metrics. This event records the linkable/unlinkable
- split at suggestion time so that bucket is measurable.
+ A reviewer stored by GitHub login is only linked to a PostHog user downstream (Slack routing,
+ autostart, API read), where an unmapped login falls through silently. A report whose logins map
+ to nobody cannot be routed to a person, yet still counts as "assigned" in
+ `suggested_reviewers`-based metrics. This event records the linkable/unlinkable split at
+ suggestion time so that bucket is measurable.
+
+ `user_uuids` are the reviewers identified by PostHog user alone, with no GitHub login. One that
+ resolves to an active org member is linkable and is reported in `user_uuid_only_count`, kept
+ separate because autostart still needs a login to run as someone. One that does not resolve is
+ unlinkable like an unknown login: nothing downstream will route it to a person.
A human edit that changed the set also steers the scouts holding the routing memory it
corrects (`reviewer_correction_notes.py`). `correction_notes_written` and
@@ -64,16 +93,16 @@ def capture_suggested_reviewers_resolved(
Best-effort: never raises, so analytics can't break report generation.
"""
try:
- linkability = split_reviewer_linkability(team_id, github_logins)
- if linkability.unlinkable_logins:
+ linkability = split_reviewer_linkability(team_id, github_logins, user_uuids)
+ if linkability.unlinkable_count:
# GitHub logins are member PII, so logs carry counts only; the logins themselves go in
# the event properties, the same internal-analytics surface the artefact already feeds.
logger.info(
- "suggested reviewers for report %s (team %d): %d of %d login(s) have no PostHog user",
+ "suggested reviewers for report %s (team %d): %d of %d reviewer(s) have no PostHog user",
report_id,
team_id,
- len(linkability.unlinkable_logins),
- len(linkability.linkable_logins) + len(linkability.unlinkable_logins),
+ linkability.unlinkable_count,
+ linkability.linkable_count + linkability.unlinkable_count,
)
team = Team.objects.select_related("organization").get(id=team_id)
posthoganalytics.capture(
@@ -83,12 +112,14 @@ def capture_suggested_reviewers_resolved(
"team_id": team_id,
"report_id": report_id,
"source": source,
- "suggested_count": len(linkability.linkable_logins) + len(linkability.unlinkable_logins),
- "linkable_count": len(linkability.linkable_logins),
- "unlinkable_count": len(linkability.unlinkable_logins),
+ "suggested_count": linkability.linkable_count + linkability.unlinkable_count,
+ "linkable_count": linkability.linkable_count,
+ "unlinkable_count": linkability.unlinkable_count,
"linkable_logins": linkability.linkable_logins[:_MAX_LOGINS_PER_EVENT],
"unlinkable_logins": linkability.unlinkable_logins[:_MAX_LOGINS_PER_EVENT],
- "all_unlinkable": bool(linkability.unlinkable_logins) and not linkability.linkable_logins,
+ "user_uuid_only_count": len(linkability.linkable_user_uuids),
+ "unlinkable_user_uuid_count": len(linkability.unlinkable_user_uuids),
+ "all_unlinkable": bool(linkability.unlinkable_count) and not linkability.linkable_count,
**(
{}
if correction_notes_written is None
diff --git a/products/signals/backend/scout_harness/prompt.py b/products/signals/backend/scout_harness/prompt.py
index f386ba348249..f3ddbcba0042 100644
--- a/products/signals/backend/scout_harness/prompt.py
+++ b/products/signals/backend/scout_harness/prompt.py
@@ -455,7 +455,7 @@ This run updates reports that already exist; it can't author new ones. Find the
- **Find it.** {_INBOX_SEARCH_RECIPE} Status matters twice over here: appending to a dismissed or closed report buries your evidence under an item nobody is watching. Reuse the `report:<domain>:<entity>` scratchpad entry from a prior run when you have one. {_DISMISSAL_CONTEXT}
- **Append, or rewrite.** Prefer appending. {_EDIT_EVIDENCE_VS_NOTE} Rewrite `title`/`summary` only on a report you own, and only when the framing is genuinely stale; lead the summary with the verdict (see *Writing the summary*).
-- **Route an unrouted report.** If a report surfaced assigned to no one, set `suggested_reviewers` to route it to an owner: each reviewer an object, `{{github_login}}` (a bare lowercase login, no `@`) or `{{user_uuid}}` (the server resolves it for you), never a bare string. If the owner isn't named in the report, call `scout-members-list` for this project's members, each carrying a resolved `github_login` (the org-scoped `org-member-get-github-login` / `org-members-list` tools aren't available in a scout run). This replaces the report's reviewer list and re-runs autostart, so a report that already has a repo and priority but lacked a qualifying reviewer can now open a draft PR. Only set a reviewer you're confident owns the area; an empty list is a no-op.
+- **Route an unrouted report.** If a report surfaced assigned to no one, set `suggested_reviewers` to route it to an owner: each reviewer an object, `{{user_uuid}}` (preferred — it names a PostHog member directly, with or without a GitHub account) or `{{github_login}}` (a bare lowercase login, no `@`), never a bare string. If the owner isn't named in the report, call `scout-members-list` for this project's members (the org-scoped `org-member-get-github-login` / `org-members-list` tools aren't available in a scout run). This replaces the report's reviewer list and re-runs autostart, so a report that already has a repo and priority but lacked a qualifying reviewer can now open a draft PR. Only set a reviewer you're confident owns the area; an empty list is a no-op.
- **Don't retry blindly.** `edit_report` is NOT idempotent. A retried `append_note` adds a second note. A retried `append_evidence` adds duplicate signals and increases the report counters again. If unsure whether an edit landed, re-read the report rather than re-sending."""
# Heading matches the cross-reference in the authoring sections exactly; "not a copy" lives in the
@@ -474,8 +474,8 @@ _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}` plus an optional `reason`, never a bare string) is what **routes** a report to the people who can act on it, and paired with `priority` + `repository` it 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 it.** Spend real effort identifying who owns the affected area, leaning on evidence you already gathered: code owners, recent authors on the relevant surface, the team that owns the product. Treat "I couldn't find an owner" as a last resort, not a default.
-- **Identify a reviewer two ways, and never guess a handle.** `github_login` is a bare lowercase login (`{github_login: "octocat"}`, no `@`, no display name). `user_uuid` (`{user_uuid: "..."}`) is for when your evidence already names a PostHog user (an account owner, an entity's creator), and the server resolves it to their linked GitHub login for you. The inbox routes by matching the login 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`.
-- **No owner in your evidence? List the members.** `scout-members-list` returns this project's members with `email`, name, and resolved `github_login` (pass `search` to narrow a big project). Match the owner by email/name; 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, so this is the in-run lookup path.
+- **Identify a reviewer two ways, and prefer the uuid.** `user_uuid` (`{user_uuid: "..."}`) names a PostHog member directly, so it is the safer identity: it cannot be mis-typed into someone else, and it works for a member who never connected GitHub. `github_login` is a bare lowercase login (`{github_login: "octocat"}`, no `@`, no display name), matched exactly, so a guessed, mis-cased, or display-name handle reaches no one. Use the login when your evidence is commit authorship; use the uuid whenever your evidence names a PostHog user (an account owner, an entity's `created_by`).
+- **No owner in your evidence? List the members.** `scout-members-list` returns this project's members with `email`, name, and resolved `github_login` (pass `search` to narrow a big project). Match the owner by email/name, then route to their `user_uuid`. Every member is routable, including one whose `github_login` is null — a null login only means no draft PR can be opened as that person, not that the report can't reach them. The org-scoped `org-member-get-github-login` / `org-members-list` tools are not available in a scout run, so this is the in-run lookup path.
- **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.
- **Check for human corrections first.** A human swapping a suggested reviewer for someone else is the strongest ownership evidence there is, so treat it as authoritative precedent over commit history and fold it into your `reviewer:` memory keys. A `report_reviewer_correction` note tells you when one lands on a report you filed or on a login you already hold, and the condense rule for it is in *Notes left for you*. The project profile's `recent_reviewer_corrections` carries the recent ones; for history beyond that 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, don't retry).
- **Weigh other 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 they carry `relevant_commits`, a concrete `reason`, or a human correction behind them, and are an earlier run's unexplained guess when they carry none of those. Precedent is self-reinforcing, so every blind reuse becomes the next run's precedent and compounds a mis-route indefinitely: corroborate from what you gathered this run (an entity's `created_by`, the owning team, recent authors in the data), or say so in `reason` ("inherited from report X, unverified").
@@ -668,9 +668,9 @@ _SELF_IMPROVEMENT_REPORT_FIELDS = (
"plus the evidence in the summary, `actionability` = `requires_human_input` (applying it is a skill edit "
"by your team), `repository` = the `NO_REPO` sentinel (a custom scout's skill body is a row in "
"your team's skills store, not a file in a repository, so a repository could not apply the fix), and "
- "`suggested_reviewers` = the skill authors listed under *Your run identity*, creator first (match each to "
- "a `scout-members-list` row, skip anyone who doesn't resolve, and leave it empty only when none does; if "
- "your skill body defines its own reviewer routing, follow the skill instead)."
+ "`suggested_reviewers` = the skill authors listed under *Your run identity*, creator first (route to the "
+ "`user_uuid` on that line, so an author with no GitHub account still gets the report; if your skill body "
+ "defines its own reviewer routing, follow the skill instead)."
)
_SELF_IMPROVEMENT_ESCALATE_BOTH = f"""- **Recurring or material? File an inbox report too.** A scratchpad entry is only seen when the owner goes looking, where a report is routed to them. When a suggestion re-confirms across runs (your `improve:` entry has accumulated several dated lines), or this run's failure was material (it wasted most of your budget, or steered you into emitting something wrong), surface it with the same report tools you use for findings. If the `improve:` entry already carries a `report_id`, add the fresh observation with `append_evidence`; otherwise author one with `scout-emit-report`: {_SELF_IMPROVEMENT_REPORT_FIELDS} Stash the returned `report_id` in the `improve:` entry so later runs update that report instead of authoring a duplicate. Your team decides whether to apply it."""
@@ -986,25 +986,29 @@ def _skill_authors_line(authors: list[SkillAuthor]) -> str:
return ""
owners = [a for a in authors if a.role == "owner"]
if owners:
- owned = ", ".join(f"{a.name} ({a.email})" for a in owners)
+ owned = ", ".join(f"{a.name} ({a.email}, user_uuid `{a.user_uuid}`)" for a in owners)
return (
f"\n- **skill owners**: {owned}, the humans who own your skill body. "
"When a report needs someone who owns this scout (a self-improvement report especially), "
- "route to them, unless your skill body defines its own reviewer routing, which takes precedence."
+ "route to their `user_uuid`, unless your skill body defines its own reviewer routing, "
+ "which takes precedence."
)
parts = []
creator = next((a for a in authors if a.role == "creator"), None)
if creator is not None:
- parts.append(f"created by {creator.name} ({creator.email})")
+ parts.append(f"created by {creator.name} ({creator.email}, user_uuid `{creator.user_uuid}`)")
editors = [a for a in authors if a.role == "editor"]
if editors:
- edited = ", ".join(f"{a.name} ({a.email}, last edit {a.last_authored_at.date().isoformat()})" for a in editors)
+ edited = ", ".join(
+ f"{a.name} ({a.email}, user_uuid `{a.user_uuid}`, last edit {a.last_authored_at.date().isoformat()})"
+ for a in editors
+ )
parts.append(f"since edited by {edited}")
return (
f"\n- **skill authors**: {'; '.join(parts)}, the humans who own your skill body. "
"When a report needs someone who owns this scout (a self-improvement report especially), "
- "route to them, creator first, unless your skill body defines its own reviewer routing, "
- "which takes precedence."
+ "route to their `user_uuid`, creator first, unless your skill body defines its own reviewer "
+ "routing, which takes precedence."
)
diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.py
index 962cb6a58c6a..d00dd7157979 100644
--- a/products/signals/backend/scout_harness/serializers.py
+++ b/products/signals/backend/scout_harness/serializers.py
@@ -1204,10 +1204,9 @@ class ReportEvidenceSerializer(serializers.Serializer):
class SuggestedReviewerSerializer(serializers.Serializer):
"""One suggested reviewer — identified by `github_login`, `user_uuid`, or both.
- The server canonicalizes each entry to a lowercased GitHub login: a `user_uuid` is resolved to the
- org member's linked GitHub login (and wins over a supplied `github_login` when both are given). A
- `user_uuid` that isn't an org member of this team with a linked GitHub identity is rejected — so a
- reviewer is never silently dropped."""
+ A reviewer is a PostHog user, so a `user_uuid` only has to name an org member of this team: a
+ member with no linked GitHub account routes the report like anyone else. A `user_uuid` that
+ isn't an org member of this team is rejected — so a reviewer is never silently dropped."""
github_login = serializers.CharField(
required=False,
@@ -1222,9 +1221,9 @@ class SuggestedReviewerSerializer(serializers.Serializer):
user_uuid = serializers.UUIDField(
required=False,
help_text=(
- "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."
+ "PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Use "
+ "this when you know the PostHog user, whether or not they have a GitHub handle — every "
+ "member is routable this way. Must be a concrete UUID; the `@me` alias is not valid here."
),
)
@@ -3319,10 +3318,9 @@ class ScoutMemberSerializer(serializers.Serializer):
github_login = serializers.CharField(
allow_null=True,
help_text=(
- "The member's resolved GitHub login (lowercased), already resolved server-side — put this value "
- "in a report's `suggested_reviewers` once you've matched the finding's owner to this row. Null "
- "when the member has no linked GitHub identity: a null-login member can't be routed to at all "
- "(neither a login nor a uuid resolves), so pick a different owner or leave `suggested_reviewers` "
- "empty."
+ "The member's resolved GitHub login (lowercased), already resolved server-side. Null when "
+ "the member has no linked GitHub account, which does not stop you routing to them: pass "
+ "their `user_uuid` in `suggested_reviewers` and the report reaches them. A null login only "
+ "means no draft PR can be opened as that person."
),
)
diff --git a/products/signals/backend/scout_harness/skill_loader.py b/products/signals/backend/scout_harness/skill_loader.py
index 5bc0f73435db..a5cec5c81818 100644
--- a/products/signals/backend/scout_harness/skill_loader.py
+++ b/products/signals/backend/scout_harness/skill_loader.py
@@ -116,6 +116,9 @@ class SkillAuthor:
email: str
role: Literal["owner", "creator", "editor"]
last_authored_at: datetime
+ # The routing identity itself: a scout passes this straight to `suggested_reviewers`, so an
+ # author with no GitHub account still gets the reports their scout files.
+ user_uuid: str
@dataclass(frozen=True)
@@ -235,7 +238,7 @@ def _resolve_owner_authors(team: Team, skill_name: str) -> list[SkillAuthor]:
# canonical=True → exact environment team, matching how LLMSkill is scoped (see LLMSkillOwner).
LLMSkillOwner.objects.for_team(team.id, canonical=True)
.filter(skill_name=skill_name, user__in=team.all_users_with_access())
- .values("user__first_name", "user__last_name", "user__email", "created_at")
+ .values("user__uuid", "user__first_name", "user__last_name", "user__email", "created_at")
.order_by("created_at", "id")
)
authors: list[SkillAuthor] = []
@@ -248,6 +251,7 @@ def _resolve_owner_authors(team: Team, skill_name: str) -> list[SkillAuthor]:
email=row["user__email"],
role="owner",
last_authored_at=row["created_at"],
+ user_uuid=str(row["user__uuid"]),
)
)
return authors
@@ -306,6 +310,7 @@ def resolve_skill_authors(team: Team, skill_name: str) -> list[SkillAuthor]:
email=person["created_by__email"],
role=role,
last_authored_at=person["last_authored_at"],
+ user_uuid=str(person["created_by__uuid"]),
)
creator, *editors = people
diff --git a/products/signals/backend/scout_harness/tools/report.py b/products/signals/backend/scout_harness/tools/report.py
index edadb23a3fcb..e84c65495f03 100644
--- a/products/signals/backend/scout_harness/tools/report.py
+++ b/products/signals/backend/scout_harness/tools/report.py
@@ -51,7 +51,12 @@ from products.signals.backend.artefact_schemas import (
)
from products.signals.backend.models import ArtefactAttribution, SignalReport, SignalScoutRun
from products.signals.backend.report_charts import ChartSize, ReportChart, chart_batch_error
-from products.signals.backend.report_generation.resolve_reviewers import get_org_member_github_logins_by_user_uuid
+from products.signals.backend.report_generation.resolve_reviewers import (
+ ReviewerIdentitySet,
+ get_org_member_github_logins_by_user_uuid,
+ resolve_org_github_login_to_users,
+ resolve_org_users_by_uuid,
+)
from products.signals.backend.report_generation.select_repo import RepoSelectionResult
from products.signals.backend.report_prompts import normalize_suggested_prompts, suggested_prompts_batch_error
from products.signals.backend.scout_harness.prompt import SELF_IMPROVEMENT_REPORT_TITLE_PREFIX
@@ -398,17 +403,22 @@ def _build_priority(priority: str | None, explanation: str | None) -> PriorityAs
return PriorityAssessment(priority=priority_level, explanation=explanation)
-def _owner_logins(team: Team, skill_name: str) -> set[str]:
- """The running scout's owner GitHub logins (lowercased), for stamping reviewer provenance.
+def _owner_identities(team: Team, skill_name: str) -> ReviewerIdentitySet:
+ """The running scout's owners, for stamping reviewer provenance.
- Owners come from `LLMSkillOwner`. Owners with no linked GitHub identity aren't included — they
- can't be a routable reviewer, and provenance only matters for a login that could appear in the
- artefact. Used to mark, not to inject: routing is the scout's call (see `_build_suggested_reviewers`)."""
+ Owners come from `LLMSkillOwner`. Both identities are collected because an owner with no linked
+ GitHub account is a routable reviewer too, and the stamp has to recognize them however the
+ scout named them. Used to mark, not to inject: routing is the scout's call (see
+ `_build_suggested_reviewers`)."""
owner_uuids = resolve_skill_owner_user_uuids(team, skill_name)
if not owner_uuids:
- return set()
+ return ReviewerIdentitySet.empty()
uuid_to_login = get_org_member_github_logins_by_user_uuid(team.id, owner_uuids)
- return {login for login in uuid_to_login.values() if login} # already lowercased by the resolver
+ return ReviewerIdentitySet(
+ user_uuids=frozenset(str(u) for u in owner_uuids),
+ # already lowercased by the resolver
+ github_logins=frozenset(login for login in uuid_to_login.values() if login),
+ )
def _build_suggested_reviewers(
@@ -417,16 +427,17 @@ def _build_suggested_reviewers(
*,
skill_name: str | None = None,
) -> SuggestedReviewers | None:
- """Resolve reviewer entries to a canonical, lowercased, deduped `suggested_reviewers` artefact
- (GitHub logins), or None to omit it.
-
- Each scout-supplied entry identifies a reviewer by `github_login`, `user_uuid`, or both — mirroring
- the inbox `SuggestedReviewerEntryWriteSerializer`. A `user_uuid` is resolved to the org member's
- linked GitHub login (and wins over a supplied `github_login` when both are given), so a scout that
- only knows a PostHog user can still route a report. Resolution is fail-loud: a `user_uuid` that
- isn't an org member of this team with a linked GitHub identity raises `InvalidScoutReportError`
- rather than silently dropping the reviewer, since a quietly-lost reviewer is what leaves a report
- routed to no one.
+ """Resolve reviewer entries to a canonical, deduped `suggested_reviewers` artefact, or None to
+ omit it.
+
+ Each scout-supplied entry identifies a reviewer by `github_login`, `user_uuid`, or both —
+ mirroring the inbox `SuggestedReviewerEntryWriteSerializer`. A reviewer is a PostHog user, so a
+ `user_uuid` only has to name an org member of this team: a member who never connected GitHub is
+ stored by uuid with a null login and routes like anyone else. A supplied login is stored
+ alongside the uuid of the org member it names, so the entry keeps routing if they later unlink
+ GitHub. Resolution is fail-loud: a `user_uuid` that isn't an org member of this team raises
+ `InvalidScoutReportError` rather than silently dropping the reviewer, since a quietly-lost
+ reviewer is what leaves a report routed to no one.
**The scout owns routing.** Owners are *not* injected here — they're surfaced to the scout as
context (the run prompt's skill-owners line) so it can decide, and a skill body that says "route
@@ -460,30 +471,38 @@ def _build_suggested_reviewers(
raise InvalidScoutReportError("each suggested reviewer needs a github_login or a user_uuid")
uuids_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 {}
+ uuid_to_user = resolve_org_users_by_uuid(team.id, uuids_to_resolve) if uuids_to_resolve else {}
+ logins_to_resolve = {
+ (entry.github_login or "").strip().lower()
+ for entry in reviewers
+ if not entry.user_uuid and (entry.github_login or "").strip()
+ }
+ login_to_user = resolve_org_github_login_to_users(team.id, logins_to_resolve) if logins_to_resolve else {}
scout_entries: list[SuggestedReviewerEntry] = []
for entry in reviewers:
if entry.user_uuid:
- resolved = uuid_to_login.get(str(entry.user_uuid))
- if not resolved:
- raise InvalidScoutReportError(
- f"user_uuid '{entry.user_uuid}' is not an org member of this team with a linked GitHub identity"
- )
- login = resolved.lower()
+ member = uuid_to_user.get(str(entry.user_uuid))
+ if member is None:
+ raise InvalidScoutReportError(f"user_uuid '{entry.user_uuid}' is not an org member of this team")
+ user_uuid: str | None = str(member.uuid)
+ member_login = member.get_github_login()
+ login: str | None = member_login.lower() if member_login else None
else:
- login = (entry.github_login or "").strip().lower()
+ login = (entry.github_login or "").strip().lower() or None
if not login:
raise InvalidScoutReportError("github_login resolved to empty after normalization")
+ member = login_to_user.get(login)
+ user_uuid = str(member.uuid) if member is not None else None
reason = entry.reason.strip() if entry.reason and entry.reason.strip() else None
- scout_entries.append(SuggestedReviewerEntry(github_login=login, reason=reason))
+ scout_entries.append(SuggestedReviewerEntry(github_login=login, user_uuid=user_uuid, reason=reason))
- # Dedupe by login (a login + its uuid can resolve to the same person), preserving the scout's
+ # Dedupe by identity (a login and its owner's uuid are the same person), preserving the scout's
# order — there's no reordering, so the scout's ranking is the routing order.
- entries_by_login: dict[str, SuggestedReviewerEntry] = {}
+ entries_by_identity: dict[str, SuggestedReviewerEntry] = {}
for scout_entry in scout_entries:
- entries_by_login.setdefault(scout_entry.github_login, scout_entry)
- entries = list(entries_by_login.values())[:MAX_SUGGESTED_REVIEWERS]
+ entries_by_identity.setdefault(scout_entry.github_login or f"user:{scout_entry.user_uuid}", scout_entry)
+ entries = list(entries_by_identity.values())[:MAX_SUGGESTED_REVIEWERS]
if not entries:
return None
@@ -505,10 +524,15 @@ def _stamp_owner_provenance(team: Team, reviewers: SuggestedReviewers, *, skill_
the pick: autostart's live owner exclusion also resolves the touching scouts from the run's
edit/emit tallies, but those writes are best-effort — a lost tally must not lose the exclusion.
"""
- owners = _owner_logins(team, skill_name) if skill_name else set()
+ owners = _owner_identities(team, skill_name) if skill_name else ReviewerIdentitySet.empty()
entries = [
# model_copy keeps every other field (name, commit evidence) exactly as the entry carries it.
- e.model_copy(update={"is_skill_owner": e.github_login in owners, "source_skill": skill_name or None})
+ e.model_copy(
+ update={
+ "is_skill_owner": owners.covers(user_uuid=e.user_uuid, github_login=e.github_login),
+ "source_skill": skill_name or None,
+ }
+ )
for e in reviewers.root
]
return SuggestedReviewers(root=entries)
diff --git a/products/signals/backend/scout_report/persistence.py b/products/signals/backend/scout_report/persistence.py
index 017f1178fdd3..b6c9579e0a52 100644
--- a/products/signals/backend/scout_report/persistence.py
+++ b/products/signals/backend/scout_report/persistence.py
@@ -56,6 +56,7 @@ from products.signals.backend.artefact_schemas import (
)
from products.signals.backend.models import ArtefactAttribution, SignalReport, SignalReportArtefact, SignalScoutRun
from products.signals.backend.report_charts import ReportChart, chart_batch_error
+from products.signals.backend.report_generation.resolve_reviewers import ReviewerPayloadIndex
from products.signals.backend.report_generation.reviewer_telemetry import capture_suggested_reviewers_resolved
from products.signals.backend.report_generation.select_repo import RepoSelectionResult
from products.signals.backend.report_prompts import normalize_suggested_prompts, suggested_prompts_batch_error
@@ -258,7 +259,12 @@ def create_scout_report(
capture_suggested_reviewers_resolved,
team_id=team_id,
report_id=report_id,
- github_logins=[entry.github_login for entry in suggested_reviewers.root],
+ github_logins=[entry.github_login for entry in suggested_reviewers.root if entry.github_login],
+ user_uuids=[
+ entry.user_uuid
+ for entry in suggested_reviewers.root
+ if entry.user_uuid and not entry.github_login
+ ],
source="scout",
)
)
@@ -646,13 +652,22 @@ def set_report_suggested_prompts(
return True
+def _reviewer_note_label(entry: SuggestedReviewerEntry) -> str:
+ """How the audit note names a reviewer: their GitHub login, or their display name / uuid when
+ they have none. The note is read by humans, so a login-less reviewer needs something legible."""
+ if entry.github_login:
+ return entry.github_login
+ return entry.github_name or f"user {entry.user_uuid}"
+
+
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."""
+ For each supplied reviewer already on the latest `suggested_reviewers` artefact — matched by
+ user uuid or GitHub login, so the two rows recognize each other even when they name the person
+ by different fields — 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
@@ -668,19 +683,17 @@ def _merge_forward_reviewer_evidence(*, report_id: str, suggested_reviewers: Sug
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
+ prior_index = ReviewerPayloadIndex.build(prior_content)
merged: list[SuggestedReviewerEntry] = []
for entry in suggested_reviewers.root:
- prior = prior_by_login.get(entry.github_login)
+ prior = prior_index.get(user_uuid=entry.user_uuid, github_login=entry.github_login)
if prior is None:
merged.append(entry)
continue
candidate = {
"github_login": entry.github_login,
+ "user_uuid": entry.user_uuid,
"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"),
@@ -724,13 +737,13 @@ def set_scout_report_reviewers(
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`,
+ reviewers 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 False
- logins = [entry.github_login for entry in suggested_reviewers.root]
+ reviewer_labels = [_reviewer_note_label(entry) for entry in suggested_reviewers.root]
with transaction.atomic():
# 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.
@@ -747,7 +760,7 @@ def set_scout_report_reviewers(
SignalReportArtefact.add_log(
team_id=team_id,
report_id=report_id,
- content=NoteArtefact(note=f"Set suggested reviewers: {', '.join(logins)}", author=author),
+ content=NoteArtefact(note=f"Set suggested reviewers: {', '.join(reviewer_labels)}", author=author),
attribution=attribution,
)
# on_commit, not inline: `_do_edit_report` wraps this call in an outer transaction, so an
@@ -759,13 +772,14 @@ def set_scout_report_reviewers(
capture_suggested_reviewers_resolved,
team_id=team_id,
report_id=report_id,
- github_logins=[entry.github_login for entry in merged.root],
+ github_logins=[entry.github_login for entry in merged.root if entry.github_login],
+ user_uuids=[entry.user_uuid for entry in merged.root if entry.user_uuid and not entry.github_login],
source="scout_edit",
)
)
logger.info(
"signals_scout.edit_report: reviewers set",
- extra={"team_id": team_id, "report_id": report_id, "reviewer_count": len(logins)},
+ extra={"team_id": team_id, "report_id": report_id, "reviewer_count": len(reviewer_labels)},
)
return True
diff --git a/products/signals/backend/serializers.py b/products/signals/backend/serializers.py
index a0f44380942a..153fbd5a6379 100644
--- a/products/signals/backend/serializers.py
+++ b/products/signals/backend/serializers.py
@@ -1123,10 +1123,15 @@ class SignalReportArtefactSerializer(serializers.ModelSerializer):
Mapping[str, User] | None,
self.context.get("signals_github_login_to_user_map"),
)
+ reviewer_uuid_map = cast(
+ Mapping[str, User] | None,
+ self.context.get("signals_reviewer_user_uuid_map"),
+ )
return enrich_reviewer_dicts_with_org_members(
obj.team_id,
parsed,
login_to_user=reviewer_login_map,
+ uuid_to_user=reviewer_uuid_map,
)
return parsed
@@ -1135,9 +1140,9 @@ class SignalReportArtefactSerializer(serializers.ModelSerializer):
class SuggestedReviewerEntryWriteSerializer(serializers.Serializer):
"""Single entry in a PUT body for a `suggested_reviewers` artefact.
- Each entry must identify a reviewer by at least one of `github_login` or `user_uuid`.
- The server canonicalizes to a lowercase `github_login` — if `user_uuid` is supplied,
- it must map to an org member on this team with a linked GitHub login.
+ Each entry must identify a reviewer by at least one of `github_login` or `user_uuid`. A
+ `user_uuid` only has to name an org member on this team — a member with no linked GitHub
+ account is stored by uuid and routes like any other reviewer.
"""
github_login = serializers.CharField(
@@ -1149,8 +1154,8 @@ class SuggestedReviewerEntryWriteSerializer(serializers.Serializer):
user_uuid = serializers.UUIDField(
required=False,
help_text=(
- "PostHog user UUID. Must be an org member on this team with a linked GitHub identity. "
- "If supplied together with `github_login`, the server-resolved login from the user wins."
+ "PostHog user UUID. Must be an org member on this team; a linked GitHub account is not "
+ "required. If supplied together with `github_login`, the user's own identity wins."
),
)
github_name = serializers.CharField(
diff --git a/products/signals/backend/slack_inbox_notifications.py b/products/signals/backend/slack_inbox_notifications.py
index a0b44fafe420..b0c3d45ba3d8 100644
--- a/products/signals/backend/slack_inbox_notifications.py
+++ b/products/signals/backend/slack_inbox_notifications.py
@@ -39,7 +39,9 @@ from products.signals.backend.report_generation.research import ActionabilityCho
from products.signals.backend.report_generation.resolve_reviewers import (
enrich_reviewer_dicts_with_org_members,
normalized_github_logins_from_suggested_reviewer_artefacts,
+ normalized_user_uuids_from_suggested_reviewer_artefacts,
resolve_org_github_login_to_users,
+ resolve_org_users_by_uuid,
)
from products.signals.backend.slack_formatting import (
escape_slack_mrkdwn as _escape_mrkdwn,
@@ -173,23 +175,26 @@ def _latest_actionability(report: SignalReport) -> str | None:
def _resolve_suggested_reviewer_user_ids(report: SignalReport) -> set[int]:
- """Resolve the suggested-reviewer GitHub logins on the report to PostHog user IDs.
+ """Resolve the report's suggested reviewers to PostHog user IDs.
- Uses the same enrichment path the API uses so a user that connected their
- GitHub account after the report was generated is still picked up.
+ Uses the same enrichment path the API uses, so a reviewer stored by user uuid resolves whether
+ or not they have GitHub linked, and one stored by login is still picked up after they connect
+ their GitHub account.
"""
artefacts = list(
report.artefacts.filter(
type=SignalReportArtefact.ArtefactType.SUGGESTED_REVIEWERS,
- ).order_by("-created_at")
+ ).order_by("-created_at")[:1]
)
if not artefacts:
return set()
logins = normalized_github_logins_from_suggested_reviewer_artefacts(artefacts)
- if not logins:
+ user_uuids = normalized_user_uuids_from_suggested_reviewer_artefacts(artefacts)
+ if not logins and not user_uuids:
return set()
- login_map = resolve_org_github_login_to_users(report.team_id, logins)
+ login_map = resolve_org_github_login_to_users(report.team_id, logins) if logins else {}
+ uuid_map = resolve_org_users_by_uuid(report.team_id, user_uuids) if user_uuids else {}
unmapped_count = len(logins - login_map.keys())
if unmapped_count:
# These reviewers can't get a personal-channel notification; when the whole list is
@@ -202,7 +207,7 @@ def _resolve_suggested_reviewer_user_ids(report: SignalReport) -> set[int]:
unmapped_count,
len(logins),
)
- if not login_map:
+ if not login_map and not uuid_map:
return set()
# Enrich each artefact's payload to drop reviewers that didn't resolve to a user.
@@ -214,7 +219,9 @@ def _resolve_suggested_reviewer_user_ids(report: SignalReport) -> set[int]:
continue
if not isinstance(parsed, list):
continue
- enriched = enrich_reviewer_dicts_with_org_members(report.team_id, parsed, login_to_user=login_map)
+ enriched = enrich_reviewer_dicts_with_org_members(
+ report.team_id, parsed, login_to_user=login_map, uuid_to_user=uuid_map
+ )
for entry in enriched:
user = entry.get("user") if isinstance(entry, dict) else None
if isinstance(user, dict) and user.get("id"):
@@ -751,6 +758,7 @@ def dispatch_reviewer_added_notifications(
added_github_logins: Iterable[str],
source_products: list[str] | None = None,
exclude_user_id: int | None = None,
+ added_user_uuids: Iterable[str] | None = None,
) -> int:
"""Notify reviewers a human just added to an already-actionable report.
@@ -767,7 +775,8 @@ def dispatch_reviewer_added_notifications(
so someone adding themselves isn't pinged. Best-effort; returns messages sent.
"""
added_logins = {s.strip().lower() for s in added_github_logins if s and s.strip()}
- if not added_logins:
+ added_uuids = {s.strip() for s in (added_user_uuids or []) if s and s.strip()}
+ if not added_logins and not added_uuids:
return 0
try:
@@ -785,8 +794,13 @@ def dispatch_reviewer_added_notifications(
if report.status != SignalReport.Status.READY or _latest_actionability(report) not in _ACTIONABLE_VALUES:
return 0
- login_to_user = resolve_org_github_login_to_users(team_id, added_logins)
- user_ids = {user.id for user in login_to_user.values() if user.id != exclude_user_id}
+ # A reviewer added by uuid may have no GitHub login at all, so resolve both identities: the
+ # personal ping is the whole point of this path, and losing it would leave them unnotified.
+ resolved_users = [
+ *(resolve_org_github_login_to_users(team_id, added_logins).values() if added_logins else []),
+ *(resolve_org_users_by_uuid(team_id, added_uuids).values() if added_uuids else []),
+ ]
+ user_ids = {user.id for user in resolved_users if user.id != exclude_user_id}
# Org membership alone isn't enough: on a private project an org member without project
# access must not receive the report's contents, so intersect with the project's access set.
if user_ids:
diff --git a/products/signals/backend/tasks.py b/products/signals/backend/tasks.py
index 74f0ca7d7ea6..c2f88ef95ba1 100644
--- a/products/signals/backend/tasks.py
+++ b/products/signals/backend/tasks.py
@@ -286,7 +286,10 @@ def enqueue_scout_slack_delivery(
)
@with_team_scope()
def send_reviewer_added_slack_notifications(
- report_id: str, team_id: int, added_github_logins: list[str], exclude_user_id: int | None = None
+ report_id: str,
+ team_id: int,
+ added_github_logins: list[str],
+ exclude_user_id: int | None = None,
) -> None:
"""Slack-ping reviewers a human just added to a report.
@@ -312,10 +315,13 @@ def send_reviewer_added_slack_notifications(
report_id=report_id,
team_id=team_id,
)
+ github_logins = [value for value in added_github_logins if not value.startswith("user:")]
+ user_uuids = [value.removeprefix("user:") for value in added_github_logins if value.startswith("user:")]
dispatch_reviewer_added_notifications(
report_id=report_id,
team_id=team_id,
- added_github_logins=added_github_logins,
+ added_github_logins=github_logins,
+ added_user_uuids=user_uuids,
source_products=source_products,
exclude_user_id=exclude_user_id,
)
diff --git a/products/signals/backend/temporal/agentic/report.py b/products/signals/backend/temporal/agentic/report.py
index 0e1643a9f0a9..a442b2e7391b 100644
--- a/products/signals/backend/temporal/agentic/report.py
+++ b/products/signals/backend/temporal/agentic/report.py
@@ -250,9 +250,8 @@ def _build_reviewers_content(
- PostHog user enrichment happens at read time (in the artefact serializer via
``enrich_reviewer_dicts_with_org_members``) so it stays fresh when users
connect/disconnect their GitHub account.
- - The list view resolves ``is_suggested_reviewer`` by looking up the current
- user's GitHub login and checking for jsonb containment on ``github_login``
- in this artefact's content — no cached user IDs needed.
+ - The list view resolves ``is_suggested_reviewer`` by jsonb containment on this artefact's
+ content, matching the current user's uuid or their GitHub login — no cached user IDs needed.
"""
commit_hashes_with_reasons: dict[str, str] = {}
for finding in findings:
@@ -267,6 +266,9 @@ def _build_reviewers_content(
reviewers_content.append(
ReviewerContent(
github_login=reviewer.login.lower(),
+ # Commit authorship only ever names a GitHub account, so this path stores no uuid;
+ # read-time enrichment resolves the login to a member as it always has.
+ user_uuid=None,
github_name=reviewer.name,
relevant_commits=[dict(commit.model_dump()) for commit in reviewer.commits],
reason=None,
@@ -474,7 +476,7 @@ async def _persist_agentic_report_artefacts(
await database_sync_to_async(capture_suggested_reviewers_resolved, thread_sensitive=False)(
team_id=team_id,
report_id=report_id,
- github_logins=[reviewer["github_login"] for reviewer in reviewers_content],
+ github_logins=[login for reviewer in reviewers_content if (login := reviewer["github_login"])],
source="pipeline",
)
elif not reviewers_content:
diff --git a/products/signals/backend/test/test_auto_start.py b/products/signals/backend/test/test_auto_start.py
index 7e282ecf6f83..cd9f7071e083 100644
--- a/products/signals/backend/test/test_auto_start.py
+++ b/products/signals/backend/test/test_auto_start.py
@@ -23,7 +23,7 @@ from products.signals.backend.auto_start import (
_build_autostart_task_description,
_create_implementation_task_if_absent,
_generate_self_driving_head_branch,
- _live_skill_owner_logins,
+ _live_skill_owner_identities,
_report_meets_team_autostart_threshold,
_resolve_autostart_assignee,
_resolve_autostart_fallback_user,
@@ -51,6 +51,7 @@ from products.signals.backend.report_generation.research import (
Priority,
PriorityAssessment,
)
+from products.signals.backend.report_generation.resolve_reviewers import ReviewerIdentitySet
from products.signals.backend.signal_metadata import SignalSourceReference
from products.signals.backend.task_run_artefacts import TASK_RUN_TYPE_IMPLEMENTATION, signals_task_ids
from products.signals.backend.test.test_billing import _seed_canonical_scout_skill
@@ -79,9 +80,16 @@ def _create_org_member_with_github(email: str, organization: Organization, login
return user
-def _reviewer(login: str, *, is_skill_owner: bool = False, source_skill: str | None = None) -> ReviewerContent:
+def _reviewer(
+ login: str | None,
+ *,
+ user_uuid: str | None = None,
+ is_skill_owner: bool = False,
+ source_skill: str | None = None,
+) -> ReviewerContent:
return ReviewerContent(
github_login=login,
+ user_uuid=user_uuid,
github_name=None,
relevant_commits=[],
reason=None,
@@ -124,6 +132,22 @@ def test_resolve_autostart_assignee(
assert assignee is None
+def test_resolve_autostart_assignee_binds_a_login_to_the_stored_uuid(organization, team):
+ original = _create_org_member_with_github("[email protected]", organization, "CurrentLogin")
+ _create_org_member_with_github("[email protected]", organization, "StaleLogin")
+
+ assignee = _resolve_autostart_assignee(
+ team_id=team.id,
+ report_priority=Priority.P0,
+ reviewers_content=[_reviewer("stalelogin", user_uuid=str(original.uuid))],
+ team_default_priority=Priority.P4,
+ )
+
+ assert assignee is not None
+ assert assignee.id == original.id
+
+
@pytest.mark.django_db
def test_resolve_autostart_assignee_never_runs_as_a_skill_owner(organization, team):
# The owner guardrail places editor-controlled `LLMSkillOwner`s first in suggested_reviewers, but
@@ -171,7 +195,7 @@ def test_resolve_autostart_assignee_excludes_live_owners_past_a_stale_stamp(orga
# Stamp says not-an-owner (stale); the live set says otherwise.
reviewers_content=[_reviewer("ownercat", is_skill_owner=False), _reviewer("authorcat")],
team_default_priority=Priority.P4,
- live_owner_logins={"ownercat"},
+ live_owner_identities=ReviewerIdentitySet(user_uuids=frozenset(), github_logins=frozenset({"ownercat"})),
)
assert assignee is not None
assert assignee.id == author.id
@@ -205,7 +229,7 @@ def test_live_owner_logins_span_every_scout_that_touched_the_report(organization
)
LLMSkillOwner.objects.create(team=team, skill_name=editing_skill, user=owner)
- assert _live_skill_owner_logins(team, str(report.id), []) == {"editorowner"}
+ assert _live_skill_owner_identities(team, str(report.id), []).github_logins == frozenset({"editorowner"})
@pytest.mark.django_db
@@ -222,7 +246,7 @@ def test_live_owner_logins_survive_a_lost_edit_tally(organization, team):
LLMSkillOwner.objects.create(team=team, skill_name="signals-scout-tallyless", user=owner)
reviewers = [_reviewer("tallylessowner", source_skill="signals-scout-tallyless")]
- assert _live_skill_owner_logins(team, str(report.id), reviewers) == {"tallylessowner"}
+ assert _live_skill_owner_identities(team, str(report.id), reviewers).github_logins == frozenset({"tallylessowner"})
@pytest.mark.parametrize(
diff --git a/products/signals/backend/test/test_custom_agent_log_artefacts.py b/products/signals/backend/test/test_custom_agent_log_artefacts.py
index 81d4bb270793..b975b7a00263 100644
--- a/products/signals/backend/test/test_custom_agent_log_artefacts.py
+++ b/products/signals/backend/test/test_custom_agent_log_artefacts.py
@@ -8,7 +8,13 @@ from asgiref.sync import async_to_sync
from pydantic import BaseModel
import products.signals.backend.temporal.custom_agent # noqa: F401 (warms the base<->temporal import cycle so standalone collection works)
-from products.signals.backend.artefact_schemas import ArtefactContentValidationError, CodeReference, NoteArtefact
+from products.signals.backend.artefact_schemas import (
+ ArtefactContentValidationError,
+ CodeReference,
+ NoteArtefact,
+ SuggestedReviewerEntry,
+ SuggestedReviewers,
+)
from products.signals.backend.custom_agent.base import NO_REPO, CustomSignalAgent
from products.signals.backend.custom_agent.persistence import (
PersistedCustomAgentReport,
@@ -180,3 +186,17 @@ class TestCustomAgentLogArtefacts(BaseTest):
)
assert len(rows) == 2
assert json.loads(rows[-1].content)["priority"] == "P0"
+
+ def test_registered_uuid_only_reviewer_is_included_in_telemetry(self):
+ reviewer_uuid = uuid.uuid4()
+ with patch("products.signals.backend.custom_agent.persistence.capture_suggested_reviewers_resolved") as capture:
+ create_custom_agent_ready_report(
+ team_id=self.team.id,
+ final_report=self._final_report(),
+ repo_selection=RepoSelectionResult(repository="acme/repo", reason="r"),
+ agent_identifier=("billing", "anomaly_scan"),
+ registered_artefacts=[SuggestedReviewers(root=[SuggestedReviewerEntry(user_uuid=str(reviewer_uuid))])],
+ )
+
+ assert capture.call_args.kwargs["github_logins"] == []
+ assert capture.call_args.kwargs["user_uuids"] == [str(reviewer_uuid)]
diff --git a/products/signals/backend/test/test_resolve_reviewers.py b/products/signals/backend/test/test_resolve_reviewers.py
index e9fcfed2f96c..ad33f3658180 100644
--- a/products/signals/backend/test/test_resolve_reviewers.py
+++ b/products/signals/backend/test/test_resolve_reviewers.py
@@ -27,6 +27,7 @@ from products.signals.backend.report_generation.resolve_reviewers import (
_recency_multiplier,
_relevant_area_activity,
_score_candidates,
+ enrich_reviewer_dicts_with_org_members,
rank_assignee_candidates,
resolve_org_github_login_to_users,
resolve_suggested_reviewers,
@@ -112,6 +113,20 @@ def test_returns_empty_when_no_match(organization, team):
assert result == {}
+def test_uuid_reviewer_does_not_fall_back_to_a_reassigned_login(organization, team):
+ original = _create_org_member("[email protected]", organization)
+ replacement = _create_org_member("[email protected]", organization)
+ _make_social_auth(replacement, team, "reassigned")
+
+ enriched = enrich_reviewer_dicts_with_org_members(
+ team.id,
+ [{"user_uuid": str(original.uuid), "github_login": "reassigned"}],
+ )
+
+ assert enriched[0]["user"]["id"] == original.id
+
+
@pytest.mark.django_db
def test_skips_users_outside_organization(organization, team):
other_org = Organization.objects.create(name="test-resolve-reviewers-other-org")
diff --git a/products/signals/backend/test/test_reviewer_telemetry.py b/products/signals/backend/test/test_reviewer_telemetry.py
index 8ced7fe3d6c9..2448a140fab3 100644
--- a/products/signals/backend/test/test_reviewer_telemetry.py
+++ b/products/signals/backend/test/test_reviewer_telemetry.py
@@ -1,3 +1,5 @@
+from uuid import uuid4
+
import pytest
from unittest.mock import patch
@@ -26,6 +28,8 @@ def test_captures_linkable_unlinkable_split(organization, team):
user = User.objects.create(email="[email protected]")
OrganizationMembership.objects.create(user=user, organization=organization)
UserSocialAuth.objects.create(user=user, provider="github", uid="gh-1", extra_data={"login": "octocat"})
+ unlinked_member = User.objects.create(email="[email protected]")
+ OrganizationMembership.objects.create(user=unlinked_member, organization=organization)
with patch(
"products.signals.backend.report_generation.reviewer_telemetry.posthoganalytics.capture"
@@ -34,6 +38,9 @@ def test_captures_linkable_unlinkable_split(organization, team):
team_id=team.id,
report_id="report-1",
github_logins=["OctoCat", "ghost-contrib", " ", "octocat"],
+ # A member with no GitHub, an invented uuid the generic artefact API would still store,
+ # and the member again in a different spelling: resolved and deduped like logins.
+ user_uuids=[str(unlinked_member.uuid), str(uuid4()), str(unlinked_member.uuid).upper()],
source="pipeline",
)
@@ -44,11 +51,13 @@ def test_captures_linkable_unlinkable_split(organization, team):
assert props["team_id"] == team.id
assert props["report_id"] == "report-1"
assert props["source"] == "pipeline"
- assert props["suggested_count"] == 2
+ assert props["suggested_count"] == 4
assert props["linkable_logins"] == ["octocat"]
assert props["unlinkable_logins"] == ["ghost-contrib"]
- assert props["linkable_count"] == 1
- assert props["unlinkable_count"] == 1
+ assert props["linkable_count"] == 2
+ assert props["unlinkable_count"] == 2
+ assert props["user_uuid_only_count"] == 1
+ assert props["unlinkable_user_uuid_count"] == 1
assert props["all_unlinkable"] is False
diff --git a/products/signals/backend/test/test_scout_harness.py b/products/signals/backend/test/test_scout_harness.py
index ee016f0b710c..ff992f860afa 100644
--- a/products/signals/backend/test/test_scout_harness.py
+++ b/products/signals/backend/test/test_scout_harness.py
@@ -1029,8 +1029,9 @@ class TestPromptBuilder(BaseTest):
team_id=self.team.id,
started_at=datetime(2026, 5, 1, 12, 34, 56, tzinfo=UTC),
)
- assert "**skill authors**: created by Ben ([email protected]); since edited by" in prompt
- assert self.user.email in prompt
+ # The uuid on the line is what the scout routes to, so an author with no GitHub still gets the report.
+ assert f"**skill authors**: created by Ben ([email protected], user_uuid `{ben.uuid}`); since edited by" in prompt
+ assert f"({self.user.email}, user_uuid `{self.user.uuid}`" in prompt
# The authors line is a default, not an override — dropping the precedence hedge would
# set the harness up to fight a skill body that defines its own reviewer routing.
assert "unless your skill body defines its own reviewer routing" in prompt
diff --git a/products/signals/backend/test/test_scout_report_api.py b/products/signals/backend/test/test_scout_report_api.py
index 95778bbcd87f..6550897a4b69 100644
--- a/products/signals/backend/test/test_scout_report_api.py
+++ b/products/signals/backend/test/test_scout_report_api.py
@@ -19,6 +19,7 @@ from posthog.models.organization import OrganizationMembership
from products.signals.backend.artefact_schemas import Priority, PriorityAssessment, SuggestedReviewers, TaskRunArtefact
from products.signals.backend.models import ArtefactAttribution, SignalReport, SignalReportArtefact, SignalSourceConfig
+from products.signals.backend.report_generation.resolve_reviewers import ReviewerIdentitySet
from products.signals.backend.scout_harness.tools.report import (
MAX_EVIDENCE_DESCRIPTION_LENGTH,
MAX_REPORT_SIGNALS,
@@ -940,8 +941,11 @@ class TestScoutReportAPI(APIBaseTest):
report = SignalReport.objects.create(team=self.team, status=SignalReport.Status.READY, title="pipeline report")
with (
patch(
- "products.signals.backend.scout_harness.tools.report._owner_logins",
- side_effect=[set(), {"octocat"}],
+ "products.signals.backend.scout_harness.tools.report._owner_identities",
+ side_effect=[
+ ReviewerIdentitySet.empty(),
+ ReviewerIdentitySet(user_uuids=frozenset(), github_logins=frozenset({"octocat"})),
+ ],
),
patch(AUTOSTART_PATH, new=AsyncMock()),
):
@@ -1624,16 +1628,16 @@ class TestBuildSuggestedReviewers(APIBaseTest):
assert result is not None
assert [e.github_login for e in result.root] == ["dupe"]
- @parameterized.expand([("not_an_org_member",), ("member_without_github_identity",)])
- def test_unresolvable_user_uuid_raises(self, case: str) -> None:
- if case == "member_without_github_identity":
- orphan = User.objects.create(email="[email protected]")
- OrganizationMembership.objects.create(user=orphan, organization=self.organization)
- target = str(orphan.uuid)
- else:
- target = str(uuid4())
+ def test_non_member_user_uuid_raises(self) -> None:
with pytest.raises(InvalidScoutReportError):
- _build_suggested_reviewers(self.team, [ReviewerInput(user_uuid=target)])
+ _build_suggested_reviewers(self.team, [ReviewerInput(user_uuid=str(uuid4()))])
+
+ def test_member_without_github_identity_is_stored_by_uuid(self) -> None:
+ member = User.objects.create(email="[email protected]")
+ OrganizationMembership.objects.create(user=member, organization=self.organization)
+ result = _build_suggested_reviewers(self.team, [ReviewerInput(user_uuid=str(member.uuid))])
+ assert result is not None
+ assert [(e.user_uuid, e.github_login) for e in result.root] == [(str(member.uuid), None)]
@parameterized.expand([("none", None), ("empty", [])])
def test_no_entries_yields_none(self, _name: str, reviewers: list | None) -> None:
diff --git a/products/signals/backend/test/test_signal_report_api.py b/products/signals/backend/test/test_signal_report_api.py
index 161f92ed1463..9fff843829bb 100644
--- a/products/signals/backend/test/test_signal_report_api.py
+++ b/products/signals/backend/test/test_signal_report_api.py
@@ -2091,20 +2091,20 @@ class TestAvailableReviewersAPI(APIBaseTest):
email=f"user{n:04d}@example.com",
)
- def _login_map(self, count: int) -> dict[str, SimpleNamespace]:
- return {f"gh{n}": self._fake_user(n) for n in range(count)}
+ def _member_map(self, count: int) -> dict[str, SimpleNamespace]:
+ return {str(uuid.UUID(int=n)): self._fake_user(n) for n in range(count)}
- @patch("products.signals.backend.views.get_org_member_github_login_to_user_map")
+ @patch("products.signals.backend.views.get_org_member_users_by_uuid")
def test_returns_all_members_without_cap(self, mock_map):
# 250 > the old hard cap of 100: every member must come back now.
- mock_map.return_value = self._login_map(250)
+ mock_map.return_value = self._member_map(250)
response = self.client.get(self._url())
assert response.status_code == status.HTTP_200_OK
assert len(response.json()) == 250
- @patch("products.signals.backend.views.get_org_member_github_login_to_user_map")
+ @patch("products.signals.backend.views.get_org_member_users_by_uuid")
def test_search_query_filters_server_side(self, mock_map):
- mock_map.return_value = self._login_map(250)
+ mock_map.return_value = self._member_map(250)
response = self.client.get(self._url(query="User0123"))
assert response.status_code == status.HTTP_200_OK
body = response.json()
@@ -2112,48 +2112,48 @@ class TestAvailableReviewersAPI(APIBaseTest):
assert next(iter(body.values()))["email"] == "[email protected]"
@patch("products.signals.backend.views.capture_exception")
- @patch("products.signals.backend.views.get_org_member_github_login_to_user_map")
+ @patch("products.signals.backend.views.get_org_member_users_by_uuid")
def test_no_exception_captured_under_threshold(self, mock_map, mock_capture):
- mock_map.return_value = self._login_map(50)
+ mock_map.return_value = self._member_map(50)
response = self.client.get(self._url())
assert response.status_code == status.HTTP_200_OK
mock_capture.assert_not_called()
@patch("products.signals.backend.views.capture_exception")
- @patch("products.signals.backend.views.get_org_member_github_login_to_user_map")
+ @patch("products.signals.backend.views.get_org_member_users_by_uuid")
def test_exception_captured_over_threshold(self, mock_map, mock_capture):
- mock_map.return_value = self._login_map(1201)
+ mock_map.return_value = self._member_map(1201)
response = self.client.get(self._url())
assert response.status_code == status.HTTP_200_OK
assert len(response.json()) == 1201
mock_capture.assert_called_once()
@patch("products.signals.backend.views.capture_exception")
- @patch("products.signals.backend.views.get_org_member_github_login_to_user_map")
+ @patch("products.signals.backend.views.get_org_member_users_by_uuid")
def test_threshold_capture_deduplicated_across_requests(self, mock_map, mock_capture):
# Repeated popover opens for the same over-threshold org must report at most once.
- mock_map.return_value = self._login_map(1201)
+ mock_map.return_value = self._member_map(1201)
for _ in range(3):
assert self.client.get(self._url()).status_code == status.HTTP_200_OK
mock_capture.assert_called_once()
@patch("products.signals.backend.views.capture_exception")
- @patch("products.signals.backend.views.get_org_member_github_login_to_user_map")
+ @patch("products.signals.backend.views.get_org_member_users_by_uuid")
def test_threshold_not_triggered_by_search_requests(self, mock_map, mock_capture):
# A search-as-you-type request must not spam the threshold capture.
- mock_map.return_value = self._login_map(1201)
+ mock_map.return_value = self._member_map(1201)
response = self.client.get(self._url(query="User0001"))
assert response.status_code == status.HTTP_200_OK
mock_capture.assert_not_called()
- @patch("products.signals.backend.views.get_org_member_github_login_to_user_map")
+ @patch("products.signals.backend.views.get_org_member_users_by_uuid")
def test_empty_org_returns_empty(self, mock_map):
mock_map.return_value = {}
response = self.client.get(self._url())
assert response.status_code == status.HTTP_200_OK
assert response.json() == {}
- @patch("products.signals.backend.views.get_org_member_github_login_to_user_map")
+ @patch("products.signals.backend.views.get_org_member_users_by_uuid")
def test_missing_team_map_returns_empty(self, mock_map):
# The helper returns None for an unknown team; the view coalesces it to an empty result.
mock_map.return_value = None
diff --git a/products/signals/backend/test/test_signal_report_artefact_api.py b/products/signals/backend/test/test_signal_report_artefact_api.py
index 79a515a3ef5c..915f0de44767 100644
--- a/products/signals/backend/test/test_signal_report_artefact_api.py
+++ b/products/signals/backend/test/test_signal_report_artefact_api.py
@@ -542,8 +542,9 @@ class TestSignalReportArtefactViewSet(APIBaseTest):
stored = self._latest_reviewers(report)
assert stored[0]["github_login"] == "alicecase"
- def test_put_user_uuid_without_github_login_returns_400(self):
- # Org member without any linked GitHub identity.
+ def test_put_user_uuid_without_github_login_is_stored_by_uuid(self):
+ # Org member without any linked GitHub identity still routes: stored by uuid with a null
+ # login, and the response resolves them to their PostHog user.
member = self._create_org_member("[email protected]", github_login=None)
report = self._create_report()
artefact = self._create_artefact(report, content=[])
@@ -553,6 +554,20 @@ class TestSignalReportArtefactViewSet(APIBaseTest):
data=json.dumps({"content": [{"user_uuid": str(member.uuid)}]}),
content_type="application/json",
)
+ assert response.status_code == status.HTTP_200_OK
+ stored = self._latest_reviewers(report)
+ assert [(e["user_uuid"], e["github_login"]) for e in stored] == [(str(member.uuid), None)]
+ assert response.json()["content"][0]["user"]["uuid"] == str(member.uuid)
+
+ def test_put_non_member_user_uuid_returns_400(self):
+ report = self._create_report()
+ artefact = self._create_artefact(report, content=[])
+
+ response = self.client.put(
+ self._detail_url(str(report.id), str(artefact.id)),
+ data=json.dumps({"content": [{"user_uuid": str(uuid.uuid4())}]}),
+ content_type="application/json",
+ )
assert response.status_code == status.HTTP_400_BAD_REQUEST
assert "not an org member" in response.json()["error"]
@@ -691,6 +706,22 @@ class TestSignalReportArtefactViewSet(APIBaseTest):
assert response.status_code == status.HTTP_200_OK
assert not ActivityLog.objects.filter(team_id=self.team.id, scope="SignalReport").exists()
+ def test_put_deduplicates_prior_reviewers_before_it_computes_changes(self):
+ report = self._create_report()
+ artefact = self._create_artefact(
+ report,
+ content=[{"github_login": "alice"}, {"github_login": "alice"}],
+ )
+
+ response = self.client.put(
+ self._detail_url(str(report.id), str(artefact.id)),
+ data=json.dumps({"content": [{"github_login": "alice"}]}),
+ content_type="application/json",
+ )
+
+ assert response.status_code == status.HTTP_200_OK
+ assert not ActivityLog.objects.filter(team_id=self.team.id, scope="SignalReport").exists()
+
def test_put_reviewers_ignores_task_header_and_attributes_to_requesting_user(self):
# The reviewers write is app/user-only, so a supplied X-PostHog-Task-Id must be ignored and
# the row attributed to the requesting user. A task-attributed row (created_by_id=None) would
@@ -870,6 +901,25 @@ class TestSignalReportArtefactViewSet(APIBaseTest):
ids = {r["id"] for r in list_response.json()["results"]}
assert str(report.id) in ids
+ def test_filter_does_not_match_a_reassigned_login_on_a_uuid_entry(self):
+ original = self._create_org_member("[email protected]")
+ replacement = self._create_org_member("[email protected]", github_login="reassigned")
+ report = self._create_report()
+ self._create_artefact(
+ report,
+ content=[{"user_uuid": str(original.uuid), "github_login": "reassigned"}],
+ )
+
+ original_response = self.client.get(
+ f"/api/projects/{self.team.id}/signals/reports/?suggested_reviewers={original.uuid}"
+ )
+ replacement_response = self.client.get(
+ f"/api/projects/{self.team.id}/signals/reports/?suggested_reviewers={replacement.uuid}"
+ )
+
+ assert str(report.id) in {row["id"] for row in original_response.json()["results"]}
+ assert str(report.id) not in {row["id"] for row in replacement_response.json()["results"]}
+
def test_diff_with_non_dict_content_returns_400_not_500(self):
# Log content is stored as arbitrary JSON; a non-object commit payload must not 500.
report = self._create_report()
diff --git a/products/signals/backend/test/test_slack_inbox_notifications.py b/products/signals/backend/test/test_slack_inbox_notifications.py
index 333e60f0a417..e6fbe0d12ce4 100644
--- a/products/signals/backend/test/test_slack_inbox_notifications.py
+++ b/products/signals/backend/test/test_slack_inbox_notifications.py
@@ -27,6 +27,7 @@ from products.signals.backend.slack_inbox_notifications import (
_build_signal_thread_blocks,
_meets_min_priority,
_resolve_reviewer_mentions,
+ _resolve_suggested_reviewer_user_ids,
_signal_source_line,
_summary_excerpt,
dispatch_inbox_item_notifications,
@@ -421,6 +422,28 @@ def test_dispatch_falls_back_to_team_channel_without_suggested_reviewers(org_and
assert "Suggested reviewers" not in json.dumps(fake_client.chat_postMessage.call_args.kwargs["blocks"])
+def test_reviewer_resolution_uses_only_the_latest_reviewer_row(org_and_team):
+ org, team = org_and_team
+ old_reviewer = _make_reviewer_user(org, "[email protected]", "old-reviewer")
+ current_reviewer = _make_reviewer_user(org, "[email protected]", "current-reviewer")
+ report = _make_ready_report(team, priority=AutonomyPriority.P1)
+ SignalReportArtefact.objects.create(
+ team=team,
+ report=report,
+ type=SignalReportArtefact.ArtefactType.SUGGESTED_REVIEWERS,
+ content=json.dumps([{"user_uuid": str(old_reviewer.uuid)}]),
+ )
+ SignalReportArtefact.objects.create(
+ team=team,
+ report=report,
+ type=SignalReportArtefact.ArtefactType.SUGGESTED_REVIEWERS,
+ content=json.dumps([{"user_uuid": str(current_reviewer.uuid)}]),
+ )
+
+ assert _resolve_suggested_reviewer_user_ids(report) == {current_reviewer.id}
+
+
@pytest.mark.django_db
def test_dispatch_does_not_use_own_channel_as_fallback_without_reviewers(org_and_team):
# A per-user own channel is a reviewer notification, not a team catch-all. With no team default
@@ -1234,3 +1257,23 @@ def test_reviewer_added_task_still_dispatches_when_source_product_lookup_fails(o
mock_dispatch.assert_called_once()
assert mock_dispatch.call_args.kwargs["source_products"] is None
+
+
+def test_reviewer_added_task_decodes_uuid_from_the_legacy_argument(org_and_team):
+ _, team = org_and_team
+ with (
+ patch(
+ "products.signals.backend.signal_metadata.fetch_source_products_for_reports",
+ return_value={},
+ ),
+ patch("products.signals.backend.tasks.dispatch_reviewer_added_notifications") as mock_dispatch,
+ ):
+ send_reviewer_added_slack_notifications(
+ report_id="019f0000-0000-7000-8000-000000000000",
+ team_id=team.id,
+ added_github_logins=["linked-user", "user:019f0000-0000-7000-8000-000000000001"],
+ )
+
+ assert mock_dispatch.call_args.kwargs["added_github_logins"] == ["linked-user"]
+ assert mock_dispatch.call_args.kwargs["added_user_uuids"] == ["019f0000-0000-7000-8000-000000000001"]
diff --git a/products/signals/backend/views.py b/products/signals/backend/views.py
index d35891dc505f..cfd06ca72375 100644
--- a/products/signals/backend/views.py
+++ b/products/signals/backend/views.py
@@ -53,6 +53,7 @@ from posthog.api.integration import github_rate_limited_response
from posthog.api.mixins import ValidatedRequest, validated_request
from posthog.api.routing import TeamAndOrgViewSetMixin
from posthog.auth import InternalAPIAuthentication, OAuthAccessTokenAuthentication, PersonalAPIKeyAuthentication
+from posthog.dataclasses import frozen
from posthog.egress.github.transport import GitHubEgressBudgetExhausted, GitHubRateLimitError
from posthog.egress.limiter.policies import Priority
from posthog.event_usage import report_user_action
@@ -121,10 +122,13 @@ from products.signals.backend.repo_corrections import sanitized_repository
from products.signals.backend.report_assignments import InvalidPullRequestUrl, ReportClaimConflict, claim_report
from products.signals.backend.report_generation.research import ActionabilityChoice
from products.signals.backend.report_generation.resolve_reviewers import (
- get_org_member_github_login_to_user_map,
+ ReviewerPayloadIndex,
get_org_member_github_logins_by_user_uuid,
+ get_org_member_users_by_uuid,
normalized_github_logins_from_suggested_reviewer_artefacts,
+ normalized_user_uuids_from_suggested_reviewer_artefacts,
resolve_org_github_login_to_users,
+ resolve_org_users_by_uuid,
)
from products.signals.backend.report_generation.reviewer_telemetry import capture_suggested_reviewers_resolved
from products.signals.backend.reviewer_correction_notes import ReviewerCorrection, forward_reviewer_correction_note
@@ -1293,22 +1297,31 @@ class SignalReportViewSet(
except (ValueError, AttributeError) as e:
raise serializers.ValidationError({"suggested_reviewers": f"Invalid user UUID: {e}"})
+ # A reviewer entry identifies its person by `user_uuid`, by `github_login`, or by both, so
+ # match on either: the requested users' own uuids, plus their logins for the entries written
+ # before reviewers carried a uuid.
reviewer_github_logins = list(
get_org_member_github_logins_by_user_uuid(self.team.id, reviewer_user_uuids).values()
)
- if not reviewer_github_logins:
+ uuid_filters = [json.dumps([{"user_uuid": user_uuid}]) for user_uuid in reviewer_user_uuids]
+ if not uuid_filters and not reviewer_github_logins:
return queryset.none()
-
- reviewer_json_filters = [
- json.dumps([{"github_login": github_login}]) for github_login in reviewer_github_logins
- ]
- reviewer_where = " OR ".join(["content::jsonb @> %s::jsonb"] * len(reviewer_json_filters))
+ reviewer_clauses = ["content::jsonb @> %s::jsonb"] * len(uuid_filters)
+ reviewer_params: list[str] = list(uuid_filters)
+ for github_login in reviewer_github_logins:
+ reviewer_clauses.append(
+ "EXISTS (SELECT 1 FROM jsonb_array_elements(content::jsonb) reviewer "
+ "WHERE lower(reviewer->>'github_login') = %s "
+ "AND NULLIF(reviewer->>'user_uuid', '') IS NULL)"
+ )
+ reviewer_params.append(github_login)
+ reviewer_where = " OR ".join(reviewer_clauses)
return queryset.filter(
Exists(
# nosemgrep: python.django.security.audit.query-set-extra.avoid-query-set-extra (parameterized via params)
self._latest_suggested_reviewers_qs().extra(
where=[reviewer_where],
- params=reviewer_json_filters,
+ params=reviewer_params,
)
)
)
@@ -1563,16 +1576,21 @@ class SignalReportViewSet(
# even when a user connects their GitHub account after the report was generated.
# Never true for ready + not_actionable — there is nothing actionable to review.
# Failed reports are excluded too — pipelines that errored should not bubble as "needs your review".
- github_login = self._get_github_login(self.request.user)
- if not github_login:
- return queryset.annotate(is_suggested_reviewer=Value(False))
+ # Match the user's own uuid as well as their login: a reviewer with no linked GitHub
+ # account is stored by uuid alone, and entries predating `user_uuid` carry only a login.
+ user = cast(User, self.request.user)
+ github_login = self._get_github_login(user)
+ identity_filters = [json.dumps([{"user_uuid": str(user.uuid)}])]
+ if github_login:
+ # github_login comes from our own UserSocialAuth DB, not user input.
+ identity_filters.append(json.dumps([{"github_login": github_login}]))
+ identity_where = " OR ".join(["content::jsonb @> %s::jsonb"] * len(identity_filters))
- # github_login comes from our own UserSocialAuth DB, not user input.
suggested_exists = Exists(
# nosemgrep: python.django.security.audit.query-set-extra.avoid-query-set-extra (parameterized via params)
self._latest_suggested_reviewers_qs().extra(
- where=["content::jsonb @> %s::jsonb"],
- params=[json.dumps([{"github_login": github_login}])],
+ where=[identity_where],
+ params=identity_filters,
)
)
return queryset.annotate(
@@ -2095,11 +2113,11 @@ class SignalReportViewSet(
@action(detail=False, methods=["get"], url_path="available_reviewers", required_scopes=["task:read"])
def available_reviewers(self, request, **kwargs):
with tracer.start_as_current_span("signals.available_reviewers") as span:
- login_to_user = get_org_member_github_login_to_user_map(self.team.id) or {}
+ # Every org member, not only the GitHub-linked ones: a reviewer is a PostHog user, so a
+ # teammate who never connected GitHub is still pickable — and can pick themselves.
+ users_by_uuid = get_org_member_users_by_uuid(self.team.id) or {}
query = (request.query_params.get("query") or "").strip().lower()
- users_by_uuid = {str(user.uuid): user for user in login_to_user.values()}
-
candidate_count = len(users_by_uuid)
span.set_attribute("signals.available_reviewers.candidate_count", candidate_count)
@@ -2168,7 +2186,7 @@ class SignalReportViewSet(
entries = write_serializer.validated_data["content"]
try:
- new_artefact, seen = append_suggested_reviewers(
+ new_artefact = append_suggested_reviewers(
team=self.team,
report_id=str(report.id),
entries=entries,
@@ -2178,14 +2196,7 @@ class SignalReportViewSet(
return Response({"error": str(e)}, status=status.HTTP_400_BAD_REQUEST)
# Return the read-shape (enriched) so the client sees the canonical result, matching the artefact PUT.
- login_map = resolve_org_github_login_to_users(self.team.id, list(seen)) if seen else {}
- read_serializer = SignalReportArtefactSerializer(
- new_artefact,
- context={
- **self.get_serializer_context(),
- "signals_github_login_to_user_map": login_map,
- },
- )
+ read_serializer = SignalReportArtefactSerializer(new_artefact, context=self.get_serializer_context())
return Response(read_serializer.data)
def destroy(self, request, *args, **kwargs):
@@ -3694,8 +3705,46 @@ class ReviewerWriteError(Exception):
"""A reviewer write payload that couldn't be resolved. Callers surface it as a 400 `{"error": ...}`."""
+@frozen
+class _ResolvedReviewerWrite:
+ """One reviewer write entry after identity resolution, ready to merge onto the stored list.
+
+ `explicit_name` / `explicit_reason` separate "supplied, possibly as an empty string to clear"
+ from "field absent": only an absent field falls back to what the report already stored.
+ """
+
+ user_uuid: str | None
+ github_login: str | None
+ github_name: str | None
+ explicit_name: bool
+ reason: str | None
+ explicit_reason: bool
+
+ @property
+ def identity_label(self) -> str:
+ return self.github_login or f"user:{self.user_uuid}"
+
+
+def _reviewer_identity_label(payload: dict) -> str:
+ """How a stored reviewer entry names its person in the activity log and in dedupe.
+
+ A GitHub login where there is one, so existing rows and the scout-facing correction history
+ read exactly as before; the user's uuid where there is not.
+ """
+ login = str(payload.get("github_login") or "").strip().lower()
+ if login:
+ return login
+ user_uuid = payload.get("user_uuid")
+ return f"user:{user_uuid}" if user_uuid else ""
+
+
def _schedule_reviewer_added_slack_notifications(
- *, team_id: int, report_id: str, added_logins: Sequence[str], actor_user_id: int | None
+ *,
+ team_id: int,
+ report_id: str,
+ added_logins: Sequence[str],
+ added_user_uuids: Sequence[str],
+ actor_user_id: int | None,
) -> None:
"""After commit, Slack-notify reviewers a human just added to this report.
@@ -3708,7 +3757,8 @@ def _schedule_reviewer_added_slack_notifications(
lambda: send_reviewer_added_slack_notifications.delay(
report_id=report_id,
team_id=team_id,
- added_github_logins=list(added_logins),
+ # Keep the old task argument shape so workers from the prior release accept this job.
+ added_github_logins=[*added_logins, *(f"user:{value}" for value in added_user_uuids)],
exclude_user_id=actor_user_id,
),
robust=True,
@@ -3721,12 +3771,12 @@ def append_suggested_reviewers(
report_id: str,
entries: list[dict],
request: Request,
-) -> tuple[SignalReportArtefact, set[str]]:
+) -> SignalReportArtefact:
"""Append a new `suggested_reviewers` status row for a report, merging forward from the current
(latest) reviewers. Works whether or not the report already has a reviewers artefact — the first
write for a report with none simply creates the first row. Shared by the app-only reviewers PUT
- on both the report and artefact viewsets. Returns the new artefact and the set of canonical logins
- written (for read-time enrichment). Raises `ReviewerWriteError` on unresolvable entries."""
+ on both the report and artefact viewsets. Returns the new artefact.
+ Raises `ReviewerWriteError` on unresolvable entries."""
# App/user-only write (agents append reviewers via the artefacts POST), so always attribute to
# the requesting user — never the X-PostHog-Task-Id header. A task-attributed reviewers row has
# no created_by_id, which makes auto-start treat the list as agent-authored and run the
@@ -3740,39 +3790,55 @@ def append_suggested_reviewers(
scoped_team_ids = get_authenticator_scoped_team_ids(request.successful_authenticator)
scoped_team_id_tuple = tuple(scoped_team_ids) if scoped_team_ids is not None else None
- # Resolve any user_uuid → canonical github_login via team org membership.
+ # Resolve a supplied user_uuid to the org member it names, and a supplied login to that member's
+ # uuid. A reviewer is a PostHog user, so an entry needs org membership rather than a GitHub
+ # account: a member who never connected GitHub is stored by uuid, with a null login.
uuids_to_resolve = [str(e["user_uuid"]) for e in entries if e.get("user_uuid")]
- uuid_to_login: dict[str, str] = (
- get_org_member_github_logins_by_user_uuid(team.id, uuids_to_resolve) if uuids_to_resolve else {}
- )
+ uuid_to_user = resolve_org_users_by_uuid(team.id, uuids_to_resolve) if uuids_to_resolve else {}
+ logins_to_resolve = {
+ str(e["github_login"]).strip().lower()
+ for e in entries
+ if not e.get("user_uuid") and str(e.get("github_login") or "").strip()
+ }
+ login_to_org_user = resolve_org_github_login_to_users(team.id, logins_to_resolve) if logins_to_resolve else {}
- # 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 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 value when the field is absent.
- resolved_entries: list[tuple[str, str | None, bool, str | None, bool]] = []
+ resolved_entries: list[_ResolvedReviewerWrite] = []
for idx, entry in enumerate(entries):
user_uuid = entry.get("user_uuid")
if user_uuid is not None:
- resolved_login = uuid_to_login.get(str(user_uuid))
- if not resolved_login:
- raise ReviewerWriteError(
- f"content[{idx}]: user_uuid '{user_uuid}' is not an org member of this team "
- "with a linked GitHub identity."
- )
- login_lc = resolved_login.lower()
+ member = uuid_to_user.get(str(user_uuid))
+ if member is None:
+ raise ReviewerWriteError(f"content[{idx}]: user_uuid '{user_uuid}' is not an org member of this team.")
+ uuid_str: str | None = str(member.uuid)
+ member_login = member.get_github_login()
+ login_lc = member_login.lower() if member_login else None
else:
raw_login = entry.get("github_login") or ""
- login_lc = raw_login.strip().lower()
+ login_lc = raw_login.strip().lower() or None
if not login_lc:
raise ReviewerWriteError(f"content[{idx}]: github_login resolved to empty after normalization.")
+ # Store the uuid alongside a login that names an org member, so the entry keeps routing
+ # if they later unlink GitHub.
+ member = login_to_org_user.get(login_lc)
+ uuid_str = str(member.uuid) if member is not None else None
explicit_name = "github_name" in entry
github_name = entry.get("github_name") if explicit_name else None
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))
+ resolved_entries.append(
+ _ResolvedReviewerWrite(
+ user_uuid=uuid_str,
+ github_login=login_lc,
+ github_name=github_name,
+ explicit_name=explicit_name,
+ reason=reason,
+ explicit_reason=explicit_reason,
+ )
+ )
# Lock the report for the read-merge-append so concurrent reviewer edits serialize — each
# write reads the current (latest) reviewers and appends a new row, so without the lock two
@@ -3804,27 +3870,14 @@ def append_suggested_reviewers(
prior_content = json.loads(current.content) if current else []
except (json.JSONDecodeError, ValueError):
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:
- if not isinstance(prior, dict):
- continue
- login = (prior.get("github_login") or "").strip().lower()
- if not login:
- continue
- prior_logins.append(login)
- commits = prior.get("relevant_commits")
- if isinstance(commits, list):
- prior_commits_by_login[login] = commits
- 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
+ if not isinstance(prior_content, list):
+ prior_content = []
+ prior_index = ReviewerPayloadIndex.build(prior_content)
+ prior_payloads_by_identity: dict[str, dict] = {}
+ for prior in prior_content:
+ if isinstance(prior, dict) and (identity := _reviewer_identity_label(prior)):
+ prior_payloads_by_identity.setdefault(identity, prior)
+ prior_payloads = list(prior_payloads_by_identity.values())
# Newly-added reviewers carry no routing evidence, so record who added them and when
# (this path is always attributed to request.user). Dates use the report's project timezone.
@@ -3834,25 +3887,37 @@ def append_suggested_reviewers(
added_on = f"{now_local:%b} {now_local.day}, {now_local.year}"
manual_add_reason = f"Added as a reviewer by {actor.get_full_name().strip() or actor.email} on {added_on}"
- # Dedupe by canonical login, preserve first-seen order.
+ # Dedupe by identity (a login and its owner's uuid are the same person), preserve
+ # first-seen order.
new_content: list[dict] = []
- for login_lc, github_name, explicit_name, reason, explicit_reason in resolved_entries:
- if login_lc in seen:
+ # Identity of the prior entry each kept reviewer matched, so a reviewer whose stored entry
+ # only carried a login and now carries a uuid too reads as kept, not as a remove plus an add.
+ matched_prior_ids: set[int] = set()
+ for resolved in resolved_entries:
+ identity = resolved.identity_label
+ if identity in seen:
continue
- seen.add(login_lc)
+ seen.add(identity)
+ prior = prior_index.get(user_uuid=resolved.user_uuid, github_login=resolved.github_login)
+ if prior is not None:
+ matched_prior_ids.add(id(prior))
+ prior_name = prior.get("github_name") if prior else None
+ prior_reason = prior.get("reason") if prior else None
+ prior_commits = prior.get("relevant_commits") if prior else None
# 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. Only fall back to the manual-add note when the field was
# omitted for a brand-new reviewer — an explicit null clears the reason, as for kept ones.
- 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)
- if not explicit_reason and login_lc not in prior_logins:
+ effective_name = resolved.github_name if resolved.explicit_name else prior_name
+ effective_reason = resolved.reason if resolved.explicit_reason else prior_reason
+ if not resolved.explicit_reason and prior is None:
effective_reason = manual_add_reason
new_content.append(
{
- "github_login": login_lc,
- "github_name": effective_name,
- "relevant_commits": prior_commits_by_login.get(login_lc, []),
+ "github_login": resolved.github_login,
+ "user_uuid": resolved.user_uuid,
+ "github_name": effective_name if isinstance(effective_name, str) else None,
+ "relevant_commits": prior_commits if isinstance(prior_commits, list) else [],
"reason": effective_reason or None,
}
)
@@ -3869,12 +3934,19 @@ def append_suggested_reviewers(
# Human reviewer corrections are a routing signal (scouts query them via the
# activity log to learn who owns an area), so log them — but only genuine
# membership changes by a human, not agent writes or order-only rewrites.
- # `new_content` is deduped above; dedupe `prior_logins` too (a legacy or
- # hand-crafted prior row may carry duplicates) so before/after read symmetrically.
- prior_logins = list(dict.fromkeys(prior_logins))
- new_logins = [entry["github_login"] for entry in new_content]
+ # Membership is compared by which prior entry each new one matched, so before/after read
+ # symmetrically even where the two rows identify the same person by different fields. A
+ # reviewer is labelled by their login when they have one, and by their uuid when they don't.
+ removed_payloads = [prior for prior in prior_payloads if id(prior) not in matched_prior_ids]
+ added_entries = [
+ entry
+ for entry in new_content
+ if not prior_index.get(user_uuid=entry["user_uuid"], github_login=entry["github_login"])
+ ]
+ prior_identities = list(dict.fromkeys(_reviewer_identity_label(prior) for prior in prior_payloads))
+ new_identities = list(dict.fromkeys(_reviewer_identity_label(entry) for entry in new_content))
correction: ReviewerCorrection | None = None
- if attribution.kind == "user" and set(prior_logins) != set(new_logins):
+ if attribution.kind == "user" and (removed_payloads or added_entries):
# Read impersonation once: the activity row records it, and a support-staff edit made
# while impersonating must not become scout routing precedent. The reviewer-corrections
# profile already excludes impersonated rows (`_recent_reviewer_corrections`), so the
@@ -3895,8 +3967,8 @@ def append_suggested_reviewers(
type="SignalReport",
action="changed",
field="suggested_reviewers",
- before=prior_logins,
- after=new_logins,
+ before=prior_identities,
+ after=new_identities,
)
],
),
@@ -3905,18 +3977,21 @@ def append_suggested_reviewers(
# A human added reviewers: ping the newly-added ones on their own Slack channel so
# someone added after generation still hears about an actionable report, mirroring
# the notification sent when it first went ready. Removals aren't notified.
- prior_login_set = set(prior_logins)
- added_logins = [login for login in new_logins if login not in prior_login_set]
- if added_logins:
+ added_github_logins = [e["github_login"] for e in added_entries if e["github_login"]]
+ if added_entries:
_schedule_reviewer_added_slack_notifications(
team_id=team.id,
report_id=str(report_id),
- added_logins=added_logins,
+ added_logins=added_github_logins,
+ added_user_uuids=[
+ e["user_uuid"] for e in added_entries if e["user_uuid"] and not e["github_login"]
+ ],
actor_user_id=attribution.user_id,
)
# Only on an add: assignment is additive, so a removal leaves the pull request alone.
- if added_logins:
+ # GitHub assignment needs a login, so an add that only carries a user uuid queues nothing.
+ if added_github_logins:
assignment = SignalReportAssignment.all_teams.filter(team_id=team.id, report_id=report_id).first()
if assignment is not None:
schedule_reviewer_pr_assignment(
@@ -3930,12 +4005,19 @@ def append_suggested_reviewers(
# is the only return path a scout has for routing memory it already cached — but only for
# a genuine team edit. An impersonated operator edit is not team ownership evidence, so it
# steers nothing, matching the reviewer-corrections profile's impersonation filter.
+ # Scout routing memory is keyed on GitHub logins, so a change that only moved a
+ # login-less reviewer carries nothing for that channel to steer and is skipped there.
if not was_impersonated:
- new_login_set = set(new_logins)
correction = ReviewerCorrection(
report_id=str(report_id),
- added_logins=tuple(added_logins),
- removed_logins=tuple(login for login in prior_logins if login not in new_login_set),
+ added_logins=tuple(added_github_logins),
+ removed_logins=tuple(
+ login
+ for login in (
+ str(prior.get("github_login") or "").strip().lower() for prior in removed_payloads
+ )
+ if login
+ ),
actor_user_id=user_id,
scoped_team_ids=scoped_team_id_tuple,
)
@@ -3947,12 +4029,15 @@ def append_suggested_reviewers(
_record_reviewer_edit,
team=team,
report_id=str(report_id),
- github_logins=new_logins,
+ github_logins=[entry["github_login"] for entry in new_content if entry["github_login"]],
+ user_uuids=[
+ entry["user_uuid"] for entry in new_content if entry["user_uuid"] and not entry["github_login"]
+ ],
correction=correction,
)
)
- return new_artefact, seen
+ return new_artefact
def _record_reviewer_edit(
@@ -3960,6 +4045,7 @@ def _record_reviewer_edit(
team: Team,
report_id: str,
github_logins: list[str],
+ user_uuids: list[str],
correction: ReviewerCorrection | None,
) -> None:
"""The post-commit tail of a reviewer edit: steer the scouts, then record what the edit did.
@@ -3972,6 +4058,7 @@ def _record_reviewer_edit(
team_id=team.id,
report_id=report_id,
github_logins=github_logins,
+ user_uuids=user_uuids,
source="user_edit",
correction_notes_written=len(forwarded.note_ids) if forwarded else None,
correction_note_targets=forwarded.targets_resolved if forwarded else None,
@@ -4084,12 +4171,15 @@ class SignalReportArtefactViewSet(
artefacts = list(page if page is not None else log)
logins_union = normalized_github_logins_from_suggested_reviewer_artefacts(artefacts)
login_map = resolve_org_github_login_to_users(self.team.id, logins_union) if logins_union else {}
+ uuids_union = normalized_user_uuids_from_suggested_reviewer_artefacts(artefacts)
+ uuid_map = resolve_org_users_by_uuid(self.team.id, uuids_union) if uuids_union else {}
serializer = SignalReportArtefactSerializer(
artefacts,
many=True,
context={
**self.get_serializer_context(),
"signals_github_login_to_user_map": login_map,
+ "signals_reviewer_user_uuid_map": uuid_map,
},
)
if page is not None:
@@ -4117,7 +4207,7 @@ class SignalReportArtefactViewSet(
entries = write_serializer.validated_data["content"]
try:
- new_artefact, seen = append_suggested_reviewers(
+ new_artefact = append_suggested_reviewers(
team=self.team,
report_id=str(artefact.report_id),
entries=entries,
@@ -4127,14 +4217,7 @@ class SignalReportArtefactViewSet(
return Response({"error": str(e)}, status=status.HTTP_400_BAD_REQUEST)
# Return the read-shape (enriched) so the client sees the canonical result.
- login_map = resolve_org_github_login_to_users(self.team.id, list(seen)) if seen else {}
- read_serializer = SignalReportArtefactSerializer(
- new_artefact,
- context={
- **self.get_serializer_context(),
- "signals_github_login_to_user_map": login_map,
- },
- )
+ read_serializer = SignalReportArtefactSerializer(new_artefact, context=self.get_serializer_context())
return Response(read_serializer.data)
@staticmethod
@@ -4296,7 +4379,10 @@ class SignalReportArtefactViewSet(
capture_suggested_reviewers_resolved,
team_id=self.team.id,
report_id=report_id,
- github_logins=[entry.github_login for entry in parsed_content.root],
+ github_logins=[entry.github_login for entry in parsed_content.root if entry.github_login],
+ user_uuids=[
+ entry.user_uuid for entry in parsed_content.root if entry.user_uuid and not entry.github_login
+ ],
source="api",
)
)
@@ -4323,21 +4409,25 @@ class SignalReportArtefactViewSet(
.first()
)
logins: list[str] = []
+ user_uuids: list[str] = []
if latest is not None:
try:
parsed = json.loads(latest.content)
except (json.JSONDecodeError, TypeError, ValueError):
parsed = []
if isinstance(parsed, list):
- logins = [
- str(entry.get("github_login"))
- for entry in parsed
- if isinstance(entry, dict) and entry.get("github_login")
+ rows = [entry for entry in parsed if isinstance(entry, dict)]
+ logins = [str(entry["github_login"]) for entry in rows if entry.get("github_login")]
+ user_uuids = [
+ str(entry["user_uuid"])
+ for entry in rows
+ if entry.get("user_uuid") and not entry.get("github_login")
]
capture_suggested_reviewers_resolved(
team_id=self.team.id,
report_id=report_id,
github_logins=logins,
+ user_uuids=user_uuids,
source="api",
)
except Exception:
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index f9c93c29aa5b..e1caef5ad7cc 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -2527,7 +2527,7 @@ export interface ScoutMemberApi {
/** The member's last name (may be empty). */
last_name: string
/**
- * The member's resolved GitHub login (lowercased), already resolved server-side — put this value in a report's `suggested_reviewers` once you've matched the finding's owner to this row. Null when the member has no linked GitHub identity: a null-login member can't be routed to at all (neither a login nor a uuid resolves), so pick a different owner or leave `suggested_reviewers` empty.
+ * The member's resolved GitHub login (lowercased), already resolved server-side. Null when the member has no linked GitHub account, which does not stop you routing to them: pass their `user_uuid` in `suggested_reviewers` and the report reaches them. A null login only means no draft PR can be opened as that person.
* @nullable
*/
github_login: string | null
@@ -3518,10 +3518,9 @@ export interface ReportEvidenceApi {
/**
* One suggested reviewer — identified by `github_login`, `user_uuid`, or both.
*
- * The server canonicalizes each entry to a lowercased GitHub login: a `user_uuid` is resolved to the
- * org member's linked GitHub login (and wins over a supplied `github_login` when both are given). A
- * `user_uuid` that isn't an org member of this team with a linked GitHub identity is rejected — so a
- * reviewer is never silently dropped.
+ * A reviewer is a PostHog user, so a `user_uuid` only has to name an org member of this team: a
+ * member with no linked GitHub account routes the report like anyone else. A `user_uuid` that
+ * isn't an org member of this team is rejected — so a reviewer is never silently dropped.
*/
export interface SuggestedReviewerApi {
/**
@@ -3529,7 +3528,7 @@ export interface SuggestedReviewerApi {
* @maxLength 200
*/
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. */
+ /** PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Use this when you know the PostHog user, whether or not they have a GitHub handle — every member is routable this way. 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.
diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.ts
index 433a4d340008..014a9520808b 100644
--- a/products/signals/frontend/generated/api.zod.ts
+++ b/products/signals/frontend/generated/api.zod.ts
@@ -1088,7 +1088,7 @@ export const SignalsScoutEditReportBody = /* @__PURE__ */ zod
.uuid()
.optional()
.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."
+ "PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Use this when you know the PostHog user, whether or not they have a GitHub handle — every member is routable this way. Must be a concrete UUID; the `@me` alias is not valid here."
),
reason: zod
.string()
@@ -1099,7 +1099,7 @@ export const SignalsScoutEditReportBody = /* @__PURE__ */ zod
),
})
.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."
+ "One suggested reviewer — identified by `github_login`, `user_uuid`, or both.\n\nA reviewer is a PostHog user, so a `user_uuid` only has to name an org member of this team: a\nmember with no linked GitHub account routes the report like anyone else. A `user_uuid` that\nisn't an org member of this team is rejected — so a reviewer is never silently dropped."
)
)
.max(signalsScoutEditReportBodySuggestedReviewersMax)
@@ -1277,7 +1277,7 @@ export const SignalsScoutEmitReportBody = /* @__PURE__ */ zod
.uuid()
.optional()
.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."
+ "PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Use this when you know the PostHog user, whether or not they have a GitHub handle — every member is routable this way. Must be a concrete UUID; the `@me` alias is not valid here."
),
reason: zod
.string()
@@ -1288,7 +1288,7 @@ export const SignalsScoutEmitReportBody = /* @__PURE__ */ zod
),
})
.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."
+ "One suggested reviewer — identified by `github_login`, `user_uuid`, or both.\n\nA reviewer is a PostHog user, so a `user_uuid` only has to name an org member of this team: a\nmember with no linked GitHub account routes the report like anyone else. A `user_uuid` that\nisn't an org member of this team is rejected — so a reviewer is never silently dropped."
)
)
.max(signalsScoutEmitReportBodySuggestedReviewersMax)
diff --git a/products/signals/frontend/inbox/components/detail/ArtefactLogList.tsx b/products/signals/frontend/inbox/components/detail/ArtefactLogList.tsx
index 9a2613677247..8083ac491d64 100644
--- a/products/signals/frontend/inbox/components/detail/ArtefactLogList.tsx
+++ b/products/signals/frontend/inbox/components/detail/ArtefactLogList.tsx
@@ -216,20 +216,39 @@ function ReviewersBody({ reviewers }: { reviewers: EnrichedReviewer[] }): JSX.El
return (
<div className="flex flex-wrap gap-1.5">
{reviewers.map((reviewer) => {
- const name = reviewer.user?.first_name || reviewer.github_name || reviewer.github_login
- return (
+ const name =
+ reviewer.user?.first_name ||
+ reviewer.github_name ||
+ reviewer.github_login ||
+ reviewer.user?.email ||
+ 'Reviewer'
+ const body = (
+ <>
+ <ProfilePicture user={reviewer.user} name={name} size="xs" />
+ <span className="text-default">{name}</span>
+ {reviewer.github_login ? (
+ <span className="font-mono text-tertiary">@{reviewer.github_login}</span>
+ ) : null}
+ </>
+ )
+ return reviewer.github_login ? (
<Link
- key={reviewer.github_login}
+ key={reviewer.user?.uuid ?? reviewer.user_uuid ?? reviewer.github_login}
to={`https://github.com/${reviewer.github_login}`}
target="_blank"
disableClientSideRouting
className="inline-flex items-center gap-1.5 rounded px-1.5 py-1 text-xs no-underline hover:bg-fill-highlight-50"
>
- <ProfilePicture user={reviewer.user} name={name} size="xs" />
- <span className="text-default">{name}</span>
- <span className="font-mono text-tertiary">@{reviewer.github_login}</span>
+ {body}
<IconExternal className="size-3 text-tertiary" />
</Link>
+ ) : (
+ <div
+ key={reviewer.user?.uuid ?? reviewer.user_uuid ?? name}
+ className="inline-flex items-center gap-1.5 rounded px-1.5 py-1 text-xs"
+ >
+ {body}
+ </div>
)
})}
</div>
diff --git a/products/signals/frontend/inbox/components/detail/ReviewerSearchList.tsx b/products/signals/frontend/inbox/components/detail/ReviewerSearchList.tsx
index 5af8d8b25820..8fc3370b3da2 100644
--- a/products/signals/frontend/inbox/components/detail/ReviewerSearchList.tsx
+++ b/products/signals/frontend/inbox/components/detail/ReviewerSearchList.tsx
@@ -92,7 +92,9 @@ export function ReviewerSearchList({
return
}
const optimisticEntry: EnrichedReviewer = {
- github_login: '',
+ // The picker adds a PostHog member, whose GitHub login (if any) the server fills in.
+ github_login: null,
+ user_uuid: option.user_uuid,
github_name: option.name || null,
relevant_commits: [],
user: {
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewersSection.tsx b/products/signals/frontend/inbox/components/detail/SuggestedReviewersSection.tsx
index 202cf0713fb3..407379ec2e2d 100644
--- a/products/signals/frontend/inbox/components/detail/SuggestedReviewersSection.tsx
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewersSection.tsx
@@ -12,6 +12,7 @@ import { EnrichedReviewer, SignalReport } from '../../types'
const MAX_VISIBLE_REVIEWERS = 5
import { DetailSection } from './DetailSection'
+import { getReviewerDisplayName } from './reviewerDisplay'
import { removeSuggestedReviewer, ReviewerSearchList } from './ReviewerSearchList'
/**
@@ -80,7 +81,7 @@ export function SuggestedReviewersSection({ report }: { report: SignalReport }):
{(showAllReviewers ? baseReviewers : baseReviewers.slice(0, MAX_VISIBLE_REVIEWERS)).map(
(reviewer: EnrichedReviewer) => (
<ReviewerRow
- key={reviewer.user?.uuid ?? reviewer.github_login}
+ key={reviewer.user?.uuid ?? reviewer.user_uuid ?? reviewer.github_login}
reviewer={reviewer}
disabled={isUpdatingReviewers}
onRemove={() => removeReviewer(reviewer)}
@@ -113,7 +114,7 @@ function ReviewerRow({
disabled: boolean
onRemove: () => void
}): JSX.Element {
- const displayName = reviewer.github_name ?? reviewer.user?.first_name ?? reviewer.github_login
+ const displayName = getReviewerDisplayName(reviewer)
const reason = reviewer.reason ?? reviewer.relevant_commits[0]?.reason ?? null
const githubUrl = reviewer.github_login ? `https://github.com/${reviewer.github_login}` : null
@@ -185,7 +186,7 @@ function ReviewerRow({
icon={<IconX />}
disabledReason={disabled ? 'Updating…' : undefined}
onClick={onRemove}
- tooltip={`Remove ${reviewer.github_login || reviewer.user?.first_name || 'reviewer'}`}
+ tooltip={`Remove ${displayName}`}
// Hover reveal keeps rows quiet with a mouse, but a coarse pointer (phone, tablet) has no
// hover state, so the button stays visible there and whenever the row holds keyboard focus.
className="opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 pointer-coarse:opacity-100"
diff --git a/products/signals/frontend/inbox/components/detail/reviewerDisplay.ts b/products/signals/frontend/inbox/components/detail/reviewerDisplay.ts
index 9fc15822913d..51221eb67acd 100644
--- a/products/signals/frontend/inbox/components/detail/reviewerDisplay.ts
+++ b/products/signals/frontend/inbox/components/detail/reviewerDisplay.ts
@@ -76,6 +76,24 @@ export function getReviewerOptionDisplayName(option: AvailableReviewerOption, is
return isMe ? `${base} (Me)` : base
}
+/**
+ * Display name for a reviewer chip. A reviewer with no linked GitHub account has no login to show,
+ * so fall back through the PostHog user we resolved them to.
+ */
+export function getReviewerDisplayName(reviewer: EnrichedReviewer): string {
+ const fullName = [reviewer.user?.first_name, reviewer.user?.last_name]
+ .map(normalizeString)
+ .filter(Boolean)
+ .join(' ')
+ return (
+ normalizeString(reviewer.github_name) ||
+ fullName ||
+ normalizeString(reviewer.user?.email) ||
+ normalizeString(reviewer.github_login) ||
+ 'Unknown reviewer'
+ )
+}
+
/** Does an existing reviewer match an available option? Match by user uuid. */
export function reviewerMatchesOption(reviewer: EnrichedReviewer, option: AvailableReviewerOption): boolean {
return !!reviewer.user?.uuid && reviewer.user.uuid === option.user_uuid
diff --git a/products/signals/frontend/inbox/types.ts b/products/signals/frontend/inbox/types.ts
index dbbae94a759a..e6e96eda54da 100644
--- a/products/signals/frontend/inbox/types.ts
+++ b/products/signals/frontend/inbox/types.ts
@@ -32,7 +32,10 @@ export interface SignalReviewerUserInfo {
}
export interface EnrichedReviewer {
- github_login: string
+ /** Null for a reviewer with no linked GitHub account — they are identified by `user` instead. */
+ github_login: string | null
+ /** Null on entries written before reviewers carried one; `user` still resolves from the login. */
+ user_uuid?: string | null
github_name: string | null
relevant_commits: RelevantCommit[]
user: SignalReviewerUserInfo | null
diff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yaml
index 72d8d7093e67..94fead53f6da 100644
--- a/products/signals/mcp/tools.yaml
+++ b/products/signals/mcp/tools.yaml
@@ -597,9 +597,10 @@ tools:
their `user_uuid`, `email`, `first_name`/`last_name`, and resolved GitHub `login` (null when they have no
linked GitHub identity). The cold-start reviewer-routing path: when a finding's owner can't be read off a
fetched entity's `created_by` and there's no cached `reviewer:<area>` memory or inbox precedent, list
- members, match the owner by email/name, then put their resolved `github_login` in `suggested_reviewers` on
- `scout-emit-report` / `scout-edit-report` (a member with a null `github_login` can't be routed to — pick
- another owner). Pass `search` to narrow a large roster. Strictly team-scoped.
+ members, match the owner by email/name, then put their `user_uuid` in `suggested_reviewers` on
+ `scout-emit-report` / `scout-edit-report`. Every member is routable this way; a null `github_login` only
+ means no draft PR can be opened as that person. Pass `search` to narrow a large roster. Strictly
+ team-scoped.
scout-metadata-get:
operation: signals_scout_metadata_get
enabled: true
diff --git a/products/signals/skills/authoring-scouts/references/report-contract.md b/products/signals/skills/authoring-scouts/references/report-contract.md
index 6d60b59dfcd8..22e9c82fbe4e 100644
--- a/products/signals/skills/authoring-scouts/references/report-contract.md
+++ b/products/signals/skills/authoring-scouts/references/report-contract.md
@@ -203,9 +203,9 @@ Each entry identifies one reviewer by **`github_login`**, **`user_uuid`**, or bo
- **`github_login`** — a **bare, lowercase GitHub login** (e.g. `octocat`, not `@OctoCat`).
Internal assignment matches it against each user's linked GitHub login by exact, lowercased comparison, so a mis-cased handle, an `@`-prefix, a display name, a CODEOWNERS **team** slug, or an email won't set `is_suggested_reviewer` for anyone (autostart's PR-selection path is more lenient, but the assignment path is not).
- **`user_uuid`** — a **PostHog user UUID**.
- The server resolves it to that org member's linked GitHub login for you (and it wins if you also pass a `github_login`).
- Use this whenever your evidence already names a PostHog user — an account owner, an entity's `created_by`, a CSM — so you can route to them without ever looking up their handle.
- A `user_uuid` that isn't an org member of this team **with a linked GitHub identity** is rejected (the whole call fails), so it never silently drops.
+ The server resolves it to that org member. It wins if you also pass a `github_login`.
+ Use this whenever your evidence already names a PostHog user. It works without a linked GitHub account.
+ A `user_uuid` that is not an org member of this team is rejected, so it never silently drops.
So you have two routes to a reviewer.
If you already hold a PostHog user UUID, prefer passing it as `user_uuid` — it's the most reliable.
@@ -219,7 +219,7 @@ Otherwise resolve a `github_login`, cheapest source first:
`.github/CODEOWNERS` for the owning path, or the last `git log` author for the file.
Neither usually hands you a usable login directly: CODEOWNERS entries are often **team** slugs (`@your-org/team-name`) and `git log` gives a name + email — both must be resolved to an **individual** GitHub login before you write the reviewer (a team slug or an email won't match any user).
4. **`scout-members-list`** — the in-run roster lookup, for the cold-start case where the cheaper paths above don't resolve an owner.
- It returns this project's members, each with `user_uuid`, `email`, name, and a resolved `github_login` (pass `search=` to narrow); match the owner and route to their `github_login`, or hand the `user_uuid` straight through and let the server resolve it.
+ It returns this project's members, each with `user_uuid`, email, name, and a resolved `github_login`. Pass `search=` to narrow the result. Match the owner and route with `user_uuid`.
The org-scoped `org-members-list` / `org-member-get-github-login` tools are **not available in a scout run** — a scoped-team token can't reach the org-nested endpoint, so don't build a scout's reviewer recipe around them.
**If you can't confidently identify a reviewer, leave `suggested_reviewers` empty** — the report still surfaces for a human to grab.
diff --git a/products/signals/skills/signals-scout-ai-observability/SKILL.md b/products/signals/skills/signals-scout-ai-observability/SKILL.md
index ce55e1f9b289..54f1b5cb568a 100644
--- a/products/signals/skills/signals-scout-ai-observability/SKILL.md
+++ b/products/signals/skills/signals-scout-ai-observability/SKILL.md
@@ -141,7 +141,7 @@ Inbox & reviewer routing:
- `inbox-reports-list` / `inbox-reports-retrieve` — the reports already in the inbox; check before authoring so you edit instead of duplicating (`ordering=-updated_at`).
- `inbox-report-artefacts-list` — a comparable report's artefact log, where the routed `suggested_reviewers` live (the report record doesn't expose them) — reviewer precedent.
-- `scout-members-list` — this project's members with their resolved `github_login`, to route `suggested_reviewers` to a product / model / eval owner (wrap as a `{github_login}` object, or pass the member's `{user_uuid}` and let the server resolve; null `github_login` → try the next owner). The in-run roster; the org-scoped resolver tools aren't available in a scout run.
+- `scout-members-list` — this project's members with their `user_uuid` and resolved `github_login`. Route the owner with either value. Use `user_uuid` when `github_login` is null. The org-scoped resolver tools are not available in a scout run.
Harness-level:
diff --git a/products/signals/skills/signals-scout-data-pipelines/SKILL.md b/products/signals/skills/signals-scout-data-pipelines/SKILL.md
index a92fb77dcb6b..516510466be8 100644
--- a/products/signals/skills/signals-scout-data-pipelines/SKILL.md
+++ b/products/signals/skills/signals-scout-data-pipelines/SKILL.md
@@ -203,7 +203,7 @@ Inbox & reviewer routing:
- `inbox-reports-list` / `inbox-reports-retrieve` — the reports already in the inbox; check before authoring so you edit instead of duplicating (`ordering=-updated_at`).
- `inbox-report-artefacts-list` — a comparable report's artefact log, where the routed `suggested_reviewers` live (the report record doesn't expose them) — reviewer precedent.
-- `scout-members-list` — this project's members with their resolved `github_login`, to route `suggested_reviewers` to a pipeline's owner (wrap as a `{github_login}` object, or pass the member's `{user_uuid}` and let the server resolve; null `github_login` → try the next owner). The in-run roster; the org-scoped resolver tools aren't available in a scout run.
+- `scout-members-list` — this project's members with their `user_uuid` and resolved `github_login`. Route the owner with either value. Use `user_uuid` when `github_login` is null. The org-scoped resolver tools are not available in a scout run.
Harness-level:
diff --git a/products/signals/skills/signals-scout-data-warehouse/SKILL.md b/products/signals/skills/signals-scout-data-warehouse/SKILL.md
index 8affe3a7adde..053a7c01db14 100644
--- a/products/signals/skills/signals-scout-data-warehouse/SKILL.md
+++ b/products/signals/skills/signals-scout-data-warehouse/SKILL.md
@@ -273,7 +273,7 @@ Inbox & reviewer routing:
- `inbox-reports-list` / `inbox-reports-retrieve` — the reports already in the inbox; check before authoring so you edit instead of duplicating (`ordering=-updated_at`).
- `health-issues-list` — the health-checks scout's `external_data_failure` issues; cross-check so you add the silent-gap angle rather than duplicating an active failure.
- `inbox-report-artefacts-list` — a comparable report's artefact log, where the routed `suggested_reviewers` live (the report record doesn't expose them) — reviewer precedent.
-- `scout-members-list` — this project's members with their resolved `github_login`, to route `suggested_reviewers` to a source's owner (wrap as a `{github_login}` object, or pass the member's `{user_uuid}` and let the server resolve; null `github_login` → try the next owner). The in-run roster; the org-scoped resolver tools aren't available in a scout run.
+- `scout-members-list` — this project's members with their `user_uuid` and resolved `github_login`. Route the owner with either value. Use `user_uuid` when `github_login` is null. The org-scoped resolver tools are not available in a scout run.
Harness-level:
diff --git a/products/signals/skills/signals-scout-experiments/SKILL.md b/products/signals/skills/signals-scout-experiments/SKILL.md
index 6ce3d81e71d2..cdb67b84da81 100644
--- a/products/signals/skills/signals-scout-experiments/SKILL.md
+++ b/products/signals/skills/signals-scout-experiments/SKILL.md
@@ -242,7 +242,7 @@ Inbox & reviewer routing:
- `inbox-reports-list` / `inbox-reports-retrieve` — the reports already in the inbox; check before authoring so you edit instead of duplicating (`ordering=-updated_at`).
- `inbox-report-artefacts-list` — a comparable report's artefact log, where the routed `suggested_reviewers` live (the report record doesn't expose them) — reviewer precedent.
-- `scout-members-list` — this project's members with their resolved `github_login`, to route `suggested_reviewers` to an experiment's owner (wrap as a `{github_login}` object, or pass the member's `{user_uuid}` and let the server resolve; null `github_login` → try the next owner). The in-run roster; the org-scoped resolver tools aren't available in a scout run.
+- `scout-members-list` — this project's members with their `user_uuid` and resolved `github_login`. Route the owner with either value. Use `user_uuid` when `github_login` is null. The org-scoped resolver tools are not available in a scout run.
Harness-level:
diff --git a/products/signals/skills/signals-scout-feature-flags/SKILL.md b/products/signals/skills/signals-scout-feature-flags/SKILL.md
index 42f8570f075d..61be71a97e2d 100644
--- a/products/signals/skills/signals-scout-feature-flags/SKILL.md
+++ b/products/signals/skills/signals-scout-feature-flags/SKILL.md
@@ -250,7 +250,7 @@ Inbox & reviewer routing:
- `inbox-reports-list` / `inbox-reports-retrieve` — the reports already in the inbox; check before authoring so you edit instead of duplicating (`ordering=-updated_at`).
- `inbox-report-artefacts-list` — a comparable report's artefact log, where the routed `suggested_reviewers` live (the report record doesn't expose them) — reviewer precedent.
-- `scout-members-list` — this project's members with their resolved `github_login`, to route `suggested_reviewers` to a flag's owner (wrap as a `{github_login}` object, or pass the member's `{user_uuid}` and let the server resolve; null `github_login` → try the next owner). The in-run roster; the org-scoped resolver tools aren't available in a scout run.
+- `scout-members-list` — this project's members with their `user_uuid` and resolved `github_login`. Route the owner with either value. Use `user_uuid` when `github_login` is null. The org-scoped resolver tools are not available in a scout run.
Harness-level:
diff --git a/products/signals/skills/signals-scout-logs/SKILL.md b/products/signals/skills/signals-scout-logs/SKILL.md
index 8ac89da81c00..0c516dc5a642 100644
--- a/products/signals/skills/signals-scout-logs/SKILL.md
+++ b/products/signals/skills/signals-scout-logs/SKILL.md
@@ -166,7 +166,7 @@ Direct calls (read-only):
- `logs-alerts-events-list` — an alert's firing history (fires/resolves/flaps); tells a fresh fire from a chronically-firing misconfigured one. May 403 on a personal key.
- `inbox-reports-list` / `inbox-reports-retrieve` — the reports already in the inbox; check before authoring so you edit instead of duplicating (`ordering=-updated_at`).
- `inbox-report-artefacts-list` — a comparable report's artefact log, where the routed `suggested_reviewers` live (the report record doesn't expose them) — reviewer precedent.
-- `scout-members-list` — this project's members with their resolved `github_login`, to route `suggested_reviewers` to a service's owner (null `github_login` → can't route, try the next owner). The in-run roster; the org-scoped resolver tools aren't available in a scout run.
+- `scout-members-list` — this project's members with their `user_uuid` and resolved `github_login`. Route with `user_uuid` when `github_login` is null. The org-scoped resolver tools are not available in a scout run.
- `query-error-tracking-issues-list` — cross-check whether a log error already has an issue; error tracking owns those findings.
Harness-level:
diff --git a/products/signals/skills/signals-scout-product-analytics/SKILL.md b/products/signals/skills/signals-scout-product-analytics/SKILL.md
index 885b4fdd33ed..2307339e6b19 100644
--- a/products/signals/skills/signals-scout-product-analytics/SKILL.md
+++ b/products/signals/skills/signals-scout-product-analytics/SKILL.md
@@ -96,7 +96,7 @@ Maintain the watchlist and baselines as you work, encoding the category in the k
Before you author, check whether this flow already has a report — the `report:product_analytics:flow:<short_id>` scratchpad pointer is the reliable path: it holds the `report_id`, so `inbox-reports-retrieve` it directly. Only with no pointer fall back to an `inbox-reports-list` search (`ordering=-updated_at`), and search the flow's _specific_ terms (its name, the step events, the `short_id`) — a broad word like `funnel` returns hundreds of unrelated reports on a busy project and buries yours. Classify each candidate against prior runs and the scratchpad (net-new / material-update / already-covered / addressed-or-noise), then:
- **Edit** the existing report via `scout-edit-report` when the inbox already covers the flow. A regression is rarely brand-new — a funnel that's still sliding, a retention cliff that deepened, a flow that recovered then relapsed: use `append_evidence` for the fresh window's rate, baseline band, and entrant volumes (or rewrite the title/summary on a report you authored). This is the default when a match exists **and it's still live in the inbox**; don't mint a near-duplicate. **A persistent regression is one report across weeks:** when a new complete window confirms the flow is still below baseline (or has deepened), that's a _re-escalation_ — add the fresh week with `append_evidence`, and advance the `dedupe:…:<week>` gate. Do **not** author a fresh report per week. The same flow moving twice is one report, not two. **But scope the match to the same rate, not just the same `short_id`:** one funnel/retention insight carries several independent rates (step-2 vs step-5 conversion, one retention cohort vs another, one lifecycle state), and a drop on a _different_ step/cohort is its own regression with its own owner — keep the `report:product_analytics:flow:<short_id>` pointer keyed to the affected rate (e.g. `…:flow:<short_id>:step2`) and only `edit-report` when the matched report covers that same rate; a genuinely distinct rate gets a fresh report so it isn't buried under an unrelated thread. **And check the matched report's status first:** `edit-report` can't change status, so appending to a `resolved` / `suppressed` / `failed` report (one that won't surface in the inbox) buries a real relapse under a closed item. When the prior report is no longer live, **author a fresh report** for the relapse and repoint `report:product_analytics:flow:<short_id>` at the new id.
-- **Author** a fresh report via `scout-emit-report` when nothing in the inbox covers it (or a known regression has new evidence that changes the verdict). A **strong finding** here: the rate dropped clearly below the flow's seasonality-matched baseline (robust z ≥ ~3, or a conversion-point drop beyond the baseline band), the **entrant denominator held** (quantify both — "step-2 conversion 62%→48% while step-1 entrants steady at ~5.2k/day"), the move is broad across segments (not one known cohort), it's not explained by a running experiment or a flow-definition edit, and confidence ≥ 0.8. Put the flow `short_id`, the latest-window rate, the baseline band, the per-step/per-cohort numbers, the entrant volumes, and the time window in the `evidence`. A rate regression is chart-shaped — attach the regressed rate via `charts`, matched to the flow type: a funnel or retention rate with its steady entrant denominator alongside (the drop-on-steady-entrants shape), lifecycle as the state composition over time, stickiness as the frequency distribution against its population. A behavioral regression is an investigation, not a one-line code fix, so set `actionability=requires_human_input` and **leave `priority` and `repository` unset** — they're PR-autostart fields, and supplying `priority` + `suggested_reviewers` with no `repository` signals PR intent that spins up a repo-selection sandbox only to no-op (autostart needs `immediately_actionable`). Reach for them (P2 broad regression on a human-saved flow, P3 single-segment / `inferred`) only on the rare regression you'd actually want a draft PR for. **Set `suggested_reviewers` whenever you can confidently resolve one** — each entry is `{github_login?, user_uuid?}`, and the usual route here is to pass the flow's owning person as a `user_uuid` (a saved insight's `created_by`; the server resolves it to their GitHub login), or reuse a cached `reviewer:product_analytics:<area>` login. **But `user_uuid` resolution is fail-loud: a `created_by` that isn't an org member with a linked GitHub identity (a PM, a customer, a since-departed user) rejects the _whole_ `emit-report`, not just the reviewer.** So don't reflexively hand a raw `created_by` you're unsure about — prefer a cached login or a `created_by` you've already routed; if you can't confidently resolve an owner, author the report **unrouted** and `edit-report` reviewers in later once you resolve one, rather than risk failing the emit. When the owner isn't already a `created_by` in your evidence, `scout-members-list` gives this project's members with their resolved `github_login` (the org-scoped resolver tools aren't available in a scout run). Routing is how the report reaches a human; left empty it's assigned to nobody and likely missed, so resolve one when you safely can. After authoring, write a rate-scoped `report:product_analytics:flow:<short_id>:<rate>` scratchpad entry (the affected step/cohort/state, not just the `short_id`) with the `report_id` so the next run edits _this rate's_ report instead of duplicating — and a distinct rate on the same insight gets its own pointer. The harness prompt carries the full report-channel contract (field schema, safety × actionability status mapping, reviewer routing, the non-idempotency caveat, and the edit rules) — this section only adds the product-analytics-specific framing.
+- **Author** a fresh report via `scout-emit-report` when nothing in the inbox covers it (or a known regression has new evidence that changes the verdict). A **strong finding** here: the rate dropped clearly below the flow's seasonality-matched baseline (robust z ≥ ~3, or a conversion-point drop beyond the baseline band), the **entrant denominator held** (quantify both — "step-2 conversion 62%→48% while step-1 entrants steady at ~5.2k/day"), the move is broad across segments (not one known cohort), it's not explained by a running experiment or a flow-definition edit, and confidence ≥ 0.8. Put the flow `short_id`, the latest-window rate, the baseline band, the per-step/per-cohort numbers, the entrant volumes, and the time window in the `evidence`. A rate regression is chart-shaped — attach the regressed rate via `charts`, matched to the flow type: a funnel or retention rate with its steady entrant denominator alongside (the drop-on-steady-entrants shape), lifecycle as the state composition over time, stickiness as the frequency distribution against its population. A behavioral regression is an investigation, not a one-line code fix, so set `actionability=requires_human_input` and **leave `priority` and `repository` unset** — they're PR-autostart fields, and supplying `priority` + `suggested_reviewers` with no `repository` signals PR intent that spins up a repo-selection sandbox only to no-op (autostart needs `immediately_actionable`). Reach for them (P2 broad regression on a human-saved flow, P3 single-segment / `inferred`) only on the rare regression you'd actually want a draft PR for. **Set `suggested_reviewers` whenever you can confidently resolve one** — each entry is `{github_login?, user_uuid?}`, and the usual route here is to pass the flow's owning person as a `user_uuid`, or reuse a cached `reviewer:product_analytics:<area>` login. **`user_uuid` resolution is fail-loud: a `created_by` that is not an org member rejects the whole `emit-report`, not only the reviewer.** Do not pass a raw `created_by` if you cannot verify membership. Prefer a cached login or a `created_by` that routed before. You can also author the report without a reviewer and add one later. `scout-members-list` gives this project's members with their `user_uuid` and resolved `github_login`. Routing helps the report reach a human, so resolve an owner when you can. After authoring, write a rate-scoped `report:product_analytics:flow:<short_id>:<rate>` scratchpad entry with the `report_id`. Use a separate entry for each rate. The harness prompt carries the full report-channel contract.
- **Remember** if suggestive but below the bar (confidence < 0.65), or to refresh a baseline.
- **Skip** if a `noise:` / `addressed:` / `dedupe:` entry, or an existing inbox report, already covers it.
diff --git a/products/signals/skills/signals-scout-surveys/SKILL.md b/products/signals/skills/signals-scout-surveys/SKILL.md
index 36ba24e34fe8..d8e06bafae5b 100644
--- a/products/signals/skills/signals-scout-surveys/SKILL.md
+++ b/products/signals/skills/signals-scout-surveys/SKILL.md
@@ -259,7 +259,7 @@ Direct calls (read-only):
- `advanced-activity-logs-list` — correlate themes / score drops with recent product changes.
- `inbox-reports-list` / `inbox-reports-retrieve` — the reports already in the inbox; check before authoring so you edit instead of duplicating (`ordering=-updated_at`).
- `inbox-report-artefacts-list` — a comparable report's artefact log, where the routed `suggested_reviewers` live (the report record doesn't expose them) — reviewer precedent.
-- `scout-members-list` — this project's members with their resolved `github_login`, to route `suggested_reviewers` to a survey's owner (null `github_login` → can't route, try the next owner). The in-run roster; the org-scoped resolver tools aren't available in a scout run.
+- `scout-members-list` — this project's members with their `user_uuid` and resolved `github_login`. Route with `user_uuid` when `github_login` is null. The org-scoped resolver tools are not available in a scout run.
Harness-level:
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index d053cc63827d..068e444448fe 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -9777,7 +9777,7 @@
}
},
"scout-members-list": {
- "description": "Return the people who can review work on this project — one row per member with access to it, each with their `user_uuid`, `email`, `first_name`/`last_name`, and resolved GitHub `login` (null when they have no linked GitHub identity). The cold-start reviewer-routing path: when a finding's owner can't be read off a fetched entity's `created_by` and there's no cached `reviewer:<area>` memory or inbox precedent, list members, match the owner by email/name, then put their resolved `github_login` in `suggested_reviewers` on `scout-emit-report` / `scout-edit-report` (a member with a null `github_login` can't be routed to — pick another owner). Pass `search` to narrow a large roster. Strictly team-scoped.",
+ "description": "Return the people who can review work on this project — one row per member with access to it, each with their `user_uuid`, `email`, `first_name`/`last_name`, and resolved GitHub `login` (null when they have no linked GitHub identity). The cold-start reviewer-routing path: when a finding's owner can't be read off a fetched entity's `created_by` and there's no cached `reviewer:<area>` memory or inbox precedent, list members, match the owner by email/name, then put their `user_uuid` in `suggested_reviewers` on `scout-emit-report` / `scout-edit-report`. Every member is routable this way; a null `github_login` only means no draft PR can be opened as that person. Pass `search` to narrow a large roster. Strictly team-scoped.",
"category": "Signals",
"feature": "signals",
"summary": "List project members for reviewer routing",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 2f07cf6e6dd1..fce7bcb00f3b 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -10349,7 +10349,7 @@
}
},
"scout-members-list": {
- "description": "Return the people who can review work on this project — one row per member with access to it, each with their `user_uuid`, `email`, `first_name`/`last_name`, and resolved GitHub `login` (null when they have no linked GitHub identity). The cold-start reviewer-routing path: when a finding's owner can't be read off a fetched entity's `created_by` and there's no cached `reviewer:<area>` memory or inbox precedent, list members, match the owner by email/name, then put their resolved `github_login` in `suggested_reviewers` on `scout-emit-report` / `scout-edit-report` (a member with a null `github_login` can't be routed to — pick another owner). Pass `search` to narrow a large roster. Strictly team-scoped.",
+ "description": "Return the people who can review work on this project — one row per member with access to it, each with their `user_uuid`, `email`, `first_name`/`last_name`, and resolved GitHub `login` (null when they have no linked GitHub identity). The cold-start reviewer-routing path: when a finding's owner can't be read off a fetched entity's `created_by` and there's no cached `reviewer:<area>` memory or inbox precedent, list members, match the owner by email/name, then put their `user_uuid` in `suggested_reviewers` on `scout-emit-report` / `scout-edit-report`. Every member is routable this way; a null `github_login` only means no draft PR can be opened as that person. Pass `search` to narrow a large roster. Strictly team-scoped.",
"category": "Signals",
"feature": "signals",
"summary": "List project members for reviewer routing",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 60dcaef6fb32..9e5f235a7d96 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -30814,10 +30814,9 @@ export namespace Schemas {
/**
* One suggested reviewer — identified by `github_login`, `user_uuid`, or both.
*
- * The server canonicalizes each entry to a lowercased GitHub login: a `user_uuid` is resolved to the
- * org member's linked GitHub login (and wins over a supplied `github_login` when both are given). A
- * `user_uuid` that isn't an org member of this team with a linked GitHub identity is rejected — so a
- * reviewer is never silently dropped.
+ * A reviewer is a PostHog user, so a `user_uuid` only has to name an org member of this team: a
+ * member with no linked GitHub account routes the report like anyone else. A `user_uuid` that
+ * isn't an org member of this team is rejected — so a reviewer is never silently dropped.
*/
export interface SuggestedReviewer {
/**
@@ -30825,7 +30824,7 @@ export namespace Schemas {
* @maxLength 200
*/
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. */
+ /** PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Use this when you know the PostHog user, whether or not they have a GitHub handle — every member is routable this way. 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.
@@ -78786,7 +78785,7 @@ export namespace Schemas {
/** The member's last name (may be empty). */
last_name: string;
/**
- * The member's resolved GitHub login (lowercased), already resolved server-side — put this value in a report's `suggested_reviewers` once you've matched the finding's owner to this row. Null when the member has no linked GitHub identity: a null-login member can't be routed to at all (neither a login nor a uuid resolves), so pick a different owner or leave `suggested_reviewers` empty.
+ * The member's resolved GitHub login (lowercased), already resolved server-side. Null when the member has no linked GitHub account, which does not stop you routing to them: pass their `user_uuid` in `suggested_reviewers` and the report reaches them. A null login only means no draft PR can be opened as that person.
* @nullable
*/
github_login: string | null;
diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.ts
index 97b7c5640728..10d08308fa4d 100644
--- a/services/mcp/src/generated/signals/api.ts
+++ b/services/mcp/src/generated/signals/api.ts
@@ -1510,7 +1510,7 @@ export const SignalsScoutEditReportBody = () => zod
.string()
.optional()
.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."
+ "PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Use this when you know the PostHog user, whether or not they have a GitHub handle — every member is routable this way. Must be a concrete UUID; the `@me` alias is not valid here."
),
reason: zod
.string()
@@ -1521,7 +1521,7 @@ export const SignalsScoutEditReportBody = () => zod
),
})
.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."
+ "One suggested reviewer — identified by `github_login`, `user_uuid`, or both.\n\nA reviewer is a PostHog user, so a `user_uuid` only has to name an org member of this team: a\nmember with no linked GitHub account routes the report like anyone else. A `user_uuid` that\nisn't an org member of this team is rejected — so a reviewer is never silently dropped."
)
)
.max(signalsScoutEditReportBodySuggestedReviewersMax)
@@ -1734,7 +1734,7 @@ export const SignalsScoutEmitReportBody = () => zod
.string()
.optional()
.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."
+ "PostHog user UUID (e.g. from `scout-members-list`, or an entity's `created_by`). Use this when you know the PostHog user, whether or not they have a GitHub handle — every member is routable this way. Must be a concrete UUID; the `@me` alias is not valid here."
),
reason: zod
.string()
@@ -1745,7 +1745,7 @@ export const SignalsScoutEmitReportBody = () => zod
),
})
.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."
+ "One suggested reviewer — identified by `github_login`, `user_uuid`, or both.\n\nA reviewer is a PostHog user, so a `user_uuid` only has to name an org member of this team: a\nmember with no linked GitHub account routes the report like anyone else. A `user_uuid` that\nisn't an org member of this team is rejected — so a reviewer is never silently dropped."
)
)
.max(signalsScoutEmitReportBodySuggestedReviewersMax)