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): clarify suggested reviewer warnings and reasons (#102550)

Mikayla Thompson6e2c760dadba
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 74ccfc51f0e0..8c495418af45 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -8441,9 +8441,21 @@ snapshots:
scenes-app-inbox-detail-suggested-reviewers-mockup--mixed-sources--light:
hash: v1.k794b7964.832b853e5530702b4dc355974fb5a180c1a5df170b6a5b2ac24ed3338739a7ee.UvPJQsQLSKbgiPTT6T5ANXiWDoDaDW55gBzSTjuuANk
scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel--dark:
- hash: v1.k794b7964.b06c6ec7e187f771dbf2310a85853bb38d122a666fe442cce9698d916b8d9377.z7zBzjEDnw62LYSOhuyzoCY5mrDx-ICgU5gv3AugCwE
+ hash: v1.k794b7964.b02ec8eb4fd5432a29e557a854088a7d391f8c9024f9c3a14db07626ef709c76.EihaPF404yjotqDlk3WktPd1T24f9wfb51ZPs3yjWMo
scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel--light:
- hash: v1.k794b7964.d74934baac736f22fb5a8e4045f81a08d2c9f99f7cdcd511fcf9ad38d545b726.Q_V70jpLlqE-vBEtApkx5weCBc0ilEYyrMiA3waHLFA
+ hash: v1.k794b7964.257725a5be826059dc386437060ff6109c980c10f37b8ce9415e0fcb6e627846.T1bCtj_piAMUIviTeJUiIzD5dVf3mhUFs0GK2eI1l4U
+ scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel-long-reason--dark:
+ hash: v1.k794b7964.b3f4c2a624841a4c1d5ed309e7a12d341f65df01458551ce306806206f9cf6e0.7Itv-KKNCbqmKeMel4X3Ih6noD2pOZUcJab2-4NF3Ps
+ scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel-long-reason--light:
+ hash: v1.k794b7964.83e830b32017dcfc4788fed1137124e13035614bf3fa88ff3f976c1ac7d7e670.qf-8EqA13Y5JIsUNGDKmWP_dwVnVlMQ6PQBVvmiOgV0
+ scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel-mixed-provenance--dark:
+ hash: v1.k794b7964.d48afedf632a04f7df377e4f440d46753693bd4d8aace6f245788824e6b7c3a9.feCoNDg39wsEjRC0RNmUsHMcklaD252tUTv5crJQWjM
+ scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel-mixed-provenance--light:
+ hash: v1.k794b7964.7c4b634fa709be5c92cfda3df30f8dda5bd27ffba4f7d01ad210a69c7989eb73.V39XGQoDPDUkDRjvUvwgge2_xt5s3-s38dACi41rG0M
+ scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel-mixed-sources--dark:
+ hash: v1.k794b7964.d884a4df973b267e0d033e992d27ce7c07893c50cd042a199077e371f11e9783.hDEd6L2MqaXKbtKGsFQ4NxUr0znzxnch_1T81gMCdPA
+ scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel-mixed-sources--light:
+ hash: v1.k794b7964.02d72bf99af10d2d65313b68ee111cfe882eafda04b473687cac108585c279f4.zWMxJGi8Trwor4kVRqtJ3E-uAsFdoh0vH1j4H2r5N7c
scenes-app-inbox-detail-suggested-reviewers-mockup--shared-reason--dark:
hash: v1.k794b7964.56be27289751456152e304aafe4b73c7cd23aeb16b3016466a2bb6948fbdb64f.rO6phNPQ6_GJVL5bjMyM3EKfdwZr0_smq1Gzb4whTUQ
scenes-app-inbox-detail-suggested-reviewers-mockup--shared-reason--light:
@@ -10413,9 +10425,9 @@ snapshots:
scenes-app-signals-artefactloglist--replacement-lifecycle--light:
hash: v1.k794b7964.9c43f6666a1a6a374d7de2874e8041d143d372b268675b7effc129b4759c676f.1ksfg48ORs-DX0VjvAFzGKg98c7Ikzp_Cr-tksdqVZ8
scenes-app-signals-artefactloglist--revision-limit--dark:
- hash: v1.k794b7964.d9e475caa06b8c102d144f5a714e26addf9fdfe71d0b5008a4d09448142d60d7.KrLa7tfvjyW7kx7jRx7f8a2uctJrVoOP47m2TBccgrc
+ hash: v1.k794b7964.220a1f67b3c655a2d124e2ed8b323d858f25bc9785bc393eac9cb122a1e3daba.AkQiVs_i1asxNJqJGTuURyKNwJ077RShklHFCGpsNwE
scenes-app-signals-artefactloglist--revision-limit--light:
- hash: v1.k794b7964.58b202e3e75574aea881674a34f3f4acb53f580c5a825ba170184ad997668fca.SOS8aKqoFBzkUv7HNSriyld2FYPYUPsq4Pqhb-91h64
+ hash: v1.k794b7964.24acbfbaa0f9dcfeccc10bad023376f4c32fca1306a76be6978a96cf7e971f24.D_7dFmBycH2SePQkO8BumZq25J3y2hbW-nl4FWmARBs
scenes-app-signals-artefactpullrequest--open--dark:
hash: v1.k794b7964.9cdaa27967468d3b2fc4431b8833b9cc184af6584881b783b28be6d504695272.v-TYHIq6zFNHT_YPm60gY4WyJE45sSXL_JmtDGW5h8M
scenes-app-signals-artefactpullrequest--open--light:
diff --git a/products/signals/ARCHITECTURE.md b/products/signals/ARCHITECTURE.md
index db82be2f3a6d..12bc1d6d0844 100644
--- a/products/signals/ARCHITECTURE.md
+++ b/products/signals/ARCHITECTURE.md
@@ -1086,8 +1086,8 @@ Generated MCP tool names:
- **`SignalReportArtefactSerializer`**
- Exposes `id`, `type`, `content`, `created_at`
- Parses JSON text into structured content
- - For `suggested_reviewers`, enriches the stored payload with fresh PostHog org-member data, a source label, and a concise explanation
- - The inbox groups reviewers only when their displayed explanations match exactly, then shows the explanation once below the grouped people
+- For `suggested_reviewers`, enriches the stored payload with fresh PostHog org-member data, the source skill, a source label, and a concise explanation. Scout labels use the current team config display name when set. Reasons are limited to 500 characters on write, and older oversized reasons are omitted from the explanation on read. Inbox and scout reviewer edits discard oversized legacy reason text while keeping the reviewer and valid commit evidence. The inbox marks reviewers without a linked PostHog member.
+ - The inbox groups reviewers only when their displayed explanations and source categories match, then shows the explanation once below the grouped people. Scouts with different display names share one category and one badge; code history and other sources remain separate.
---
diff --git a/products/signals/backend/artefact_schemas.py b/products/signals/backend/artefact_schemas.py
index 5e4693f463a6..705b00019db3 100644
--- a/products/signals/backend/artefact_schemas.py
+++ b/products/signals/backend/artefact_schemas.py
@@ -179,7 +179,7 @@ class RelevantCommit(BaseModel):
model_config = ConfigDict(extra="forbid")
- reason: str
+ reason: str = Field(max_length=500)
sha: str
url: str
@@ -211,6 +211,7 @@ class SuggestedReviewerEntry(BaseModel):
)
reason: str | None = Field(
default=None,
+ max_length=500,
description="Why this reviewer was chosen — the evidence behind the routing (e.g. recent author on the affected surface, human correction precedent).",
)
is_skill_owner: bool = Field(
diff --git a/products/signals/backend/contracts.py b/products/signals/backend/contracts.py
index 2174c087d740..a66767230967 100644
--- a/products/signals/backend/contracts.py
+++ b/products/signals/backend/contracts.py
@@ -533,6 +533,7 @@ class EnrichedReviewer(ContractModel):
relevant_commits: list[RelevantCommit]
user: SignalReviewerUserInfo | None
reason: str | None = None
+ source_skill: str | None = None
source_label: str
explanation: str | None = None
diff --git a/products/signals/backend/report_generation/resolve_reviewers.py b/products/signals/backend/report_generation/resolve_reviewers.py
index 3d0ee7732e9f..c85a67512fc1 100644
--- a/products/signals/backend/report_generation/resolve_reviewers.py
+++ b/products/signals/backend/report_generation/resolve_reviewers.py
@@ -39,12 +39,13 @@ from products.signals.backend.report_generation.repo_activity import (
repository_activity_needs_rebuild,
)
-from ..models import SignalReportArtefact
+from ..models import SignalReportArtefact, SignalScoutConfig
logger = logging.getLogger(__name__)
MAX_SUGGESTED_REVIEWERS = 3
MAX_COMMIT_LOOKUPS = 15
+MAX_REVIEWER_REASON_LENGTH = 500
RECENCY_FULL_WEIGHT_DAYS = 30
RECENCY_DECAY_FLOOR = 0.3
@@ -120,6 +121,7 @@ def enrich_reviewer_dicts_with_org_members(
*,
login_to_user: Mapping[str, User] | None = None,
uuid_to_user: Mapping[str, User] | None = None,
+ scout_display_names: Mapping[str, str] | None = None,
) -> list[dict]:
"""Enrich reviewer dicts (from artefact content) with fresh PostHog user info.
@@ -133,6 +135,18 @@ def enrich_reviewer_dicts_with_org_members(
if not reviewer_dicts:
return reviewer_dicts
+ skill_names = {r.get("source_skill") for r in reviewer_dicts if isinstance(r.get("source_skill"), str)}
+ if scout_display_names is None:
+ scout_display_names = (
+ dict(
+ SignalScoutConfig.objects.for_team(team_id)
+ .filter(skill_name__in=skill_names)
+ .values_list("skill_name", "display_name")
+ )
+ if skill_names
+ else {}
+ )
+
resolved_map: Mapping[str, User]
if login_to_user is not None:
resolved_map = login_to_user
@@ -156,7 +170,7 @@ def enrich_reviewer_dicts_with_org_members(
# 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(_with_reviewer_presentation(r, user))
+ enriched.append(_with_reviewer_presentation(r, user, scout_display_names))
return enriched
@@ -166,38 +180,53 @@ def _prettify_scout_name(skill_name: str) -> str:
return cleaned[:1].upper() + cleaned[1:] if cleaned else "Scout"
+def bounded_reviewer_reason(reason: object) -> str | None:
+ return reason if isinstance(reason, str) and len(reason) <= MAX_REVIEWER_REASON_LENGTH else None
+
+
def _commit_explanation(commits: list[object]) -> str:
if len(commits) == 1 and isinstance(commits[0], dict):
reason = commits[0].get("reason")
- if isinstance(reason, str) and 0 < len(reason.split()) <= 12:
+ if isinstance(reason, str) and 0 < len(reason.split(maxsplit=12)) <= 12:
return reason.strip()
if len(commits) == 1:
return "Authored a relevant change to the affected code."
return f"Authored {len(commits)} relevant changes to the affected code."
-def _with_reviewer_presentation(reviewer: dict, user: User | None) -> dict:
+def _with_reviewer_presentation(reviewer: dict, user: User | None, scout_display_names: Mapping[str, str]) -> dict:
commits = reviewer.get("relevant_commits")
commit_list: list[object] = commits if isinstance(commits, list) else []
+ safe_commits = [
+ {**commit, "reason": bounded_reviewer_reason(commit.get("reason")) or ""}
+ if isinstance(commit, dict)
+ else commit
+ for commit in commit_list
+ ]
source_skill = reviewer.get("source_skill")
reason = reviewer.get("reason")
+ safe_reason = bounded_reviewer_reason(reason)
explanation: str | None
- if commit_list:
+ if safe_commits:
source_label = "Code history"
- explanation = _commit_explanation(commit_list)
+ explanation = _commit_explanation(safe_commits)
elif isinstance(source_skill, str) and source_skill:
- source_label = f"{_prettify_scout_name(source_skill)} scout"
- explanation = reason if isinstance(reason, str) else None
- elif isinstance(reason, str) and reason.startswith("Added as a reviewer by "):
+ source_label = (
+ scout_display_names.get(source_skill, "").strip() or f"{_prettify_scout_name(source_skill)} scout"
+ )
+ explanation = safe_reason
+ elif isinstance(safe_reason, str) and safe_reason.startswith("Added as a reviewer by "):
source_label = "Added by teammate"
explanation = None
else:
source_label = "Agent suggestion"
- explanation = reason if isinstance(reason, str) else None
+ explanation = safe_reason
return {
**reviewer,
+ "reason": safe_reason,
+ "relevant_commits": safe_commits,
"source_label": source_label,
"explanation": explanation,
"user": {
@@ -229,6 +258,23 @@ def normalized_github_logins_from_suggested_reviewer_artefacts(
return frozenset(out)
+def source_skills_from_suggested_reviewer_artefacts(artefacts: Iterable[SignalReportArtefact]) -> frozenset[str]:
+ skills: 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
+ for row in parsed_list:
+ if isinstance(row, dict) and isinstance(row.get("source_skill"), str):
+ skills.add(row["source_skill"])
+ return frozenset(skills)
+
+
def normalized_github_logins_from_reviewer_payloads(rows: Iterable[object]) -> frozenset[str]:
logins: set[str] = set()
for row in rows:
@@ -432,7 +478,9 @@ def resolve_suggested_reviewers_with_diagnostics(
login = author_info.login.lower()
weight = total - i
login_weights[login] += weight
- login_commits.setdefault(login, []).append(RelevantCommit(sha=sha, url=author_info.commit_url, reason=reason))
+ login_commits.setdefault(login, []).append(
+ RelevantCommit(sha=sha, url=author_info.commit_url, reason=bounded_reviewer_reason(reason) or "")
+ )
if login not in login_names:
login_names[login] = author_info.name
@@ -541,10 +589,11 @@ def _rank_scored_candidates(
RelevantCommit(
sha=activity.last_commit_sha,
url=activity.last_commit_url,
- reason=(
+ reason=bounded_reviewer_reason(
f"Recently active in {_area_label(activity.area)} "
f"({activity.commit_count} commit(s) in the last {ACTIVITY_WINDOW_DAYS} days)."
- ),
+ )
+ or "Recently active in the affected code.",
)
]
name = login_names.get(login)
diff --git a/products/signals/backend/scout_report/persistence.py b/products/signals/backend/scout_report/persistence.py
index 541deb18ed89..bfcdbc0f2d97 100644
--- a/products/signals/backend/scout_report/persistence.py
+++ b/products/signals/backend/scout_report/persistence.py
@@ -68,7 +68,7 @@ from products.signals.backend.models import (
)
from products.signals.backend.repo_corrections import SCOUT_REPOSITORY_REASON
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.resolve_reviewers import ReviewerPayloadIndex, bounded_reviewer_reason
from products.signals.backend.report_generation.reviewer_telemetry import capture_suggested_reviewers_resolved
from products.signals.backend.report_generation.select_repo import RepoSelectionResult, persisted_repo_selection
from products.signals.backend.report_metrics import ReportMetric, metric_batch_error
@@ -1012,12 +1012,23 @@ def _merge_forward_reviewer_evidence(*, report_id: str, suggested_reviewers: Sug
if prior is None:
merged.append(entry)
continue
+ prior_commits = prior.get("relevant_commits")
+ safe_commits = (
+ [
+ {**commit, "reason": bounded_reviewer_reason(commit.get("reason")) or ""}
+ if isinstance(commit, dict)
+ else commit
+ for commit in prior_commits
+ ]
+ if isinstance(prior_commits, list)
+ else []
+ )
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"),
+ "relevant_commits": entry.relevant_commits or safe_commits,
+ "reason": entry.reason if entry.reason is not None else bounded_reviewer_reason(prior.get("reason")),
# Owner provenance is recomputed from the live `LLMSkillOwner` set on every
# reviewers-setting edit, so the fresh entry's flag wins — OR-ing in the prior value
# would keep a former owner, re-added as a normal reviewer, excluded from autostart
diff --git a/products/signals/backend/serializers.py b/products/signals/backend/serializers.py
index 790448f777c9..3fe36bfcd844 100644
--- a/products/signals/backend/serializers.py
+++ b/products/signals/backend/serializers.py
@@ -1840,11 +1840,16 @@ class SignalReportArtefactSerializer(serializers.ModelSerializer):
Mapping[str, User] | None,
self.context.get("signals_reviewer_user_uuid_map"),
)
+ scout_display_names = cast(
+ Mapping[str, str] | None,
+ self.context.get("signals_scout_display_names"),
+ )
return enrich_reviewer_dicts_with_org_members(
obj.team_id,
parsed,
login_to_user=reviewer_login_map,
uuid_to_user=reviewer_uuid_map,
+ scout_display_names=scout_display_names,
)
if obj.type == SignalReportArtefact.ArtefactType.CHECK_RESULT and isinstance(parsed, dict):
diff --git a/products/signals/backend/test/test_artefact_schemas.py b/products/signals/backend/test/test_artefact_schemas.py
index 998a8354b87d..c152ff2626b9 100644
--- a/products/signals/backend/test/test_artefact_schemas.py
+++ b/products/signals/backend/test/test_artefact_schemas.py
@@ -11,6 +11,7 @@ from products.signals.backend.artefact_schemas import (
CodeReference,
Commit,
NoteArtefact,
+ RelevantCommit,
SuggestedReviewerEntry,
SummaryChange,
TaskRunArtefact,
@@ -22,6 +23,12 @@ from products.signals.backend.models import SignalReportArtefact
class TestArtefactSchemas(SimpleTestCase):
+ def test_reviewer_reasons_are_bounded_on_write(self):
+ with self.assertRaises(ValidationError):
+ SuggestedReviewerEntry(github_login="reviewer", reason="x" * 501)
+ with self.assertRaises(ValidationError):
+ RelevantCommit(sha="abc1234", url="https://example.com", reason="x" * 501)
+
def test_registry_covers_every_artefact_type_exactly(self):
assert set(ARTEFACT_CONTENT_SCHEMAS.keys()) == set(SignalReportArtefact.ArtefactType.values)
diff --git a/products/signals/backend/test/test_resolve_reviewers.py b/products/signals/backend/test/test_resolve_reviewers.py
index 928c6df7a995..22a16bd6b70e 100644
--- a/products/signals/backend/test/test_resolve_reviewers.py
+++ b/products/signals/backend/test/test_resolve_reviewers.py
@@ -17,7 +17,8 @@ from posthog.models.organization import OrganizationMembership
from posthog.models.scoping import team_scope
from posthog.models.user_integration import UserIntegration
-from products.signals.backend.models import SignalRepositoryAreaActivity
+from products.signals.backend.artefact_schemas import SuggestedReviewers
+from products.signals.backend.models import SignalRepositoryAreaActivity, SignalScoutConfig
from products.signals.backend.report_generation.author_activity import AUTHOR_ACTIVITY_WINDOW_DAYS
from products.signals.backend.report_generation.repo_activity import ACTIVITY_WINDOW_DAYS, ContributorActivity
from products.signals.backend.report_generation.resolve_reviewers import (
@@ -26,6 +27,7 @@ from products.signals.backend.report_generation.resolve_reviewers import (
RECENCY_FULL_WEIGHT_DAYS,
STALE_BLAME_MULTIPLIER,
_AreaContributor,
+ _rank_scored_candidates,
_recency_multiplier,
_relevant_area_activity,
_score_candidates,
@@ -172,6 +174,7 @@ def test_enriches_reviewer_sources_and_explanations():
],
login_to_user={},
uuid_to_user={},
+ scout_display_names={},
)
assert enriched[0]["source_label"] == "Code history"
@@ -183,6 +186,38 @@ def test_enriches_reviewer_sources_and_explanations():
assert enriched[3]["explanation"] is None
+def test_scout_source_uses_current_team_display_name(team):
+ config = SignalScoutConfig.objects.for_team(team.id).create(
+ team=team, skill_name="signals-scout-apm", display_name="APM scout"
+ )
+ reviewers = [{"github_login": "reviewer", "source_skill": config.skill_name, "reason": "Owns this area."}]
+
+ enriched = enrich_reviewer_dicts_with_org_members(team.id, reviewers, login_to_user={}, uuid_to_user={})
+ assert enriched[0]["source_label"] == "APM scout"
+
+ config.display_name = "Platform APM scout"
+ config.save(update_fields=["display_name"])
+ enriched = enrich_reviewer_dicts_with_org_members(team.id, reviewers, login_to_user={}, uuid_to_user={})
+ assert enriched[0]["source_label"] == "Platform APM scout"
+
+
+def test_legacy_long_reviewer_reasons_do_not_reach_presentation():
+ long_reason = "word " * 101
+ reviewers: list[dict[str, object]] = [
+ {"github_login": "author", "relevant_commits": [{"reason": long_reason}]},
+ {"github_login": "candidate", "reason": long_reason},
+ ]
+
+ enriched = enrich_reviewer_dicts_with_org_members(
+ 1, reviewers, login_to_user={}, uuid_to_user={}, scout_display_names={}
+ )
+ assert enriched[0]["explanation"] == "Authored a relevant change to the affected code."
+ assert enriched[0]["relevant_commits"][0]["reason"] == ""
+ assert enriched[1]["explanation"] is None
+ assert enriched[1]["reason"] is None
+
+
@pytest.mark.django_db
def test_skips_users_outside_organization(organization, team):
other_org = Organization.objects.create(name="test-resolve-reviewers-other-org")
@@ -450,6 +485,80 @@ class TestRankAssigneeCandidates:
@pytest.mark.django_db
class TestResolveSuggestedReviewersEndToEnd:
+ def test_oversized_area_label_keeps_fallback_reviewer_payload_valid(self):
+ activity = _AreaContributor(
+ name="Area Owner",
+ commit_count=1,
+ days_since_last_commit=1,
+ last_commit_sha="a" * 7,
+ last_commit_url="https://github.com/acme/app/commit/aaaaaaa",
+ area="/".join(["a" * 250, "b" * 250]),
+ is_likely_owner_of_area=True,
+ )
+
+ reviewers = _rank_scored_candidates(Counter(), {"area-owner": activity}, {}, {})
+
+ assert reviewers[0].commits[0].reason == "Recently active in the affected code."
+ SuggestedReviewers.model_validate(
+ [
+ {
+ "github_login": reviewer.login,
+ "relevant_commits": [commit.model_dump() for commit in reviewer.commits],
+ }
+ for reviewer in reviewers
+ ]
+ )
+
+ @pytest.mark.parametrize(("reason", "expected_reason"), [("x" * 500, "x" * 500), ("x" * 501, "")])
+ def test_commit_reason_limit_keeps_reviewer_payload_valid(self, team, reason, expected_reason):
+ class FakeGitHub:
+ def get_commit_author_info(self, repository, sha):
+ return GitHubCommitAuthor(
+ login="active-author",
+ name="Active Author",
+ commit_url=f"https://github.com/acme/app/commit/{sha}",
+ file_paths=("products/signals/backend/models.py",),
+ )
+
+ activity = {
+ "products/signals": [
+ ContributorActivity(
+ login="active-author",
+ name="Active Author",
+ commit_count=1,
+ last_commit_at=timezone.now() - timedelta(days=1),
+ last_commit_sha="a" * 7,
+ last_commit_url="https://github.com/acme/app/commit/aaaaaaa",
+ )
+ ]
+ }
+ with (
+ patch(
+ "products.signals.backend.report_generation.resolve_reviewers.GitHubIntegration.first_for_team_repository",
+ return_value=FakeGitHub(),
+ ),
+ patch(
+ "products.signals.backend.report_generation.resolve_reviewers.get_area_activity",
+ return_value=activity,
+ ),
+ patch(
+ "products.signals.backend.report_generation.resolve_reviewers.repository_activity_needs_rebuild",
+ return_value=False,
+ ),
+ ):
+ reviewers = resolve_suggested_reviewers(team.id, "acme/app", {"d" * 7: reason})
+
+ assert reviewers[0].commits[0].reason == expected_reason
+ SuggestedReviewers.model_validate(
+ [
+ {
+ "github_login": reviewer.login,
+ "relevant_commits": [commit.model_dump() for commit in reviewer.commits],
+ }
+ for reviewer in reviewers
+ ]
+ )
+
def test_stale_blame_author_demoted_and_active_owner_suggested(self, team):
class FakeGitHub:
def get_commit_author_info(self, repository, sha):
diff --git a/products/signals/backend/test/test_scout_report_persistence.py b/products/signals/backend/test/test_scout_report_persistence.py
index 69143c1895e6..e849d16af618 100644
--- a/products/signals/backend/test/test_scout_report_persistence.py
+++ b/products/signals/backend/test/test_scout_report_persistence.py
@@ -1,3 +1,4 @@
+import json
from contextlib import AbstractContextManager
from datetime import UTC, datetime
@@ -252,6 +253,52 @@ class TestScoutReportPersistence(BaseTest):
assert kwargs["source"] == "scout_edit"
assert kwargs["github_logins"] == ["octocat"]
+ def test_set_reviewers_preserves_legacy_commit_with_oversized_reasons(self) -> None:
+ result = create_scout_report(
+ team_id=self.team.id,
+ title="Checkout API latency regressed",
+ summary="The checkout endpoint slowed after a deploy.",
+ signals=[ScoutReportSignal(description="Latency increased", source_id="obs-1", weight=1.0)],
+ attribution=ArtefactAttribution.system(),
+ )
+ SignalReportArtefact.objects.create(
+ team_id=self.team.id,
+ report_id=result.report_id,
+ type=SignalReportArtefact.ArtefactType.SUGGESTED_REVIEWERS,
+ content=json.dumps(
+ [
+ {
+ "github_login": "octocat",
+ "reason": "r" * 501,
+ "relevant_commits": [
+ {"sha": "abc123f", "url": "https://example.com/c/abc123f", "reason": "c" * 501}
+ ],
+ }
+ ]
+ ),
+ )
+
+ set_scout_report_reviewers(
+ team_id=self.team.id,
+ report_id=result.report_id,
+ suggested_reviewers=SuggestedReviewers(root=[SuggestedReviewerEntry(github_login="octocat")]),
+ attribution=ArtefactAttribution.system(),
+ )
+
+ latest = (
+ SignalReportArtefact.objects.filter(
+ report_id=result.report_id, type=SignalReportArtefact.ArtefactType.SUGGESTED_REVIEWERS
+ )
+ .order_by("-created_at")
+ .first()
+ )
+ assert latest is not None
+ reviewer = json.loads(latest.content)[0]
+ assert reviewer["reason"] is None
+ assert reviewer["relevant_commits"] == [
+ {"sha": "abc123f", "url": "https://example.com/c/abc123f", "reason": ""}
+ ]
+
@parameterized.expand(
[
("empty_title", "", "summary", [ScoutReportSignal(description="d", source_id="s")]),
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 f34b6603f0dd..4ebdbea60c24 100644
--- a/products/signals/backend/test/test_signal_report_artefact_api.py
+++ b/products/signals/backend/test/test_signal_report_artefact_api.py
@@ -206,6 +206,34 @@ class TestSignalReportArtefactViewSet(APIBaseTest):
assert [r["github_login"] for r in stored] == ["bob", "carol"]
assert all(r["relevant_commits"] == [] for r in stored)
+ def test_put_keeps_legacy_reviewer_with_oversized_reasons(self):
+ report = self._create_report()
+ artefact = self._create_artefact(
+ report,
+ content=[
+ {
+ "github_login": "alice",
+ "reason": "x" * 501,
+ "relevant_commits": [
+ {"sha": "abc123f", "url": "https://example.com/c/abc123f", "reason": "y" * 501}
+ ],
+ }
+ ],
+ )
+
+ 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, response.json()
+ reviewer = self._latest_reviewers(report)[0]
+ assert reviewer["reason"] is None
+ assert reviewer["relevant_commits"] == [
+ {"sha": "abc123f", "url": "https://example.com/c/abc123f", "reason": ""}
+ ]
+
def test_put_appends_new_status_row_keeping_history(self):
report = self._create_report()
original = self._create_artefact(
diff --git a/products/signals/backend/views.py b/products/signals/backend/views.py
index da0d4ef9f289..2d8f832f891c 100644
--- a/products/signals/backend/views.py
+++ b/products/signals/backend/views.py
@@ -114,6 +114,7 @@ from products.signals.backend.models import (
SignalReportArtefact,
SignalReportCheck,
SignalReportRefund,
+ SignalScoutConfig,
SignalSourceConfig,
SignalTeamConfig,
SignalUserAutonomyConfig,
@@ -137,12 +138,14 @@ from products.signals.backend.report_claims import (
from products.signals.backend.report_generation.research import ActionabilityChoice
from products.signals.backend.report_generation.resolve_reviewers import (
ReviewerPayloadIndex,
+ bounded_reviewer_reason,
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,
+ source_skills_from_suggested_reviewer_artefacts,
)
from products.signals.backend.report_generation.reviewer_telemetry import capture_suggested_reviewers_resolved
from products.signals.backend.report_metric_access import ReportMetricAccessPolicy
@@ -4104,15 +4107,25 @@ def append_suggested_reviewers(
# 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 = resolved.github_name if resolved.explicit_name else prior_name
- effective_reason = resolved.reason if resolved.explicit_reason else prior_reason
+ effective_reason = resolved.reason if resolved.explicit_reason else bounded_reviewer_reason(prior_reason)
if not resolved.explicit_reason and prior is None:
effective_reason = manual_add_reason
+ safe_commits = (
+ [
+ {**commit, "reason": bounded_reviewer_reason(commit.get("reason")) or ""}
+ if isinstance(commit, dict)
+ else commit
+ for commit in prior_commits
+ ]
+ if isinstance(prior_commits, list)
+ else []
+ )
new_content.append(
{
"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 [],
+ "relevant_commits": safe_commits,
"reason": effective_reason or None,
"source_skill": prior.get("source_skill") if prior else None,
"is_skill_owner": bool(prior.get("is_skill_owner")) if prior else False,
@@ -4533,6 +4546,16 @@ class SignalReportArtefactViewSet(
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 {}
+ skills_union = source_skills_from_suggested_reviewer_artefacts(artefacts)
+ scout_display_names = (
+ dict(
+ SignalScoutConfig.objects.for_team(self.team.id)
+ .filter(skill_name__in=skills_union)
+ .values_list("skill_name", "display_name")
+ )
+ if skills_union
+ else {}
+ )
serializer = SignalReportArtefactSerializer(
artefacts,
many=True,
@@ -4540,6 +4563,7 @@ class SignalReportArtefactViewSet(
**self.get_serializer_context(),
"signals_github_login_to_user_map": login_map,
"signals_reviewer_user_uuid_map": uuid_map,
+ "signals_scout_display_names": scout_display_names,
},
)
if page is not None:
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewerPerson.tsx b/products/signals/frontend/inbox/components/detail/SuggestedReviewerPerson.tsx
index ef036b48f148..851c2f54e8c8 100644
--- a/products/signals/frontend/inbox/components/detail/SuggestedReviewerPerson.tsx
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewerPerson.tsx
@@ -1,11 +1,13 @@
import { IconX } from '@posthog/icons'
-import { LemonButton, LemonTag } from '@posthog/lemon-ui'
+import { LemonButton, LemonTag, Tooltip } from '@posthog/lemon-ui'
import { PersonDisplay } from 'products/persons/frontend/components/PersonDisplay'
import { EnrichedReviewer } from '../../types'
import { getReviewerDisplayName } from './reviewerDisplay'
+const OTHER_SOURCE_LABELS = new Set(['Code history', 'Added by teammate', 'Agent suggestion'])
+
export function getReviewerSourceLabel(reviewer: EnrichedReviewer): string {
if (reviewer.source_label) {
return reviewer.source_label
@@ -19,6 +21,13 @@ export function getReviewerSourceLabel(reviewer: EnrichedReviewer): string {
return 'Agent suggestion'
}
+export function isScoutReviewer(reviewer: EnrichedReviewer): boolean {
+ if (reviewer.source_skill !== undefined) {
+ return Boolean(reviewer.source_skill && reviewer.relevant_commits.length === 0)
+ }
+ return !OTHER_SOURCE_LABELS.has(getReviewerSourceLabel(reviewer))
+}
+
export function getReviewerExplanation(reviewer: EnrichedReviewer): string | null {
if ('explanation' in reviewer) {
return reviewer.explanation ?? null
@@ -40,20 +49,36 @@ export function SuggestedReviewerPerson({
const sourceLabel = getReviewerSourceLabel(reviewer)
return (
- <div className="group relative grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-2 rounded px-1.5 py-1.5">
- <div className={`flex min-w-0 flex-col gap-0.5 ${reviewer.user ? '' : 'opacity-75'}`}>
- <PersonDisplay
- person={{ properties: { email: reviewer.user?.email, name: displayName } }}
- displayName={displayName}
- withIcon="xs"
- noLink
- noPopover
- />
- {explanation && <span className="text-xs leading-snug text-tertiary">{explanation}</span>}
+ <div className="group relative grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 gap-y-0.5 rounded px-1.5 py-1.5">
+ <div className={`min-w-0 ${reviewer.user ? '' : 'opacity-75'}`}>
+ <Tooltip
+ title={
+ reviewer.user
+ ? undefined
+ : 'This reviewer is not linked to a PostHog member and cannot receive the report.'
+ }
+ >
+ <span>
+ <PersonDisplay
+ person={{ properties: { email: reviewer.user?.email, name: displayName } }}
+ displayName={displayName}
+ withIcon="xs"
+ noLink
+ noPopover
+ />
+ </span>
+ </Tooltip>
</div>
- <LemonTag type="muted" size="small">
+ <LemonTag type="muted" size="small" wrap className="max-w-32">
{sourceLabel}
</LemonTag>
+ {explanation && (
+ <span
+ className={`col-span-2 min-w-0 text-xs leading-snug text-tertiary [overflow-wrap:anywhere] ${reviewer.user ? '' : 'opacity-75'}`}
+ >
+ {explanation}
+ </span>
+ )}
<LemonButton
type="tertiary"
size="xsmall"
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewerReasonGroup.tsx b/products/signals/frontend/inbox/components/detail/SuggestedReviewerReasonGroup.tsx
index 6c4052a46fec..a407eb6f1e9e 100644
--- a/products/signals/frontend/inbox/components/detail/SuggestedReviewerReasonGroup.tsx
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewerReasonGroup.tsx
@@ -1,24 +1,34 @@
import { IconX } from '@posthog/icons'
-import { LemonButton, LemonTag } from '@posthog/lemon-ui'
+import { LemonButton, LemonTag, Tooltip } from '@posthog/lemon-ui'
import { PersonDisplay } from 'products/persons/frontend/components/PersonDisplay'
import { EnrichedReviewer } from '../../types'
import { getReviewerDisplayName } from './reviewerDisplay'
+import { getReviewerSourceLabel, isScoutReviewer } from './SuggestedReviewerPerson'
export function SuggestedReviewerReasonGroup({
reviewers,
reason,
- sourceLabels,
disabled,
onRemove,
}: {
reviewers: EnrichedReviewer[]
reason: string
- sourceLabels: string[]
disabled: boolean
onRemove: (reviewer: EnrichedReviewer) => void
}): JSX.Element {
+ const scoutNames = new Set<string>()
+ const otherSourceLabels = new Set<string>()
+ for (const reviewer of reviewers) {
+ const sourceLabel = getReviewerSourceLabel(reviewer)
+ if (isScoutReviewer(reviewer)) {
+ scoutNames.add(sourceLabel)
+ } else {
+ otherSourceLabels.add(sourceLabel)
+ }
+ }
+
return (
<div className="rounded border bg-primary">
<div className="flex flex-col p-1">
@@ -30,13 +40,23 @@ export function SuggestedReviewerReasonGroup({
key={reviewer.user?.uuid ?? reviewer.user_uuid ?? reviewer.github_login}
className="group/member relative flex min-w-0 items-center rounded py-0.5 pr-7 pl-1.5 hover:bg-fill-highlight"
>
- <PersonDisplay
- person={{ properties: { email: reviewer.user?.email, name: displayName } }}
- displayName={displayName}
- withIcon="xs"
- noLink
- noPopover
- />
+ <Tooltip
+ title={
+ reviewer.user
+ ? undefined
+ : 'This reviewer is not linked to a PostHog member and cannot receive the report.'
+ }
+ >
+ <span className={reviewer.user ? undefined : 'opacity-75'}>
+ <PersonDisplay
+ person={{ properties: { email: reviewer.user?.email, name: displayName } }}
+ displayName={displayName}
+ withIcon="xs"
+ noLink
+ noPopover
+ />
+ </span>
+ </Tooltip>
<LemonButton
type="tertiary"
size="xsmall"
@@ -51,10 +71,25 @@ export function SuggestedReviewerReasonGroup({
})}
</div>
<div className="flex min-w-0 items-start justify-between gap-2 border-t px-2.5 py-2">
- <span className="min-w-0 text-xs leading-snug text-tertiary">{reason}</span>
- <span className="flex shrink-0 flex-wrap justify-end gap-1">
- {sourceLabels.map((sourceLabel) => (
- <LemonTag key={sourceLabel} type="muted" size="small">
+ <span className="min-w-0 text-xs leading-snug text-tertiary [overflow-wrap:anywhere]">{reason}</span>
+ <span className="flex min-w-0 flex-wrap justify-end gap-1">
+ {scoutNames.size > 0 && (
+ <Tooltip
+ title={
+ <div className="flex flex-col">
+ {[...scoutNames].map((scoutName) => (
+ <span key={scoutName}>{scoutName}</span>
+ ))}
+ </div>
+ }
+ >
+ <LemonTag type="muted" size="small" className="cursor-help">
+ Added by scout
+ </LemonTag>
+ </Tooltip>
+ )}
+ {[...otherSourceLabels].map((sourceLabel) => (
+ <LemonTag key={sourceLabel} type="muted" size="small" wrap className="max-w-32">
{sourceLabel}
</LemonTag>
))}
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewersList.test.ts b/products/signals/frontend/inbox/components/detail/SuggestedReviewersList.test.ts
index 6d5cad2e0d6d..22c7ebb8e773 100644
--- a/products/signals/frontend/inbox/components/detail/SuggestedReviewersList.test.ts
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewersList.test.ts
@@ -1,48 +1,72 @@
import { EnrichedReviewer } from '../../types'
import { buildReviewerItems } from './SuggestedReviewersList'
-function reviewer(id: string, explanation: string | null, sourceLabel: string): EnrichedReviewer {
+function reviewer(
+ id: string,
+ explanation: string | null,
+ sourceLabel: string,
+ sourceSkill?: string | null
+): EnrichedReviewer {
return {
github_login: id,
user_uuid: id,
github_name: id,
- relevant_commits: [],
+ relevant_commits:
+ sourceLabel === 'Code history'
+ ? [{ sha: 'abc123f', url: 'https://example.com/c/abc123f', reason: explanation ?? '' }]
+ : [],
user: null,
+ source_skill: sourceSkill,
source_label: sourceLabel,
explanation,
}
}
describe('buildReviewerItems', () => {
- it('groups only exact repeated explanations and keeps unique reviewers separate', () => {
+ it('groups exact repeated explanations only within the same source category', () => {
const sharedReason = 'Maintains the request execution parser.'
const items = buildReviewerItems([
- reviewer('avery', sharedReason, 'Runtime ownership scout'),
- reviewer('jordan', sharedReason, 'Code history'),
- reviewer('rowan', `${sharedReason} `, 'Runtime ownership scout'),
- reviewer('casey', null, 'Agent suggestion'),
+ reviewer('avery', sharedReason, 'Runtime ownership scout', 'signals-scout-runtime-ownership'),
+ reviewer('jordan', sharedReason, 'Code history', null),
+ reviewer('morgan', sharedReason, 'Infrastructure scout', 'signals-scout-infrastructure'),
+ reviewer('taylor', sharedReason, 'Code history', null),
+ reviewer('rowan', `${sharedReason} `, 'Runtime ownership scout', 'signals-scout-runtime-ownership'),
+ reviewer('casey', null, 'Agent suggestion', null),
])
expect(items).toEqual([
{
kind: 'reason-group',
- key: JSON.stringify(['reason-group', sharedReason]),
+ key: JSON.stringify(['reason-group', sharedReason, 'scout', null]),
reason: sharedReason,
reviewers: [
- reviewer('avery', sharedReason, 'Runtime ownership scout'),
- reviewer('jordan', sharedReason, 'Code history'),
+ reviewer('avery', sharedReason, 'Runtime ownership scout', 'signals-scout-runtime-ownership'),
+ reviewer('morgan', sharedReason, 'Infrastructure scout', 'signals-scout-infrastructure'),
+ ],
+ },
+ {
+ kind: 'reason-group',
+ key: JSON.stringify(['reason-group', sharedReason, 'other', 'Code history']),
+ reason: sharedReason,
+ reviewers: [
+ reviewer('jordan', sharedReason, 'Code history', null),
+ reviewer('taylor', sharedReason, 'Code history', null),
],
- sourceLabels: ['Runtime ownership scout', 'Code history'],
},
{
kind: 'person',
key: 'rowan',
- reviewer: reviewer('rowan', `${sharedReason} `, 'Runtime ownership scout'),
+ reviewer: reviewer(
+ 'rowan',
+ `${sharedReason} `,
+ 'Runtime ownership scout',
+ 'signals-scout-runtime-ownership'
+ ),
},
{
kind: 'person',
key: 'casey',
- reviewer: reviewer('casey', null, 'Agent suggestion'),
+ reviewer: reviewer('casey', null, 'Agent suggestion', null),
},
])
})
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewersList.tsx b/products/signals/frontend/inbox/components/detail/SuggestedReviewersList.tsx
index 113ebc3140fb..7d6331043311 100644
--- a/products/signals/frontend/inbox/components/detail/SuggestedReviewersList.tsx
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewersList.tsx
@@ -3,7 +3,12 @@ import { useState } from 'react'
import { LemonButton } from '@posthog/lemon-ui'
import { EnrichedReviewer } from '../../types'
-import { getReviewerExplanation, getReviewerSourceLabel, SuggestedReviewerPerson } from './SuggestedReviewerPerson'
+import {
+ getReviewerExplanation,
+ getReviewerSourceLabel,
+ isScoutReviewer,
+ SuggestedReviewerPerson,
+} from './SuggestedReviewerPerson'
import { SuggestedReviewerReasonGroup } from './SuggestedReviewerReasonGroup'
const MAX_VISIBLE_SUGGESTIONS = 5
@@ -19,7 +24,6 @@ interface ReviewerReasonGroupItem {
key: string
reason: string
reviewers: EnrichedReviewer[]
- sourceLabels: string[]
}
type ReviewerItem = ReviewerPersonItem | ReviewerReasonGroupItem
@@ -32,6 +36,16 @@ function getReviewerDisplayFallback(reviewer: EnrichedReviewer): string {
return reviewer.github_name ?? reviewer.user?.email ?? 'unknown-reviewer'
}
+function reviewerReasonGroupKey(reviewer: EnrichedReviewer, reason: string): string {
+ const isScout = isScoutReviewer(reviewer)
+ return JSON.stringify([
+ 'reason-group',
+ reason,
+ isScout ? 'scout' : 'other',
+ isScout ? null : getReviewerSourceLabel(reviewer),
+ ])
+}
+
export function buildReviewerItems(reviewers: EnrichedReviewer[]): ReviewerItem[] {
const items: ReviewerItem[] = []
const reasonCounts = new Map<string, number>()
@@ -40,33 +54,30 @@ export function buildReviewerItems(reviewers: EnrichedReviewer[]): ReviewerItem[
for (const reviewer of reviewers) {
const reason = getReviewerExplanation(reviewer)
if (reason) {
- reasonCounts.set(reason, (reasonCounts.get(reason) ?? 0) + 1)
+ const groupKey = reviewerReasonGroupKey(reviewer, reason)
+ reasonCounts.set(groupKey, (reasonCounts.get(groupKey) ?? 0) + 1)
}
}
for (const reviewer of reviewers) {
const reason = getReviewerExplanation(reviewer)
- if (!reason || reasonCounts.get(reason) === 1) {
+ const groupKey = reason ? reviewerReasonGroupKey(reviewer, reason) : null
+ if (!reason || !groupKey || reasonCounts.get(groupKey) === 1) {
items.push({ kind: 'person', key: reviewerKey(reviewer), reviewer })
continue
}
- const sourceLabel = getReviewerSourceLabel(reviewer)
- const existing = reasonGroups.get(reason)
+ const existing = reasonGroups.get(groupKey)
if (existing) {
existing.reviewers.push(reviewer)
- if (!existing.sourceLabels.includes(sourceLabel)) {
- existing.sourceLabels.push(sourceLabel)
- }
} else {
const item: ReviewerReasonGroupItem = {
kind: 'reason-group',
- key: JSON.stringify(['reason-group', reason]),
+ key: groupKey,
reason,
reviewers: [reviewer],
- sourceLabels: [sourceLabel],
}
- reasonGroups.set(reason, item)
+ reasonGroups.set(groupKey, item)
items.push(item)
}
}
@@ -95,7 +106,6 @@ export function SuggestedReviewersList({
key={item.key}
reviewers={item.reviewers}
reason={item.reason}
- sourceLabels={item.sourceLabels}
disabled={disabled}
onRemove={(reviewer) => onRemove([reviewer])}
/>
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewersSection.stories.tsx b/products/signals/frontend/inbox/components/detail/SuggestedReviewersSection.stories.tsx
index 9498d203271d..8001b7b850df 100644
--- a/products/signals/frontend/inbox/components/detail/SuggestedReviewersSection.stories.tsx
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewersSection.stories.tsx
@@ -42,6 +42,7 @@ const sharedReasonSuggestions: EnrichedReviewer[] = [
['devon', 'Devon Clark'],
].map(([id, name]) =>
reviewer(id, name, `${id}@example.com`, {
+ source_skill: 'signals-scout-runtime-ownership',
source_label: 'Runtime ownership scout',
explanation: sharedReason,
reason: sharedReason,
@@ -97,5 +98,72 @@ export const MixedSources: Story = {
export const NarrowPanel: Story = {
parameters: { mockupWidth: 'narrow' },
- args: { suggestions: [...sharedReasonSuggestions, ...codeHistorySuggestions.slice(0, 1)] },
+ args: {
+ suggestions: [
+ reviewer('unlinked', 'Unlinked author', '', {
+ user: null,
+ user_uuid: null,
+ source_label: 'Code history',
+ explanation:
+ 'Changed example.com/services/request-processing/a-very-long-path-without-spaces/or-identifiers.',
+ }),
+ reviewer('solo', 'Solo Scout', '[email protected]', {
+ source_skill: 'signals-scout-infrastructure-reliability',
+ source_label: 'Infrastructure reliability and request processing ownership scout',
+ explanation: 'Maintains the request path.',
+ }),
+ ...sharedReasonSuggestions.slice(0, 2).map((suggestion) => ({
+ ...suggestion,
+ source_label: 'Infrastructure reliability and request processing ownership scout',
+ })),
+ ],
+ },
+}
+
+export const NarrowPanelMixedSources: Story = {
+ parameters: { mockupWidth: 'narrow' },
+ args: {
+ suggestions: sharedReasonSuggestions.slice(0, 3).map((suggestion, index) => ({
+ ...suggestion,
+ source_skill: [
+ 'signals-scout-infrastructure-reliability',
+ 'signals-scout-application-request-lifecycle',
+ 'signals-scout-platform-runtime-observability',
+ ][index],
+ source_label: [
+ 'Infrastructure reliability and request processing ownership scout',
+ 'Application request lifecycle and transport ownership scout',
+ 'Platform runtime observability and incident response scout',
+ ][index],
+ })),
+ },
+}
+
+export const NarrowPanelMixedProvenance: Story = {
+ parameters: { mockupWidth: 'narrow' },
+ args: {
+ suggestions: [
+ ...sharedReasonSuggestions.slice(0, 2),
+ reviewer('maya', 'Maya Rivera', '[email protected]', {
+ relevant_commits: [{ sha: 'abc123f', url: 'https://example.com/c/abc123f', reason: sharedReason }],
+ source_label: 'Code history',
+ explanation: sharedReason,
+ reason: sharedReason,
+ }),
+ ],
+ },
+}
+
+export const NarrowPanelLongReason: Story = {
+ parameters: { mockupWidth: 'narrow' },
+ args: {
+ suggestions: [
+ reviewer('casey', 'Casey Morgan', '[email protected]', {
+ source_skill: 'signals-scout-agent-feedback',
+ source_label: 'Agent feedback scout',
+ explanation:
+ 'Recently maintained the request parser and retry handling. Review the long configuration path before release because it affects several report views.',
+ }),
+ ],
+ },
}
diff --git a/products/signals/frontend/inbox/types.ts b/products/signals/frontend/inbox/types.ts
index 6359a4aac849..021c263c2902 100644
--- a/products/signals/frontend/inbox/types.ts
+++ b/products/signals/frontend/inbox/types.ts
@@ -44,6 +44,7 @@ export interface EnrichedReviewer {
user: SignalReviewerUserInfo | null
/** Why this reviewer was chosen. Absent on artefacts stored before the field existed. */
reason?: string | null
+ source_skill?: string | null
/** User-facing provenance for this suggestion, derived by the backend. */
source_label?: string
/** Short user-facing explanation for this suggestion, derived by the backend. */