Skip to content

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

feat(signals): accept user UUIDs in scout report suggested_reviewers (#66648)

Andrew Maguireeb333ea9e736
diff --git a/products/signals/backend/scout_harness/prompt.py b/products/signals/backend/scout_harness/prompt.py
index 428ab1c81157..b58ea1743550 100644
--- a/products/signals/backend/scout_harness/prompt.py
+++ b/products/signals/backend/scout_harness/prompt.py
@@ -292,6 +292,12 @@ report your evidence bears on, then keep it current:
additive, audit-friendly, and works on any report, even one you didn't author.
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 a bare lowercase
+ `github_login`, or a PostHog `user_uuid` the server resolves for you. This
+ replaces the report's reviewer list and re-runs autostart, so a report that
+ already has a repo + 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` appends a second note. If unsure whether an edit landed, re-read
the report rather than re-sending."""
@@ -321,24 +327,24 @@ Treat it as an **index into the inbox, never a copy of the report**:
_SUGGESTED_REVIEWERS_REPORT = """# Suggested reviewers route the report
This is the single highest-leverage field you set. `suggested_reviewers` (a list of
-GitHub logins) is what actually **routes** a report to the people who can act on it
-— and, paired with `priority` + `repository`, is what lets an immediately-actionable
-report open a draft PR automatically (autostart). A report with no suggested
-reviewers still surfaces in the inbox, but it routes to no one, so it tends to sit
-unactioned.
+reviewers, each a `github_login` and/or a PostHog `user_uuid`) is what actually
+**routes** a report to the people who can act on it — and, paired with `priority` +
+`repository`, is what lets an immediately-actionable report open a draft PR
+automatically (autostart). A report with no suggested reviewers still surfaces in the
+inbox, but it routes to no one, so it tends to sit unactioned.
- **Always try to set `suggested_reviewers`.** Spend real effort identifying who
owns the affected area — lean on the evidence you already gathered (code owners,
recent authors on the relevant surface, the team that owns the product) to name
- the right GitHub logins. Treat "I couldn't find an owner" as a last resort, not
- a default.
-- **Resolve the GitHub login — never guess it.** Entries must be bare, lowercase
- GitHub logins, and the inbox routes by matching them exactly, so a guessed,
- mis-cased, or display-name handle reaches no one. The owner you identify is
- usually a PostHog member, not a handle: call `org-member-get-github-login` with
- their user UUID (from `org-members-list`, or `@me`) to turn that member into
- their linked GitHub login. If you can't resolve a confident login, leave the
- field empty rather than inventing one.
+ the right owner. You can identify each reviewer two ways: a bare lowercase
+ `github_login`, or — when your evidence already names a PostHog user (an account
+ owner, an entity's creator) — that user's `user_uuid`, which the server resolves to
+ their linked GitHub login for you. Treat "I couldn't find an owner" as a last
+ resort, not a default.
+- **Don't guess a `github_login`.** The inbox routes by matching it exactly, so a
+ guessed, mis-cased, or display-name handle reaches no one. When you only know the
+ owner as a PostHog member, pass their `user_uuid` and let the server resolve it
+ rather than inventing a handle.
- **Set `priority` + `priority_explanation`** when the issue is concrete and you
can justify the urgency — autostart needs a priority to consider a draft PR.
- **Set `repository`** (`owner/repo`) when you know where a fix would land — pass
@@ -469,7 +475,8 @@ def _report_tail_sections(*, can_emit: bool, can_edit: bool) -> list[str]:
fail closed on the *exact* tool (`views._assert_report_tool_opted_in`), so the prompt must never
steer a scout toward a tool it lacks — an edit-only scout pointed at `emit_report` just earns a
PermissionDenied. We therefore pick the run-step / authoring guidance to match, and include the
- author-time sections (suggested reviewers, writing a report) only when the scout can author."""
+ standalone author-time sections (the suggested-reviewers deep-dive, writing a report) only when the
+ scout can author — the edit-only persona folds its own (reviewer-setting included) guidance inline."""
if can_emit and can_edit:
how_a_run_works = f"{_HOW_A_RUN_WORKS_HEAD}\n{_REPORT_STEPS_BOTH}\n{_REPORT_CLOSE_OUT_STEP}"
channel_sections = [
diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.py
index f7a8d6202dd5..f9f77f5bc768 100644
--- a/products/signals/backend/scout_harness/serializers.py
+++ b/products/signals/backend/scout_harness/serializers.py
@@ -22,7 +22,7 @@ from products.signals.backend.scout_harness.tools.emit import (
MAX_TAG_LENGTH,
MAX_TAGS_PER_FINDING,
)
-from products.signals.backend.scout_harness.tools.report import MAX_REPORT_TITLE_LENGTH
+from products.signals.backend.scout_harness.tools.report import MAX_REPORT_TITLE_LENGTH, MAX_SUGGESTED_REVIEWERS
from products.signals.backend.scout_harness.tools.scratchpad import MAX_SCRATCHPAD_CONTENT_LENGTH
# --- Run history -----------------------------------------------------------
@@ -556,6 +556,38 @@ 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."""
+
+ github_login = serializers.CharField(
+ required=False,
+ allow_blank=False,
+ max_length=200,
+ help_text=(
+ "GitHub login (case-insensitive, stored lowercased) — e.g. `octocat`, no `@`, no display "
+ "name. Resolve one via `org-member-get-github-login` / git history when you only have a name."
+ ),
+ )
+ user_uuid = serializers.UUIDField(
+ required=False,
+ help_text=(
+ "PostHog user UUID (e.g. from `org-members-list`). 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 accepted by `org-member-get-github-login` is not valid here."
+ ),
+ )
+
+ def validate(self, attrs: dict) -> dict:
+ if not attrs.get("github_login") and not attrs.get("user_uuid"):
+ raise serializers.ValidationError("Each reviewer must include `github_login` or `user_uuid` (or both).")
+ return attrs
+
+
class EmitReportRequestSerializer(serializers.Serializer):
"""Request body for `emit-report`. Run attribution is taken from the URL path."""
@@ -619,10 +651,13 @@ class EmitReportRequestSerializer(serializers.Serializer):
)
suggested_reviewers = serializers.ListField(
required=False,
- child=serializers.CharField(),
+ child=SuggestedReviewerSerializer(),
+ max_length=MAX_SUGGESTED_REVIEWERS,
help_text=(
- "Optional GitHub logins to consider as reviewers for autostart. Autostart only opens a PR if "
- "at least one clears their autonomy threshold; omit to skip the PR path."
+ "Optional reviewers to route the report to (each a `github_login` and/or `user_uuid`). This is "
+ "the primary way a report reaches a human — the inbox floats a reviewer's own reports to the top "
+ "of their inbox even when no PR is involved — so set it whenever you can name a plausible owner. "
+ "It also gates autostart: a PR opens only if at least one reviewer clears their autonomy threshold."
),
)
@@ -676,6 +711,17 @@ class EditReportRequestSerializer(serializers.Serializer):
allow_null=True,
help_text="Optional free-form note to append to the report's work log (attributed to this scout).",
)
+ suggested_reviewers = serializers.ListField(
+ required=False,
+ child=SuggestedReviewerSerializer(),
+ max_length=MAX_SUGGESTED_REVIEWERS,
+ help_text=(
+ "Optional reviewers to set on the report (each a `github_login` and/or `user_uuid`), replacing "
+ "any existing list. Use this to route a report that surfaced with no reviewer — it re-runs "
+ "autostart, so a report that was missing a qualifying reviewer can now open a draft PR. An "
+ "empty list is a no-op (existing reviewers are left untouched, never cleared)."
+ ),
+ )
class EditReportResponseSerializer(serializers.Serializer):
@@ -685,6 +731,7 @@ class EditReportResponseSerializer(serializers.Serializer):
help_text="Which presentation fields changed (e.g. `title`, `summary`); empty if only a note was appended.",
)
note_appended = serializers.BooleanField(help_text="Whether a note artefact was appended.")
+ reviewers_set = serializers.BooleanField(help_text="Whether the report's suggested reviewers were replaced.")
# --- Project profile ------------------------------------------------------
diff --git a/products/signals/backend/scout_harness/tools/report.py b/products/signals/backend/scout_harness/tools/report.py
index 629ace8f9a12..032119ff2fbd 100644
--- a/products/signals/backend/scout_harness/tools/report.py
+++ b/products/signals/backend/scout_harness/tools/report.py
@@ -43,6 +43,7 @@ from products.signals.backend.artefact_schemas import (
SuggestedReviewers,
)
from products.signals.backend.models import ArtefactAttribution, SignalReport, SignalScoutRun
+from products.signals.backend.report_generation.resolve_reviewers import get_org_member_github_logins_by_user_uuid
from products.signals.backend.report_generation.select_repo import RepoSelectionResult
from products.signals.backend.scout_harness.tools.emit import (
SCOUT_SIGNAL_WEIGHT,
@@ -58,6 +59,7 @@ from products.signals.backend.scout_report import (
append_report_note,
create_scout_report,
record_report_edit,
+ set_scout_report_reviewers,
update_scout_report,
)
from products.signals.backend.scout_report.judge import ScoutReportJudgement, judge_scout_report
@@ -88,6 +90,19 @@ class ReportEvidence:
weight: float = SCOUT_SIGNAL_WEIGHT
+@dataclass(frozen=True)
+class ReviewerInput:
+ """One reviewer a scout supplies to `emit_report` / `edit_report` — by `github_login`, `user_uuid`, or both.
+
+ Mirrors the inbox `SuggestedReviewerEntryWriteSerializer`: at least one of the two must be set. A
+ `user_uuid` is resolved server-side to the org member's linked GitHub login (and wins over a
+ supplied `github_login` when both are given), so a scout that only knows a PostHog user — e.g.
+ routing a report to an account owner — can route it without first looking up the handle."""
+
+ github_login: str | None = None
+ user_uuid: str | None = None
+
+
@dataclass(frozen=True)
class EmitReportResult:
"""Outcome of an `emit_report` call.
@@ -110,6 +125,7 @@ class EditReportResult:
report_id: str
updated_fields: list[str]
note_appended: bool
+ reviewers_set: bool = False
def _surfaced(status: SignalReport.Status) -> bool:
@@ -205,20 +221,58 @@ def _build_priority(priority: str | None, explanation: str | None) -> PriorityAs
return PriorityAssessment(priority=priority_level, explanation=explanation)
-def _build_suggested_reviewers(github_logins: list[str] | None) -> SuggestedReviewers | None:
- """Build the `suggested_reviewers` artefact from scout-supplied github logins, or None to omit it.
-
- These are who autostart considers (each must clear their autonomy threshold). The scout supplies
- the logins — exactly how a custom agent supplies assignees — rather than us resolving them from
- repo history. Empty/blank logins are dropped; an all-empty list yields None."""
- if not github_logins:
+def _build_suggested_reviewers(team_id: int, reviewers: list[ReviewerInput] | None) -> SuggestedReviewers | None:
+ """Resolve scout-supplied reviewer entries to a canonical, lowercased, deduped `suggested_reviewers`
+ artefact (GitHub logins), or None to omit it.
+
+ Each 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 (matching the inbox artefact-write endpoint), since a quietly-lost
+ reviewer is what leaves a report routed to no one. Entries are deduped by resolved login; an
+ all-empty list yields None. Does a DB read (UUID resolution), so callers on the async path must
+ bridge it off the event loop."""
+ if not reviewers:
return None
- cleaned = [login.strip() for login in github_logins if login and login.strip()]
- if not cleaned:
+
+ # Cap the input list *before* resolving — otherwise a malformed call with hundreds of uuid entries
+ # would fire one unbounded `IN` query (parameter/timeout risk) just to be rejected afterwards. The
+ # DRF ListField enforces the same bound at the API boundary; this guards the direct callers too.
+ if len(reviewers) > MAX_SUGGESTED_REVIEWERS:
+ raise InvalidScoutReportError(f"at most {MAX_SUGGESTED_REVIEWERS} suggested reviewers, got {len(reviewers)}")
+
+ for entry in reviewers:
+ has_login = bool(entry.github_login and entry.github_login.strip())
+ if not has_login and not entry.user_uuid:
+ 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 {}
+
+ logins: list[str] = []
+ seen: set[str] = set()
+ 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()
+ else:
+ login = (entry.github_login or "").strip().lower()
+ if not login:
+ raise InvalidScoutReportError("github_login resolved to empty after normalization")
+ if login in seen:
+ continue
+ seen.add(login)
+ logins.append(login)
+
+ if not logins:
return None
- if len(cleaned) > MAX_SUGGESTED_REVIEWERS:
- raise InvalidScoutReportError(f"at most {MAX_SUGGESTED_REVIEWERS} suggested reviewers, got {len(cleaned)}")
- return SuggestedReviewers(root=[SuggestedReviewerEntry(github_login=login) for login in cleaned])
+ return SuggestedReviewers(root=[SuggestedReviewerEntry(github_login=login) for login in logins])
def _wants_repo_selection(
@@ -513,19 +567,21 @@ def _capture_report_edited(
title: str | None,
summary: str | None,
note: str | None,
+ suggested_reviewers: list[ReviewerInput] | None = None,
) -> _ReportForward:
"""Emit the scout-owned `signals_scout_report_edited` event when a scout mutates an existing report via
`edit_report`, so edits are observable separately from fresh authorship. `updated_fields` /
- `note_appended` distinguish a title/summary rewrite from a note-only append; `title` / `summary` /
- `note` carry the content the edit applied (each None when that field wasn't touched) — parity with the
- emit event so a consumer sees *what* changed, not just that something did. Best-effort; never fails the
- edit. Accesses `team.organization` — call on a sync thread. Returns the customer-facing fan-out payload
- for the caller to forward."""
+ `note_appended` / `reviewers_set` distinguish a title/summary rewrite from a note-only append from a
+ reviewer (re-routing) change; `title` / `summary` / `note` carry the content the edit applied (each None
+ when that field wasn't touched) — parity with the emit event so a consumer sees *what* changed, not just
+ that something did. Best-effort; never fails the edit. Accesses `team.organization` — call on a sync
+ thread. Returns the customer-facing fan-out payload for the caller to forward."""
properties = {
**_report_event_base(run),
"report_id": result.report_id,
"updated_fields": result.updated_fields,
"note_appended": result.note_appended,
+ "reviewers_set": result.reviewers_set,
"title": _clip(title, MAX_REPORT_TITLE_LENGTH),
"summary": _clip(summary, _MAX_TELEMETRY_SUMMARY_LEN),
"note": _clip(note, _MAX_TELEMETRY_TEXT_LEN),
@@ -545,13 +601,17 @@ def _capture_report_edited(
)
# Sort `updated_fields` so a retried edit that changed the same set hashes to one `event_uuid` — the
# set's iteration order isn't guaranteed stable across worker processes, and an unstable key would
- # double-fire a destination on retry.
+ # double-fire a destination on retry. A reviewer-only edit carries no `updated_fields` and no
+ # title/summary/note, so two distinct reviewer corrections to the same report in one run would
+ # otherwise hash identically and ingestion would collapse the later routing change; key on the
+ # reviewer identity too (only when reviewers were set, so non-reviewer edits keep their existing uuid).
+ parts: list[object] = ["edit", run.id, result.report_id, sorted(result.updated_fields), title, summary, note]
+ if result.reviewers_set and suggested_reviewers:
+ parts.append(",".join(sorted(f"{r.github_login or ''}:{r.user_uuid or ''}" for r in suggested_reviewers)))
return _ReportForward(
event_name=CUSTOMER_REPORT_EDITED_EVENT,
distinct_id=f"signals_scout:{run.skill_name}",
- event_uuid=_report_event_uuid(
- "edit", run.id, result.report_id, sorted(result.updated_fields), title, summary, note
- ),
+ event_uuid=_report_event_uuid(*parts),
properties=properties,
)
@@ -569,7 +629,7 @@ async def emit_report(
repository: str | None = None,
priority: str | None = None,
priority_explanation: str | None = None,
- suggested_reviewers: list[str] | None = None,
+ suggested_reviewers: list[ReviewerInput] | None = None,
) -> EmitReportResult:
"""Author a full report: judge for safety, then persist at the judged status. Async entry (used by
the in-Temporal runner); routes the sync DB work through `database_sync_to_async`.
@@ -587,7 +647,11 @@ async def emit_report(
explanation=actionability_explanation, choice=actionability, already_addressed=already_addressed
)
priority_assessment = _build_priority(priority, priority_explanation)
- reviewers = _build_suggested_reviewers(suggested_reviewers)
+ # Resolves user_uuid → github_login (a DB read), so bridge it off the event loop. Runs before the
+ # safety judge so an unresolvable reviewer fails fast rather than after paying for the LLM call.
+ reviewers = await database_sync_to_async(_build_suggested_reviewers, thread_sensitive=False)(
+ team.id, suggested_reviewers
+ )
preflight = await database_sync_to_async(_preflight_emit_gates, thread_sensitive=False)(team, run)
if preflight is not None:
@@ -669,7 +733,7 @@ def emit_report_sync(
repository: str | None = None,
priority: str | None = None,
priority_explanation: str | None = None,
- suggested_reviewers: list[str] | None = None,
+ suggested_reviewers: list[ReviewerInput] | None = None,
) -> EmitReportResult:
"""Sync entry used by the DRF view path. Mirrors `emit_report` but keeps the sync DB work on the
calling thread/connection (gates, persist) — only the safety-judge LLM call, the free-form repo
@@ -686,7 +750,7 @@ def emit_report_sync(
explanation=actionability_explanation, choice=actionability, already_addressed=already_addressed
)
priority_assessment = _build_priority(priority, priority_explanation)
- reviewers = _build_suggested_reviewers(suggested_reviewers)
+ reviewers = _build_suggested_reviewers(team.id, suggested_reviewers)
preflight = _preflight_emit_gates(team, run)
if preflight is not None:
@@ -765,14 +829,23 @@ def _do_edit_report(
title: str | None,
summary: str | None,
append_note: str | None,
+ suggested_reviewers: list[ReviewerInput] | None,
) -> EditReportResult:
"""Fully-sync edit core (no LLM step). The async/sync entrypoints both funnel here — directly in
- the sync path, via `database_sync_to_async` in the async path."""
+ the sync path, via `database_sync_to_async` in the async path. Reviewer resolution does a DB read
+ and the autostart re-eval bridges an async hand-off via `async_to_sync`, both safe on this sync
+ thread."""
preflight = _preflight_emit_gates(team, run)
if preflight is not None:
raise InvalidScoutReportError(f"edit_report blocked by preflight gate: {preflight}")
attribution = _attribution_for(_resolve_task_id(run))
+ # Resolve reviewers *before* any write. Resolution (user_uuid → login) is the only step that can
+ # reject caller input — an unresolvable user_uuid raises, which the view turns into a 400. Doing it
+ # first means a combined edit (title/summary + a bad reviewer) fails before the content write
+ # commits, rather than leaving the report partially mutated behind a failed call.
+ reviewers = _build_suggested_reviewers(team.id, suggested_reviewers)
+
updated_fields: list[str] = []
if title is not None or summary is not None:
updated_fields = update_scout_report(
@@ -783,28 +856,57 @@ def _do_edit_report(
attribution=attribution,
author=run.skill_name,
)
+ # Replace the report's `suggested_reviewers` status artefact (latest-wins). This is the routing
+ # fix — a report authored without a reviewer (so it routes to no one) can have one added after the
+ # fact. `reviewers` is None for empty/all-blank input, which leaves existing reviewers untouched.
+ reviewers_set = (
+ set_scout_report_reviewers(
+ team_id=team.id,
+ report_id=report_id,
+ suggested_reviewers=reviewers,
+ attribution=attribution,
+ author=run.skill_name,
+ )
+ if reviewers is not None
+ else False
+ )
note_appended = False
if append_note is not None:
append_report_note(
team_id=team.id, report_id=report_id, note=append_note, attribution=attribution, author=run.skill_name
)
note_appended = True
+ # Re-run autostart only when reviewers changed: it's idempotent (a report with an implementation
+ # task already started no-ops), but a report that was missing a qualifying reviewer can now open a
+ # draft PR. Fired outside any txn since it spawns a Task — mirrors emit's post-commit hand-off.
+ if reviewers_set:
+ async_to_sync(_maybe_autostart_report)(team_id=team.id, report_id=report_id)
logger.info(
"signals_scout.edit_report: edited",
- extra={"team_id": team.id, "report_id": report_id, "fields": updated_fields, "note": note_appended},
+ extra={
+ "team_id": team.id,
+ "report_id": report_id,
+ "fields": updated_fields,
+ "note": note_appended,
+ "reviewers_set": reviewers_set,
+ },
+ )
+ result = EditReportResult(
+ report_id=report_id, updated_fields=updated_fields, note_appended=note_appended, reviewers_set=reviewers_set
)
- result = EditReportResult(report_id=report_id, updated_fields=updated_fields, note_appended=note_appended)
# Record the edit on the run tally only when something actually changed — a no-op edit (e.g. a
# title rewrite to its current value) must not claim the run touched the report.
- if updated_fields or note_appended:
+ if updated_fields or note_appended or reviewers_set:
record_report_edit(team_id=team.id, run_id=run.id, report_id=report_id)
return result
-def _validate_edit_inputs(team: Team, run: SignalScoutRun, title, summary, append_note) -> None:
+def _validate_edit_inputs(team: Team, run: SignalScoutRun, title, summary, append_note, suggested_reviewers) -> None:
_assert_team_owns_run(team, run)
- if title is None and summary is None and append_note is None:
- raise InvalidScoutReportError("edit_report needs at least one of title, summary, append_note")
+ if title is None and summary is None and append_note is None and not suggested_reviewers:
+ raise InvalidScoutReportError(
+ "edit_report needs at least one of title, summary, append_note, suggested_reviewers"
+ )
async def edit_report(
@@ -815,15 +917,29 @@ async def edit_report(
title: str | None = None,
summary: str | None = None,
append_note: str | None = None,
+ suggested_reviewers: list[ReviewerInput] | None = None,
) -> EditReportResult:
- """Edit an existing inbox report: rewrite title/summary and/or append a note. Team-scoped
- fail-closed in the service. Async entry; runs the sync edit core in the thread pool."""
- _validate_edit_inputs(team, run, title, summary, append_note)
+ """Edit an existing inbox report: rewrite title/summary, append a note, and/or set suggested
+ reviewers (which re-runs autostart so a report missing a qualifying reviewer can open a draft PR).
+ Team-scoped fail-closed in the service. Async entry; runs the sync edit core in the thread pool."""
+ _validate_edit_inputs(team, run, title, summary, append_note, suggested_reviewers)
result = await database_sync_to_async(_do_edit_report, thread_sensitive=False)(
- team=team, run=run, report_id=report_id, title=title, summary=summary, append_note=append_note
+ team=team,
+ run=run,
+ report_id=report_id,
+ title=title,
+ summary=summary,
+ append_note=append_note,
+ suggested_reviewers=suggested_reviewers,
)
forward = await database_sync_to_async(_capture_report_edited, thread_sensitive=False)(
- team=team, run=run, result=result, title=title, summary=summary, note=append_note
+ team=team,
+ run=run,
+ result=result,
+ title=title,
+ summary=summary,
+ note=append_note,
+ suggested_reviewers=suggested_reviewers,
)
await _forward_report_event_async(team, forward)
return result
@@ -837,12 +953,27 @@ def edit_report_sync(
title: str | None = None,
summary: str | None = None,
append_note: str | None = None,
+ suggested_reviewers: list[ReviewerInput] | None = None,
) -> EditReportResult:
"""Sync entry used by the DRF view path. Same behavior as `edit_report`, on the calling thread."""
- _validate_edit_inputs(team, run, title, summary, append_note)
+ _validate_edit_inputs(team, run, title, summary, append_note, suggested_reviewers)
result = _do_edit_report(
- team=team, run=run, report_id=report_id, title=title, summary=summary, append_note=append_note
+ team=team,
+ run=run,
+ report_id=report_id,
+ title=title,
+ summary=summary,
+ append_note=append_note,
+ suggested_reviewers=suggested_reviewers,
+ )
+ forward = _capture_report_edited(
+ team=team,
+ run=run,
+ result=result,
+ title=title,
+ summary=summary,
+ note=append_note,
+ suggested_reviewers=suggested_reviewers,
)
- forward = _capture_report_edited(team=team, run=run, result=result, title=title, summary=summary, note=append_note)
_forward_report_event_to_team(team=team, forward=forward)
return result
diff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.py
index 65eb2163bb06..fe6acefdf5d4 100644
--- a/products/signals/backend/scout_harness/views.py
+++ b/products/signals/backend/scout_harness/views.py
@@ -95,7 +95,12 @@ from products.signals.backend.scout_harness.team_limits import (
)
from products.signals.backend.scout_harness.tools.emit import EvidenceEntry, InvalidEmitError, emit_finding_sync
from products.signals.backend.scout_harness.tools.profile import get_project_profile
-from products.signals.backend.scout_harness.tools.report import ReportEvidence, edit_report_sync, emit_report_sync
+from products.signals.backend.scout_harness.tools.report import (
+ ReportEvidence,
+ ReviewerInput,
+ edit_report_sync,
+ emit_report_sync,
+)
from products.signals.backend.scout_harness.tools.runs import get_run, search_recent_runs
from products.signals.backend.scout_harness.tools.scratchpad import (
InvalidScratchpadError,
@@ -195,6 +200,21 @@ def _canonical_team_id(view: TeamAndOrgViewSetMixin) -> int:
return view.team.parent_team_id or view.team_id
+def _to_reviewer_inputs(entries: list[dict] | None) -> list[ReviewerInput] | None:
+ """Map validated `suggested_reviewers` entries to `ReviewerInput`s for the report tools. `user_uuid`
+ is a `UUID` (from `UUIDField`) — stringified here so the tool layer has no DRF dependency. Empty/None
+ yields None so the tool treats it as "no reviewers supplied"."""
+ if not entries:
+ return None
+ return [
+ ReviewerInput(
+ github_login=entry.get("github_login"),
+ user_uuid=str(entry["user_uuid"]) if entry.get("user_uuid") else None,
+ )
+ for entry in entries
+ ]
+
+
def _resolve_emission_report_links(
team_id: int, canonical_team: Team, emissions: list[SignalScoutEmission], *, log_context: dict
) -> list[dict]:
@@ -722,7 +742,7 @@ class SignalScoutRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
repository=data.get("repository"),
priority=data.get("priority"),
priority_explanation=data.get("priority_explanation"),
- suggested_reviewers=data.get("suggested_reviewers"),
+ suggested_reviewers=_to_reviewer_inputs(data.get("suggested_reviewers")),
)
except InvalidScoutReportError as exc:
raise exceptions.ValidationError({"detail": str(exc)})
@@ -749,9 +769,11 @@ class SignalScoutRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
},
summary="Edit an existing report for a run",
description=(
- "Rewrite a report's title/summary and/or append a note. Can target ANY of the project's inbox "
- "reports, not just scout-authored ones — so the edit is attributed to this scout. Title/summary "
- "edits are best-effort: the pipeline may later re-research and overwrite them."
+ "Rewrite a report's title/summary, append a note, and/or set its suggested reviewers. Can target "
+ "ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to "
+ "this scout. Setting reviewers is how you rescue a report that surfaced routed to no one: it "
+ "replaces the reviewer list and re-runs autostart, so a report missing a qualifying reviewer can "
+ "open a draft PR. Title/summary edits are best-effort: the pipeline may later re-research them."
),
operation_id="signals_scout_edit_report",
)
@@ -774,6 +796,7 @@ class SignalScoutRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
title=data.get("title"),
summary=data.get("summary"),
append_note=data.get("append_note"),
+ suggested_reviewers=_to_reviewer_inputs(data.get("suggested_reviewers")),
)
except InvalidScoutReportError as exc:
raise exceptions.ValidationError({"detail": str(exc)})
@@ -783,6 +806,7 @@ class SignalScoutRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
"report_id": result.report_id,
"updated_fields": result.updated_fields,
"note_appended": result.note_appended,
+ "reviewers_set": result.reviewers_set,
}
).data,
status=status.HTTP_200_OK,
diff --git a/products/signals/backend/scout_report/__init__.py b/products/signals/backend/scout_report/__init__.py
index 9f4948e95d01..33b80149b0e3 100644
--- a/products/signals/backend/scout_report/__init__.py
+++ b/products/signals/backend/scout_report/__init__.py
@@ -14,6 +14,7 @@ from products.signals.backend.scout_report.persistence import (
append_report_note,
create_scout_report,
record_report_edit,
+ set_scout_report_reviewers,
soft_delete_scout_signal,
update_scout_report,
)
@@ -26,6 +27,7 @@ __all__ = [
"append_report_note",
"create_scout_report",
"record_report_edit",
+ "set_scout_report_reviewers",
"soft_delete_scout_signal",
"update_scout_report",
]
diff --git a/products/signals/backend/scout_report/persistence.py b/products/signals/backend/scout_report/persistence.py
index 8be94b3c26f8..3266fe5ecd9b 100644
--- a/products/signals/backend/scout_report/persistence.py
+++ b/products/signals/backend/scout_report/persistence.py
@@ -303,6 +303,55 @@ def append_report_note(
return report_id
+def set_scout_report_reviewers(
+ *,
+ team_id: int,
+ report_id: str,
+ suggested_reviewers: SuggestedReviewers,
+ attribution: ArtefactAttribution,
+ author: str | None = None,
+) -> bool:
+ """Replace an existing report's `suggested_reviewers` status artefact (latest-wins) — the
+ `edit_report` reviewer path. Returns True when reviewers were written, False when the supplied list
+ is empty (a no-op that leaves any existing reviewers untouched, never silently clears them).
+
+ Team-scoped fail-closed: a `report_id` the team doesn't own raises. `edit_report` can target ANY
+ inbox report (pipeline-authored included), so the change is attributed (to the scout's task) and an
+ audit note is logged, keeping it auditable and distinguishable from pipeline output.
+
+ The append opts out of the model's autostart re-eval hook (`reevaluate_autostart=False`); the caller
+ (`_do_edit_report`) fires `maybe_autostart_from_report_artefacts` after this returns — never in-txn,
+ since it spawns a Task — mirroring `create_scout_report`. Autostart is idempotent, so re-running it
+ for an already-started report no-ops, while a report that lacked a qualifying reviewer can now open a
+ draft PR."""
+ _validate_report_id(report_id)
+ if len(suggested_reviewers.root) == 0:
+ return False
+ logins = [entry.github_login for entry in suggested_reviewers.root]
+ with transaction.atomic():
+ # Existence is the team-scoped gate; the artefact append itself is keyed by report_id.
+ if not SignalReport.objects.filter(team_id=team_id, id=report_id).exists():
+ raise InvalidScoutReportError(f"report {report_id} not found for team {team_id}")
+ SignalReportArtefact.append_status(
+ team_id=team_id,
+ report_id=report_id,
+ content=suggested_reviewers,
+ attribution=attribution,
+ reevaluate_autostart=False,
+ )
+ SignalReportArtefact.add_log(
+ team_id=team_id,
+ report_id=report_id,
+ content=NoteArtefact(note=f"Set suggested reviewers: {', '.join(logins)}", author=author),
+ attribution=attribution,
+ )
+ logger.info(
+ "signals_scout.edit_report: reviewers set",
+ extra={"team_id": team_id, "report_id": report_id, "reviewers": logins},
+ )
+ return True
+
+
def soft_delete_scout_signal(
*,
team_id: int,
diff --git a/products/signals/backend/test/test_scout_harness.py b/products/signals/backend/test/test_scout_harness.py
index aa6cfdf455bd..93373ba44caa 100644
--- a/products/signals/backend/test/test_scout_harness.py
+++ b/products/signals/backend/test/test_scout_harness.py
@@ -217,9 +217,9 @@ class TestPromptBuilder(BaseTest):
assert "inbox-reports-list" in prompt
assert "Suggested reviewers route the report" in prompt
assert "suggested_reviewers" in prompt
- # Reviewer routing only works with a real GitHub login, so the prompt must point the scout
- # at the resolver tool rather than letting it guess a handle.
- assert "org-member-get-github-login" in prompt
+ # Reviewer routing accepts a `user_uuid` (server-resolved to a GitHub login) so the prompt
+ # steers the scout toward that route rather than guessing a handle.
+ assert "user_uuid" in prompt
# The report channel teaches that the `report:` scratchpad entry is a pointer
# into the inbox, not a copy of the report — the inbox stays the source of
# truth, so the scout retrieves the live report before editing. Dropping this
@@ -257,16 +257,16 @@ class TestPromptBuilder(BaseTest):
def test_edit_only_report_scout_never_references_emit_tool(self) -> None:
# The mirror case: an edit_report-only scout must never be told to author via
- # `signals-scout-emit-report`, and the author-time sections (suggested reviewers, writing a
- # report) are dropped since it can't author.
+ # `signals-scout-emit-report`, and the standalone author-time sections (the suggested-reviewers
+ # deep-dive, writing a report) are dropped since it can't author. It still learns it can SET
+ # reviewers via edit (the routing rescue), folded into the editing guidance — not the H1 section.
prompt = self._report_prompt_for(["edit_report"])
assert "signals-scout-edit-report" in prompt
assert "signals-scout-emit-report" not in prompt
assert "Editing existing reports" in prompt
assert "Suggested reviewers route the report" not in prompt
assert "Writing the report" not in prompt
- # The reviewer-resolution guidance rides the author-time section, so it drops with it.
- assert "org-member-get-github-login" not in prompt
+ assert "suggested_reviewers" in prompt
# Orchestration tests run as plain pytest functions because the async runner uses
diff --git a/products/signals/backend/test/test_scout_report_api.py b/products/signals/backend/test/test_scout_report_api.py
index eb5cf160e35d..b35062bb7d01 100644
--- a/products/signals/backend/test/test_scout_report_api.py
+++ b/products/signals/backend/test/test_scout_report_api.py
@@ -1,3 +1,6 @@
+from uuid import uuid4
+
+import pytest
from posthog.test.base import APIBaseTest
from unittest.mock import AsyncMock, patch
@@ -5,10 +8,20 @@ from django.apps import apps
from parameterized import parameterized
from rest_framework import status
+from social_django.models import UserSocialAuth
-from posthog.models import Organization, Team
+from posthog.models import Organization, Team, User
+from posthog.models.organization import OrganizationMembership
from products.signals.backend.models import SignalReport, SignalReportArtefact, SignalSourceConfig
+from products.signals.backend.scout_harness.tools.report import (
+ MAX_SUGGESTED_REVIEWERS,
+ EditReportResult,
+ InvalidScoutReportError,
+ ReviewerInput,
+ _build_suggested_reviewers,
+ _capture_report_edited,
+)
from products.signals.backend.temporal.report_safety_judge import SafetyJudgeResponse
from products.signals.backend.test.test_scout_harness_api import _authenticate_as_scout, _make_run
from products.skills.backend.models.skills import LLMSkill
@@ -196,7 +209,7 @@ class TestScoutReportAPI(APIBaseTest):
repository="PostHog/PostHog",
priority="P1",
priority_explanation="429 users hit this in 2h",
- suggested_reviewers=["octocat", "hubot"],
+ suggested_reviewers=[{"github_login": "octocat"}, {"github_login": "hubot"}],
)
with _safe_judge(), patch(EMBED_PATH), patch(AUTOSTART_PATH, new=AsyncMock()):
response = self.client.post(self._emit_url(str(run.id)), data=payload, format="json")
@@ -218,6 +231,48 @@ class TestScoutReportAPI(APIBaseTest):
assert autostart.await_args is not None
assert autostart.await_args.kwargs["report_id"] == response.json()["report_id"]
+ def test_edit_report_sets_reviewers_and_reruns_autostart(self) -> None:
+ # The routing rescue: a report that surfaced with no reviewer can have one set via edit_report,
+ # which writes the suggested_reviewers artefact and re-fires autostart (so a report that already
+ # has a repo + priority but lacked a qualifying reviewer can now open a draft PR).
+ run = _make_run(self.team)
+ with _safe_judge(), patch(EMBED_PATH), patch(AUTOSTART_PATH, new=AsyncMock()):
+ created = self.client.post(self._emit_url(str(run.id)), data=self._payload(), format="json").json()
+ report_id = created["report_id"]
+ with patch(AUTOSTART_PATH, new=AsyncMock()) as autostart:
+ response = self.client.post(
+ self._edit_url(str(run.id)),
+ data={"report_id": report_id, "suggested_reviewers": [{"github_login": "OctoCat"}]},
+ format="json",
+ )
+ assert response.status_code == status.HTTP_200_OK, response.json()
+ assert response.json()["reviewers_set"] is True
+ reviewers = self._latest_artefact(report_id, SignalReportArtefact.ArtefactType.SUGGESTED_REVIEWERS)
+ assert reviewers is not None and "octocat" in reviewers.content # canonicalized lowercase
+ autostart.assert_awaited_once()
+ run.refresh_from_db()
+ assert run.edited_report_ids == [report_id]
+
+ def test_edit_report_unresolvable_reviewer_does_not_partially_mutate(self) -> None:
+ # A combined edit (title + a bad reviewer) must fail atomically: reviewers resolve before any
+ # write, so an unresolvable user_uuid 400s without the title change leaking through.
+ run = _make_run(self.team)
+ with _safe_judge(), patch(EMBED_PATH):
+ created = self.client.post(self._emit_url(str(run.id)), data=self._payload(), format="json").json()
+ report_id = created["report_id"]
+ original_title = SignalReport.objects.get(id=report_id).title
+ response = self.client.post(
+ self._edit_url(str(run.id)),
+ data={
+ "report_id": report_id,
+ "title": "should not stick",
+ "suggested_reviewers": [{"user_uuid": str(uuid4())}],
+ },
+ format="json",
+ )
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert SignalReport.objects.get(id=report_id).title == original_title
+
def test_emit_report_skips_autostart_and_artefacts_when_suppressed(self) -> None:
# An unsafe report is suppressed — it must not write autostart inputs or try to open a PR.
run = _make_run(self.team)
@@ -311,6 +366,31 @@ class TestScoutReportAPI(APIBaseTest):
assert forward.kwargs["process_person_profile"] is False
assert forward.kwargs["properties"]["report_url"].endswith(f"/inbox/reports/{created['report_id']}")
+ def test_reviewer_edit_event_uuid_keys_on_reviewers(self) -> None:
+ # A reviewer-only edit carries no `updated_fields` and no title/summary/note, so two distinct
+ # reviewer corrections to the same report in one run would hash to one `event_uuid` and ingestion
+ # would collapse the later routing change. The uuid must key on the reviewer identity too — while
+ # an identical retried reviewer edit still stays one event (idempotent).
+ run = _make_run(self.team)
+ result = EditReportResult(report_id=str(uuid4()), updated_fields=[], note_appended=False, reviewers_set=True)
+
+ def forward(reviewers: list[ReviewerInput]) -> str:
+ with patch(CAPTURE_PATH):
+ return _capture_report_edited(
+ team=self.team,
+ run=run,
+ result=result,
+ title=None,
+ summary=None,
+ note=None,
+ suggested_reviewers=reviewers,
+ ).event_uuid
+
+ alice = forward([ReviewerInput(github_login="alice")])
+ bob = forward([ReviewerInput(github_login="bob")])
+ assert alice != bob
+ assert alice == forward([ReviewerInput(github_login="alice")])
+
@parameterized.expand(
[
("scout_emit_disabled",),
@@ -360,3 +440,75 @@ class TestScoutReportAPI(APIBaseTest):
with _safe_judge(), patch(EMBED_PATH), patch(AUTOSTART_PATH, new=AsyncMock()):
response = self.client.post(self._emit_url(str(run.id)), data=self._payload(**overrides), format="json")
assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()
+
+
+class TestBuildSuggestedReviewers(APIBaseTest):
+ """Resolution of scout-supplied reviewer entries (github_login / user_uuid) to canonical logins.
+
+ Tested directly rather than over HTTP — it's the report tools' resolution unit, and the fail-loud
+ guarantee (an unresolvable user_uuid is rejected, never silently dropped) is the whole reason the
+ user_uuid alias is safe to route on."""
+
+ def _github_member(self, login: str) -> User:
+ user = User.objects.create(email=f"{login}@example.com")
+ OrganizationMembership.objects.create(user=user, organization=self.organization)
+ UserSocialAuth.objects.create(user=user, provider="github", uid=f"gh-{login}", extra_data={"login": login})
+ return user
+
+ def test_resolves_github_login_lowercased(self) -> None:
+ result = _build_suggested_reviewers(self.team.id, [ReviewerInput(github_login="OctoCat")])
+ assert result is not None
+ assert [e.github_login for e in result.root] == ["octocat"]
+
+ def test_resolves_user_uuid_to_linked_login(self) -> None:
+ member = self._github_member("ghhandle")
+ result = _build_suggested_reviewers(self.team.id, [ReviewerInput(user_uuid=str(member.uuid))])
+ assert result is not None
+ assert [e.github_login for e in result.root] == ["ghhandle"]
+
+ def test_user_uuid_wins_when_both_supplied(self) -> None:
+ # The serializer documents that a supplied user_uuid wins over a github_login on the same entry.
+ member = self._github_member("realhandle")
+ result = _build_suggested_reviewers(
+ self.team.id, [ReviewerInput(github_login="typo", user_uuid=str(member.uuid))]
+ )
+ assert result is not None
+ assert [e.github_login for e in result.root] == ["realhandle"]
+
+ def test_dedupes_login_and_uuid_resolving_to_same_person(self) -> None:
+ member = self._github_member("dupe")
+ result = _build_suggested_reviewers(
+ self.team.id, [ReviewerInput(github_login="dupe"), ReviewerInput(user_uuid=str(member.uuid))]
+ )
+ 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())
+ with pytest.raises(InvalidScoutReportError):
+ _build_suggested_reviewers(self.team.id, [ReviewerInput(user_uuid=target)])
+
+ @parameterized.expand([("none", None), ("empty", [])])
+ def test_no_entries_yields_none(self, _name: str, reviewers: list | None) -> None:
+ assert _build_suggested_reviewers(self.team.id, reviewers) is None
+
+ def test_entry_with_neither_identifier_raises(self) -> None:
+ # An entry that carries neither a usable login nor a uuid is malformed — fail loud rather than
+ # drop it, since a silently-dropped reviewer is exactly what leaves a report routed to no one.
+ with pytest.raises(InvalidScoutReportError):
+ _build_suggested_reviewers(self.team.id, [ReviewerInput(github_login=" ")])
+
+ def test_caps_entries_before_resolving_uuids(self) -> None:
+ # An over-cap list must be rejected before the UUID resolver runs, so a malformed many-entry
+ # call can't fire one unbounded `IN` query just to be rejected afterwards.
+ resolver = "products.signals.backend.scout_harness.tools.report.get_org_member_github_logins_by_user_uuid"
+ entries = [ReviewerInput(user_uuid=str(uuid4())) for _ in range(MAX_SUGGESTED_REVIEWERS + 1)]
+ with patch(resolver) as resolve_mock, pytest.raises(InvalidScoutReportError):
+ _build_suggested_reviewers(self.team.id, entries)
+ resolve_mock.assert_not_called()
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index 4283d87fbfe8..3b1d069f28b2 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -1198,6 +1198,24 @@ export interface SignalScoutRunDetailApi {
edited_report_ids: string[]
}
+/**
+ * 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.
+ */
+export interface SuggestedReviewerApi {
+ /**
+ * GitHub login (case-insensitive, stored lowercased) — e.g. `octocat`, no `@`, no display name. Resolve one via `org-member-get-github-login` / git history when you only have a name.
+ * @maxLength 200
+ */
+ github_login?: string
+ /** PostHog user UUID (e.g. from `org-members-list`). 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 accepted by `org-member-get-github-login` is not valid here. */
+ user_uuid?: string
+}
+
/**
* Request body for `edit-report`. Can target ANY of the team's inbox reports, not just scout-authored ones.
*/
@@ -1220,6 +1238,11 @@ export interface EditReportRequestApi {
* @nullable
*/
append_note?: string | null
+ /**
+ * Optional reviewers to set on the report (each a `github_login` and/or `user_uuid`), replacing any existing list. Use this to route a report that surfaced with no reviewer — it re-runs autostart, so a report that was missing a qualifying reviewer can now open a draft PR. An empty list is a no-op (existing reviewers are left untouched, never cleared).
+ * @maxItems 10
+ */
+ suggested_reviewers?: SuggestedReviewerApi[]
}
export interface EditReportResponseApi {
@@ -1229,6 +1252,8 @@ export interface EditReportResponseApi {
updated_fields: string[]
/** Whether a note artefact was appended. */
note_appended: boolean
+ /** Whether the report's suggested reviewers were replaced. */
+ reviewers_set: boolean
}
/**
@@ -1394,8 +1419,11 @@ export interface EmitReportRequestApi {
* @nullable
*/
priority_explanation?: string | null
- /** Optional GitHub logins to consider as reviewers for autostart. Autostart only opens a PR if at least one clears their autonomy threshold; omit to skip the PR path. */
- suggested_reviewers?: string[]
+ /**
+ * Optional reviewers to route the report to (each a `github_login` and/or `user_uuid`). This is the primary way a report reaches a human — the inbox floats a reviewer's own reports to the top of their inbox even when no PR is involved — so set it whenever you can name a plausible owner. It also gates autostart: a PR opens only if at least one reviewer clears their autonomy threshold.
+ * @maxItems 10
+ */
+ suggested_reviewers?: SuggestedReviewerApi[]
}
export interface EmitReportResponseApi {
diff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.ts
index 4be281c9a451..615c737ea61f 100644
--- a/products/signals/frontend/generated/api.ts
+++ b/products/signals/frontend/generated/api.ts
@@ -597,7 +597,7 @@ export const getSignalsScoutEditReportUrl = (projectId: string, runId: string) =
}
/**
- * Rewrite a report's title/summary and/or append a note. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Title/summary edits are best-effort: the pipeline may later re-research and overwrite them.
+ * Rewrite a report's title/summary, append a note, and/or set its suggested reviewers. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Setting reviewers is how you rescue a report that surfaced routed to no one: it replaces the reviewer list and re-runs autostart, so a report missing a qualifying reviewer can open a draft PR. Title/summary edits are best-effort: the pipeline may later re-research them.
* @summary Edit an existing report for a run
*/
export const signalsScoutEditReport = async (
diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.ts
index e78431527044..004ae0625058 100644
--- a/products/signals/frontend/generated/api.zod.ts
+++ b/products/signals/frontend/generated/api.zod.ts
@@ -269,11 +269,15 @@ export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zod
)
/**
- * Rewrite a report's title/summary and/or append a note. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Title/summary edits are best-effort: the pipeline may later re-research and overwrite them.
+ * Rewrite a report's title/summary, append a note, and/or set its suggested reviewers. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Setting reviewers is how you rescue a report that surfaced routed to no one: it replaces the reviewer list and re-runs autostart, so a report missing a qualifying reviewer can open a draft PR. Title/summary edits are best-effort: the pipeline may later re-research them.
* @summary Edit an existing report for a run
*/
export const signalsScoutEditReportBodyTitleMax = 300
+export const signalsScoutEditReportBodySuggestedReviewersItemGithubLoginMax = 200
+
+export const signalsScoutEditReportBodySuggestedReviewersMax = 10
+
export const SignalsScoutEditReportBody = /* @__PURE__ */ zod
.object({
report_id: zod.string().describe('Id of the report to edit (must belong to this project).'),
@@ -294,6 +298,33 @@ export const SignalsScoutEditReportBody = /* @__PURE__ */ zod
.string()
.nullish()
.describe("Optional free-form note to append to the report's work log (attributed to this scout)."),
+ suggested_reviewers: zod
+ .array(
+ zod
+ .object({
+ github_login: zod
+ .string()
+ .max(signalsScoutEditReportBodySuggestedReviewersItemGithubLoginMax)
+ .optional()
+ .describe(
+ 'GitHub login (case-insensitive, stored lowercased) — e.g. `octocat`, no `@`, no display name. Resolve one via `org-member-get-github-login` \/ git history when you only have a name.'
+ ),
+ user_uuid: zod
+ .uuid()
+ .optional()
+ .describe(
+ "PostHog user UUID (e.g. from `org-members-list`). 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 accepted by `org-member-get-github-login` is not valid here."
+ ),
+ })
+ .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."
+ )
+ )
+ .max(signalsScoutEditReportBodySuggestedReviewersMax)
+ .optional()
+ .describe(
+ 'Optional reviewers to set on the report (each a `github_login` and\/or `user_uuid`), replacing any existing list. Use this to route a report that surfaced with no reviewer — it re-runs autostart, so a report that was missing a qualifying reviewer can now open a draft PR. An empty list is a no-op (existing reviewers are left untouched, never cleared).'
+ ),
})
.describe(
"Request body for `edit-report`. Can target ANY of the team's inbox reports, not just scout-authored ones."
@@ -308,6 +339,9 @@ export const signalsScoutEmitReportBodyTitleMax = 300
export const signalsScoutEmitReportBodyEvidenceItemWeightMin = 0
export const signalsScoutEmitReportBodyAlreadyAddressedDefault = false
+export const signalsScoutEmitReportBodySuggestedReviewersItemGithubLoginMax = 200
+
+export const signalsScoutEmitReportBodySuggestedReviewersMax = 10
export const SignalsScoutEmitReportBody = /* @__PURE__ */ zod
.object({
@@ -383,10 +417,31 @@ export const SignalsScoutEmitReportBody = /* @__PURE__ */ zod
.nullish()
.describe('2-3 sentence justification for `priority`. Required when `priority` is set.'),
suggested_reviewers: zod
- .array(zod.string())
+ .array(
+ zod
+ .object({
+ github_login: zod
+ .string()
+ .max(signalsScoutEmitReportBodySuggestedReviewersItemGithubLoginMax)
+ .optional()
+ .describe(
+ 'GitHub login (case-insensitive, stored lowercased) — e.g. `octocat`, no `@`, no display name. Resolve one via `org-member-get-github-login` \/ git history when you only have a name.'
+ ),
+ user_uuid: zod
+ .uuid()
+ .optional()
+ .describe(
+ "PostHog user UUID (e.g. from `org-members-list`). 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 accepted by `org-member-get-github-login` is not valid here."
+ ),
+ })
+ .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."
+ )
+ )
+ .max(signalsScoutEmitReportBodySuggestedReviewersMax)
.optional()
.describe(
- 'Optional GitHub logins to consider as reviewers for autostart. Autostart only opens a PR if at least one clears their autonomy threshold; omit to skip the PR path.'
+ "Optional reviewers to route the report to (each a `github_login` and\/or `user_uuid`). This is the primary way a report reaches a human — the inbox floats a reviewer's own reports to the top of their inbox even when no PR is involved — so set it whenever you can name a plausible owner. It also gates autostart: a PR opens only if at least one reviewer clears their autonomy threshold."
),
})
.describe('Request body for `emit-report`. Run attribution is taken from the URL path.')
diff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yaml
index 1ded0b1424ac..f427f5b3f16b 100644
--- a/products/signals/mcp/tools.yaml
+++ b/products/signals/mcp/tools.yaml
@@ -419,12 +419,15 @@ tools:
idempotent: false
title: Edit an existing report for a run
description: >
- The report channel's edit half: rewrite a report's `title`/`summary` and/or append a note. Can target ANY of
- the project's inbox reports, not just scout-authored ones — the edit is attributed to this scout. Prefer
- `append_note` over rewriting a report you didn't author (additive and audit-friendly); title/summary edits
- are best-effort, since the pipeline may later re-research and overwrite them. NOT idempotent — a retried
- `append_note` appends a second note. Opt-in: only available to scouts that list `edit_report` in their
- skill's `allowed_tools`.
+ The report channel's edit half: rewrite a report's `title`/`summary`, append a note, and/or set its
+ `suggested_reviewers`. Can target ANY of the project's inbox reports, not just scout-authored ones — the
+ edit is attributed to this scout. Setting reviewers is how you rescue a report that surfaced routed to no
+ one: it replaces the reviewer list and re-runs autostart, so a report missing a qualifying reviewer can open
+ a draft PR. Each reviewer is a `github_login` and/or a PostHog `user_uuid` (resolved server-side to the
+ linked GitHub login). Prefer `append_note` over rewriting a report you didn't author (additive and
+ audit-friendly); title/summary edits are best-effort, since the pipeline may later re-research and overwrite
+ them. NOT idempotent — a retried `append_note` appends a second note. Opt-in: only available to scouts that
+ list `edit_report` in their skill's `allowed_tools`.
signals-scout-emit-report:
operation: signals_scout_emit_report
enabled: true
@@ -442,10 +445,11 @@ tools:
(`immediately_actionable` → READY, `requires_human_input` → PENDING_INPUT, `not_actionable` → suppressed);
an unsafe report is suppressed regardless. Backing `evidence` is written as bound signals so the report
behaves like a pipeline report. NOT idempotent — a retry authors a second report; use `inbox-reports-list`
- to find a prior report and `signals-scout-edit-report` to update it instead. For a concrete, fixable issue
- you can also open a draft PR automatically by passing `repository` + `priority` + `suggested_reviewers`
- (autostart, custom_agent parity); omit them to just surface the report. Opt-in: only available to scouts
- that list `emit_report` in their skill's `allowed_tools`.
+ to find a prior report and `signals-scout-edit-report` to update it instead. `suggested_reviewers` is the
+ primary way a report reaches a human (each a `github_login` and/or a PostHog `user_uuid` resolved
+ server-side); for a concrete, fixable issue, passing `repository` + `priority` + `suggested_reviewers` also
+ opens a draft PR automatically (autostart, custom_agent parity); omit them to just surface the report.
+ Opt-in: only available to scouts that list `emit_report` in their skill's `allowed_tools`.
signals-scout-emit-signal:
operation: signals_scout_emit_signal
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 2d334810792e..2efb375e70d7 100644
--- a/products/signals/skills/authoring-scouts/references/report-contract.md
+++ b/products/signals/skills/authoring-scouts/references/report-contract.md
@@ -81,7 +81,7 @@ when the report is a concrete, fixable issue you'd want a PR for:
| `repository` | string | `"owner/repo"` targets that repo; the `NO_REPO` sentinel opts out; **omitting it** falls back to free-form selection across the team's repos — the slow path on a many-repo team (it spawns a selection sandbox), so pass `owner/repo` when you know it. |
| `priority` | `P0`-`P4` | Required for a PR. Pair with `priority_explanation`. |
| `priority_explanation` | string | Required when `priority` is set. |
-| `suggested_reviewers` | list of str | GitHub logins to consider. A PR opens only if at least one clears their autonomy threshold. |
+| `suggested_reviewers` | list of obj | Reviewers to consider, each `{github_login?, user_uuid?}` (at least one per entry; see the section below). A PR opens only if at least one clears their autonomy threshold. |
Repo selection only runs when you signal PR intent — an explicit `repository`, or both `priority`
and `suggested_reviewers`. A report that supplies none of these just surfaces in the inbox (no repo
@@ -98,12 +98,21 @@ human even when **no PR** is involved. **Set it whenever you can name a plausibl
including on informational `requires_human_input` reports**, not only PR-bound ones. A report
with no reviewer just sits in the shared inbox hoping someone grabs it.
-Each entry must be a **bare, lowercase GitHub login** — no `@`, no display name (e.g. `octocat`,
-not `@OctoCat`). Internal assignment matches the login 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). You rarely know the login outright —
-resolve it, cheapest source first:
+Each entry identifies one reviewer by **`github_login`**, **`user_uuid`**, or both:
+
+- **`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.
+
+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. Otherwise resolve a `github_login`, cheapest source first:
1. **Scratchpad cache.** A `reviewer:<domain>:<area>` entry you (or a sibling run) recorded
before — reuse it. Fastest path, and the reason the caching step at the end of this list exists.
@@ -116,16 +125,18 @@ resolve it, cheapest source first:
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. **`org-member-get-github-login`** — the canonical login resolver, available to every scout run
- (it needs only `organization_member:read`, which scout tokens carry). Once you've identified the
- owning **person** — by name/email via `org-members-list`, or `@me` for the current user — pass
- their PostHog user UUID to this tool to get their linked GitHub login (it returns null when the
- member has no GitHub identity linked). This is the one step that actually hands you a usable
- handle, so prefer it over guessing when steps 1–3 only give you a person rather than a login.
-
-**If you can't resolve a confident login, leave `suggested_reviewers` empty** — the report still
-surfaces for a human to grab. **Never guess a handle**: a wrong login mis-assigns the report (or
-silently fails to assign), which is worse than leaving it open.
+4. **`org-members-list` + `org-member-get-github-login`** — only where the run has organization scope
+ (`organization_member:read`), which **headless scout runs scoped to a single team often don't
+ have**, so these tools are typically **absent from a scout's toolset**; don't build a scout's
+ reviewer recipe around them. Where they _are_ available: `org-members-list` gives a member's
+ `user_uuid` (pass that straight through as `user_uuid` — simplest), and `org-member-get-github-login`
+ resolves a `user_uuid` to its GitHub login if you'd rather hand a `github_login`.
+
+**If you can't confidently identify a reviewer, leave `suggested_reviewers` empty** — the report
+still surfaces for a human to grab. **Never guess a handle**: a wrong login mis-assigns the report
+(or silently fails to assign), which is worse than leaving it open. And remember `edit_report` can set
+reviewers on a report later — so a report that surfaced routed to no one isn't stuck; once you resolve
+an owner, edit it in (which also re-runs autostart).
**Cache for next time.** After you confidently tie an area to an owner, write a
`reviewer:<domain>:<area>` scratchpad entry with the bare lowercase login so the next run — and
@@ -133,12 +144,13 @@ sibling scouts — route faster. The fleet's reviewer map should compound over t
## `edit_report` — update an existing report
-Rewrite `title`/`summary` and/or append a note to a report that already exists. Pass `run_id`
-(the current run) and `report_id`, plus at least one of `title`, `summary`, `append_note`.
+Rewrite `title`/`summary`, append a note, and/or set `suggested_reviewers` on a report that already
+exists. Pass `run_id` (the current run) and `report_id`, plus at least one of `title`, `summary`,
+`append_note`, `suggested_reviewers`.
`edit_report` can target **any** of the team's inbox reports — not just ones a scout authored.
That makes it the right tool when a later run learns something about a report the pipeline (or
-another scout) created. Two rules of good behavior:
+another scout) created. Rules of good behavior:
- **Prefer `append_note` over rewriting** `title`/`summary` on a report you didn't author. A
note is additive and audit-friendly (it carries your scout as the author); a rewrite
@@ -146,6 +158,11 @@ another scout) created. Two rules of good behavior:
- **Don't fight an in-flight pipeline.** A report the summary/research workflow is mid-run on
can have its fields overwritten under you. If a report is actively being worked, append a
note rather than rewriting.
+- **Use `suggested_reviewers` to rescue an unrouted report.** Setting reviewers (same
+ `{github_login?, user_uuid?}` shape as `emit_report`) replaces the report's reviewer list and
+ re-runs autostart — so a report that surfaced routed to no one can be assigned to an owner you
+ resolved later, and a now-actionable report with a repo + priority can open a draft PR. An empty
+ list is a no-op (it never clears existing reviewers).
## Finding "the report I made last time"
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index fb2c09d4d0c8..ebe2c26b2a9c 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -6613,7 +6613,7 @@
}
},
"signals-scout-edit-report": {
- "description": "The report channel's edit half: rewrite a report's `title`/`summary` and/or append a note. Can target ANY of the project's inbox reports, not just scout-authored ones — the edit is attributed to this scout. Prefer `append_note` over rewriting a report you didn't author (additive and audit-friendly); title/summary edits are best-effort, since the pipeline may later re-research and overwrite them. NOT idempotent — a retried `append_note` appends a second note. Opt-in: only available to scouts that list `edit_report` in their skill's `allowed_tools`.",
+ "description": "The report channel's edit half: rewrite a report's `title`/`summary`, append a note, and/or set its `suggested_reviewers`. Can target ANY of the project's inbox reports, not just scout-authored ones — the edit is attributed to this scout. Setting reviewers is how you rescue a report that surfaced routed to no one: it replaces the reviewer list and re-runs autostart, so a report missing a qualifying reviewer can open a draft PR. Each reviewer is a `github_login` and/or a PostHog `user_uuid` (resolved server-side to the linked GitHub login). Prefer `append_note` over rewriting a report you didn't author (additive and audit-friendly); title/summary edits are best-effort, since the pipeline may later re-research and overwrite them. NOT idempotent — a retried `append_note` appends a second note. Opt-in: only available to scouts that list `edit_report` in their skill's `allowed_tools`.",
"category": "Signals",
"feature": "signals",
"summary": "Edit an existing report for a run",
@@ -6627,7 +6627,7 @@
}
},
"signals-scout-emit-report": {
- "description": "The report channel: author a complete `SignalReport` directly instead of emitting a weak signal, when you've already done the research and want 1:1 control over the report rather than letting the pipeline cluster it. The report passes the safety judge, then surfaces at the status your `actionability` call implies (`immediately_actionable` → READY, `requires_human_input` → PENDING_INPUT, `not_actionable` → suppressed); an unsafe report is suppressed regardless. Backing `evidence` is written as bound signals so the report behaves like a pipeline report. NOT idempotent — a retry authors a second report; use `inbox-reports-list` to find a prior report and `signals-scout-edit-report` to update it instead. For a concrete, fixable issue you can also open a draft PR automatically by passing `repository` + `priority` + `suggested_reviewers` (autostart, custom_agent parity); omit them to just surface the report. Opt-in: only available to scouts that list `emit_report` in their skill's `allowed_tools`.",
+ "description": "The report channel: author a complete `SignalReport` directly instead of emitting a weak signal, when you've already done the research and want 1:1 control over the report rather than letting the pipeline cluster it. The report passes the safety judge, then surfaces at the status your `actionability` call implies (`immediately_actionable` → READY, `requires_human_input` → PENDING_INPUT, `not_actionable` → suppressed); an unsafe report is suppressed regardless. Backing `evidence` is written as bound signals so the report behaves like a pipeline report. NOT idempotent — a retry authors a second report; use `inbox-reports-list` to find a prior report and `signals-scout-edit-report` to update it instead. `suggested_reviewers` is the primary way a report reaches a human (each a `github_login` and/or a PostHog `user_uuid` resolved server-side); for a concrete, fixable issue, passing `repository` + `priority` + `suggested_reviewers` also opens a draft PR automatically (autostart, custom_agent parity); omit them to just surface the report. Opt-in: only available to scouts that list `emit_report` in their skill's `allowed_tools`.",
"category": "Signals",
"feature": "signals",
"summary": "Author a full report for a run",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index afad6fb4c914..3bad6b47ba9e 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -7124,7 +7124,7 @@
}
},
"signals-scout-edit-report": {
- "description": "The report channel's edit half: rewrite a report's `title`/`summary` and/or append a note. Can target ANY of the project's inbox reports, not just scout-authored ones — the edit is attributed to this scout. Prefer `append_note` over rewriting a report you didn't author (additive and audit-friendly); title/summary edits are best-effort, since the pipeline may later re-research and overwrite them. NOT idempotent — a retried `append_note` appends a second note. Opt-in: only available to scouts that list `edit_report` in their skill's `allowed_tools`.",
+ "description": "The report channel's edit half: rewrite a report's `title`/`summary`, append a note, and/or set its `suggested_reviewers`. Can target ANY of the project's inbox reports, not just scout-authored ones — the edit is attributed to this scout. Setting reviewers is how you rescue a report that surfaced routed to no one: it replaces the reviewer list and re-runs autostart, so a report missing a qualifying reviewer can open a draft PR. Each reviewer is a `github_login` and/or a PostHog `user_uuid` (resolved server-side to the linked GitHub login). Prefer `append_note` over rewriting a report you didn't author (additive and audit-friendly); title/summary edits are best-effort, since the pipeline may later re-research and overwrite them. NOT idempotent — a retried `append_note` appends a second note. Opt-in: only available to scouts that list `edit_report` in their skill's `allowed_tools`.",
"category": "Signals",
"feature": "signals",
"summary": "Edit an existing report for a run",
@@ -7138,7 +7138,7 @@
}
},
"signals-scout-emit-report": {
- "description": "The report channel: author a complete `SignalReport` directly instead of emitting a weak signal, when you've already done the research and want 1:1 control over the report rather than letting the pipeline cluster it. The report passes the safety judge, then surfaces at the status your `actionability` call implies (`immediately_actionable` → READY, `requires_human_input` → PENDING_INPUT, `not_actionable` → suppressed); an unsafe report is suppressed regardless. Backing `evidence` is written as bound signals so the report behaves like a pipeline report. NOT idempotent — a retry authors a second report; use `inbox-reports-list` to find a prior report and `signals-scout-edit-report` to update it instead. For a concrete, fixable issue you can also open a draft PR automatically by passing `repository` + `priority` + `suggested_reviewers` (autostart, custom_agent parity); omit them to just surface the report. Opt-in: only available to scouts that list `emit_report` in their skill's `allowed_tools`.",
+ "description": "The report channel: author a complete `SignalReport` directly instead of emitting a weak signal, when you've already done the research and want 1:1 control over the report rather than letting the pipeline cluster it. The report passes the safety judge, then surfaces at the status your `actionability` call implies (`immediately_actionable` → READY, `requires_human_input` → PENDING_INPUT, `not_actionable` → suppressed); an unsafe report is suppressed regardless. Backing `evidence` is written as bound signals so the report behaves like a pipeline report. NOT idempotent — a retry authors a second report; use `inbox-reports-list` to find a prior report and `signals-scout-edit-report` to update it instead. `suggested_reviewers` is the primary way a report reaches a human (each a `github_login` and/or a PostHog `user_uuid` resolved server-side); for a concrete, fixable issue, passing `repository` + `priority` + `suggested_reviewers` also opens a draft PR automatically (autostart, custom_agent parity); omit them to just surface the report. Opt-in: only available to scouts that list `emit_report` in their skill's `allowed_tools`.",
"category": "Signals",
"feature": "signals",
"summary": "Author a full report for a run",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 69317caedc9d..d015c0456176 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -17859,6 +17859,24 @@ export namespace Schemas {
readonly updated_at: string | null;
}
+ /**
+ * 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.
+ */
+ export interface SuggestedReviewer {
+ /**
+ * GitHub login (case-insensitive, stored lowercased) — e.g. `octocat`, no `@`, no display name. Resolve one via `org-member-get-github-login` / git history when you only have a name.
+ * @maxLength 200
+ */
+ github_login?: string;
+ /** PostHog user UUID (e.g. from `org-members-list`). 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 accepted by `org-member-get-github-login` is not valid here. */
+ user_uuid?: string;
+ }
+
/**
* Request body for `edit-report`. Can target ANY of the team's inbox reports, not just scout-authored ones.
*/
@@ -17881,6 +17899,11 @@ export namespace Schemas {
* @nullable
*/
append_note?: string | null;
+ /**
+ * Optional reviewers to set on the report (each a `github_login` and/or `user_uuid`), replacing any existing list. Use this to route a report that surfaced with no reviewer — it re-runs autostart, so a report that was missing a qualifying reviewer can now open a draft PR. An empty list is a no-op (existing reviewers are left untouched, never cleared).
+ * @maxItems 10
+ */
+ suggested_reviewers?: SuggestedReviewer[];
}
export interface EditReportResponse {
@@ -17890,6 +17913,8 @@ export namespace Schemas {
updated_fields: string[];
/** Whether a note artefact was appended. */
note_appended: boolean;
+ /** Whether the report's suggested reviewers were replaced. */
+ reviewers_set: boolean;
}
export type EffectiveMembershipLevelEnum = typeof EffectiveMembershipLevelEnum[keyof typeof EffectiveMembershipLevelEnum];
@@ -18169,8 +18194,11 @@ export namespace Schemas {
* @nullable
*/
priority_explanation?: string | null;
- /** Optional GitHub logins to consider as reviewers for autostart. Autostart only opens a PR if at least one clears their autonomy threshold; omit to skip the PR path. */
- suggested_reviewers?: string[];
+ /**
+ * Optional reviewers to route the report to (each a `github_login` and/or `user_uuid`). This is the primary way a report reaches a human — the inbox floats a reviewer's own reports to the top of their inbox even when no PR is involved — so set it whenever you can name a plausible owner. It also gates autostart: a PR opens only if at least one reviewer clears their autonomy threshold.
+ * @maxItems 10
+ */
+ suggested_reviewers?: SuggestedReviewer[];
}
export interface EmitReportResponse {
diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.ts
index a9ae6b0d6278..5f9044dbfab5 100644
--- a/services/mcp/src/generated/signals/api.ts
+++ b/services/mcp/src/generated/signals/api.ts
@@ -555,7 +555,7 @@ export const SignalsScoutRunsRetrieveParams = /* @__PURE__ */ zod.object({
})
/**
- * Rewrite a report's title/summary and/or append a note. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Title/summary edits are best-effort: the pipeline may later re-research and overwrite them.
+ * Rewrite a report's title/summary, append a note, and/or set its suggested reviewers. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Setting reviewers is how you rescue a report that surfaced routed to no one: it replaces the reviewer list and re-runs autostart, so a report missing a qualifying reviewer can open a draft PR. Title/summary edits are best-effort: the pipeline may later re-research them.
* @summary Edit an existing report for a run
*/
export const SignalsScoutEditReportParams = /* @__PURE__ */ zod.object({
@@ -569,6 +569,10 @@ export const SignalsScoutEditReportParams = /* @__PURE__ */ zod.object({
export const signalsScoutEditReportBodyTitleMax = 300
+export const signalsScoutEditReportBodySuggestedReviewersItemGithubLoginMax = 200
+
+export const signalsScoutEditReportBodySuggestedReviewersMax = 10
+
export const SignalsScoutEditReportBody = /* @__PURE__ */ zod
.object({
report_id: zod.string().describe('Id of the report to edit (must belong to this project).'),
@@ -589,6 +593,33 @@ export const SignalsScoutEditReportBody = /* @__PURE__ */ zod
.string()
.nullish()
.describe("Optional free-form note to append to the report's work log (attributed to this scout)."),
+ suggested_reviewers: zod
+ .array(
+ zod
+ .object({
+ github_login: zod
+ .string()
+ .max(signalsScoutEditReportBodySuggestedReviewersItemGithubLoginMax)
+ .optional()
+ .describe(
+ 'GitHub login (case-insensitive, stored lowercased) — e.g. `octocat`, no `@`, no display name. Resolve one via `org-member-get-github-login` / git history when you only have a name.'
+ ),
+ user_uuid: zod
+ .string()
+ .optional()
+ .describe(
+ "PostHog user UUID (e.g. from `org-members-list`). 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 accepted by `org-member-get-github-login` is not valid here."
+ ),
+ })
+ .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."
+ )
+ )
+ .max(signalsScoutEditReportBodySuggestedReviewersMax)
+ .optional()
+ .describe(
+ 'Optional reviewers to set on the report (each a `github_login` and/or `user_uuid`), replacing any existing list. Use this to route a report that surfaced with no reviewer — it re-runs autostart, so a report that was missing a qualifying reviewer can now open a draft PR. An empty list is a no-op (existing reviewers are left untouched, never cleared).'
+ ),
})
.describe(
"Request body for `edit-report`. Can target ANY of the team's inbox reports, not just scout-authored ones."
@@ -638,6 +669,9 @@ export const signalsScoutEmitReportBodyTitleMax = 300
export const signalsScoutEmitReportBodyEvidenceItemWeightMin = 0
export const signalsScoutEmitReportBodyAlreadyAddressedDefault = false
+export const signalsScoutEmitReportBodySuggestedReviewersItemGithubLoginMax = 200
+
+export const signalsScoutEmitReportBodySuggestedReviewersMax = 10
export const SignalsScoutEmitReportBody = /* @__PURE__ */ zod
.object({
@@ -713,10 +747,31 @@ export const SignalsScoutEmitReportBody = /* @__PURE__ */ zod
.nullish()
.describe('2-3 sentence justification for `priority`. Required when `priority` is set.'),
suggested_reviewers: zod
- .array(zod.string())
+ .array(
+ zod
+ .object({
+ github_login: zod
+ .string()
+ .max(signalsScoutEmitReportBodySuggestedReviewersItemGithubLoginMax)
+ .optional()
+ .describe(
+ 'GitHub login (case-insensitive, stored lowercased) — e.g. `octocat`, no `@`, no display name. Resolve one via `org-member-get-github-login` / git history when you only have a name.'
+ ),
+ user_uuid: zod
+ .string()
+ .optional()
+ .describe(
+ "PostHog user UUID (e.g. from `org-members-list`). 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 accepted by `org-member-get-github-login` is not valid here."
+ ),
+ })
+ .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."
+ )
+ )
+ .max(signalsScoutEmitReportBodySuggestedReviewersMax)
.optional()
.describe(
- 'Optional GitHub logins to consider as reviewers for autostart. Autostart only opens a PR if at least one clears their autonomy threshold; omit to skip the PR path.'
+ "Optional reviewers to route the report to (each a `github_login` and/or `user_uuid`). This is the primary way a report reaches a human — the inbox floats a reviewer's own reports to the top of their inbox even when no PR is involved — so set it whenever you can name a plausible owner. It also gates autostart: a PR opens only if at least one reviewer clears their autonomy threshold."
),
})
.describe('Request body for `emit-report`. Run attribution is taken from the URL path.')
diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.ts
index 2f1f953bddfe..ef988f12745d 100644
--- a/services/mcp/src/tools/generated/signals.ts
+++ b/services/mcp/src/tools/generated/signals.ts
@@ -608,6 +608,9 @@ const signalsScoutEditReport = (): ToolBase<typeof SignalsScoutEditReportSchema,
if (params.append_note !== undefined) {
body['append_note'] = params.append_note
}
+ if (params.suggested_reviewers !== undefined) {
+ body['suggested_reviewers'] = params.suggested_reviewers
+ }
const result = await context.api.request<Schemas.EditReportResponse>({
method: 'POST',
path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/runs/${encodeURIComponent(String(params.run_id))}/edit-report/`,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-edit-report.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-edit-report.json
index 00e4d50abe31..a158f95a73fc 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-edit-report.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-edit-report.json
@@ -20,6 +20,26 @@
"description": "UUID of the `SignalScoutRun` bridge row.",
"type": "string"
},
+ "suggested_reviewers": {
+ "description": "Optional reviewers to set on the report (each a `github_login` and/or `user_uuid`), replacing any existing list. Use this to route a report that surfaced with no reviewer — it re-runs autostart, so a report that was missing a qualifying reviewer can now open a draft PR. An empty list is a no-op (existing reviewers are left untouched, never cleared).",
+ "items": {
+ "description": "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.",
+ "properties": {
+ "github_login": {
+ "description": "GitHub login (case-insensitive, stored lowercased) — e.g. `octocat`, no `@`, no display name. Resolve one via `org-member-get-github-login` / git history when you only have a name.",
+ "maxLength": 200,
+ "type": "string"
+ },
+ "user_uuid": {
+ "description": "PostHog user UUID (e.g. from `org-members-list`). 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 accepted by `org-member-get-github-login` is not valid here.",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "maxItems": 10,
+ "type": "array"
+ },
"summary": {
"anyOf": [
{
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-emit-report.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-emit-report.json
index c05520715d18..43cf91f6f84f 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-emit-report.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-emit-report.json
@@ -80,10 +80,23 @@
"type": "string"
},
"suggested_reviewers": {
- "description": "Optional GitHub logins to consider as reviewers for autostart. Autostart only opens a PR if at least one clears their autonomy threshold; omit to skip the PR path.",
+ "description": "Optional reviewers to route the report to (each a `github_login` and/or `user_uuid`). This is the primary way a report reaches a human — the inbox floats a reviewer's own reports to the top of their inbox even when no PR is involved — so set it whenever you can name a plausible owner. It also gates autostart: a PR opens only if at least one reviewer clears their autonomy threshold.",
"items": {
- "type": "string"
+ "description": "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.",
+ "properties": {
+ "github_login": {
+ "description": "GitHub login (case-insensitive, stored lowercased) — e.g. `octocat`, no `@`, no display name. Resolve one via `org-member-get-github-login` / git history when you only have a name.",
+ "maxLength": 200,
+ "type": "string"
+ },
+ "user_uuid": {
+ "description": "PostHog user UUID (e.g. from `org-members-list`). 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 accepted by `org-member-get-github-login` is not valid here.",
+ "type": "string"
+ }
+ },
+ "type": "object"
},
+ "maxItems": 10,
"type": "array"
},
"summary": {