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.

perf(signals): load the inbox list from postgres and lazy load sources (#106287)

Radu Raicea794ada03c754
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index c3ae760a6fd8..033f5cac1982 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -9631,9 +9631,9 @@ snapshots:
scenes-app-inbox-scene--empty-with-many-scouts--light:
hash: v1.k794b7964.606130d48b16c3688cb233bc286359045945967f6d05c9ab098f8aa795b17782.AJRxyRLHMGB9Oe3oASK6hq85ZTOwiRhwTb9GrjBEh_M
scenes-app-inbox-scene--inbox--dark:
- hash: v1.k794b7964.66f137de763a4380ae9c43188c61aa4e3be36b1a4ad4a0a75efeeb6d9e02c3e3.fTwskYTEVxl2HWMRotUF_OahuAru-Y4kfh4puPNFPhQ
+ hash: v1.k794b7964.e9e3b470cb5159b90fde42e3b3ced5c3cee49ab96439d514dd5200f5b0b20ae4.aity4IuDx_N2J6PFiRSyN60pX7odMRmrjnqZfSl8xKw
scenes-app-inbox-scene--inbox--light:
- hash: v1.k794b7964.1472c24e826857d56e99bf9b698032a20a04679e083e6c14f1b805596b73719b.6Ah4ycjYBbRUjcO8HIm1iBVbKpB8AmGntfKX6pIpGvM
+ hash: v1.k794b7964.0aa0b6e253d7d4413d458cddf5b584b7d59273b8bdff54a8d8ba9867afe7c02d.FRize2uq1ruMNSLOn7i_qH5fynvsoDi2hIAZkvIVJkQ
scenes-app-inbox-scene--installing-self-driving--dark:
hash: v1.k794b7964.8ae6815920bb480008e7e911ff1dcab389f7efdccca7c17cfbfab02cbd564b4c.oiyVoRTrtyGJiszfAkRBVt6NtR9_L8aqcMTDnzUy-Vs
scenes-app-inbox-scene--installing-self-driving--light:
@@ -9671,9 +9671,9 @@ snapshots:
scenes-app-inbox-scene--self-driving-onboarding--light:
hash: v1.k794b7964.5268ad52b39cdc5bb1d699e6a1a839a552ce397134d6773714e1f5a2d95994b6.hgkYOJDE9ZNZ0mMtcj9cpcDCtmas-opelntO_tyQ9Ig
scenes-app-inbox-scene--self-driving-paused--dark:
- hash: v1.k794b7964.2616389e7fd24ddba63e0097c5188162d95686ac6d4b38f37428491cdcaf55eb.UNTcOPiFjs1ikmM4zQxgTU1Sj6tY8wCt4elxxqnu1RA
+ hash: v1.k794b7964.adab71e0f610d9d7a39e93e47597eed9492fcaeea1f0cb695dc3cb863b735134.ryOBiRrJE5jdogoNJPDTeeiZ4pjLVzevxsjF2PY7YCs
scenes-app-inbox-scene--self-driving-paused--light:
- hash: v1.k794b7964.69039cc858d6991c1d993473916fe79011f4c1b2107c7eb5e25370df6e76ee64.Tf7rnngP037nLFfFjlmddONkfVfBcwIUC426nWgi2NM
+ hash: v1.k794b7964.91a2bf2432e72f7c1475537149b1dca83ddc6fcc13e38dec3658ecc98e234409.j5Pc6iZdIgf8QhsNKC8mb-1SHQJNtP2i3QYoOeUm7bw
scenes-app-inbox-scene--self-driving-verdict-pending--dark:
hash: v1.k794b7964.6070171adce8ba72d73e5ef46ddc59a6ebd25afbb16d2c4ae0837fa9af66e0fd.crmCZN0uPyF4FXAVize9Qi7juxKUap5RRLyfRbpmo9Q
scenes-app-inbox-scene--self-driving-verdict-pending--light:
@@ -10095,9 +10095,9 @@ snapshots:
scenes-app-inbox-tabs--pull-requests-legacy--light:
hash: v1.k794b7964.35cab57581e7b55e28f2447da251822327e7f0008d57c62c006e2270da758523.saj4tzKOHhdj2EdJV-GSj7xrh0-kL-1yHPUwo3AK700
scenes-app-inbox-tabs--reports--dark:
- hash: v1.k794b7964.20c7aea4ebf75887bbcdf9101576084aa8b9be2354037a667669f8f490896267.z2weaXqXGCI2k0Hu8FQs-rEmaZMLsFzcgn5Y8R_FTRk
+ hash: v1.k794b7964.9ab45b891bd7fdedfc01a3f94873763c9331afb29ac6c728906b673ef6031b50.Ey34girBhDgA7zoiZ3U1BgO_N7urHnVgSDNfJvGssQ8
scenes-app-inbox-tabs--reports--light:
- hash: v1.k794b7964.be0af4a17630b288f3398a93aff3d64052019cdd034fad86ab5f5ee0a54e3291.IJFPE7sNRWSp2ppogpohC-E2HBZHESaK_YOG1q9bjfk
+ hash: v1.k794b7964.332d84ce12c535e7ba830ed806828ad6a18c45fac98d488ba8baf2251f8c04cf.Yb_hhUUPe2SSq8cewTf4mN8IBRa8oDqmt4mosyTFaqc
scenes-app-inbox-tabs--reports-empty--dark:
hash: v1.k794b7964.a84b301c5e7b2f3b614ae70fd79cb33521d4702790bdfe4a4dcad0816a78152e.y29PsyMQdbg-pSBHIijqi2DdHAXSdJTGVyGKvsnPn1E
scenes-app-inbox-tabs--reports-empty--light:
@@ -10107,9 +10107,9 @@ snapshots:
scenes-app-inbox-tabs--reports-legacy--light:
hash: v1.k794b7964.e85a99c486394b1c568acb85a0426c8c70d1feef977b9de6ddd9733f29135752.__HuRE0T7a9P3Os-phwQdQc2LOE_wbf-36gcBMADbf0
scenes-app-inbox-tabs--reports-state-filtered--dark:
- hash: v1.k794b7964.5be5f5aaea26683fd80f5f9567108e2dbf4301626638ceb9eed37240e5d004a2.IgnX39GEqVnf9O5yGEG-hu-1cJZ9FxsYAhICpiA3p-8
+ hash: v1.k794b7964.4fd59d866db1c0b72674287fa7abb0fc4da6f3b04953b87428c871cb928089f7.wUIguFPOnbT-iwzUcn5M3PYyB3qCR0l9CKucjtKtPG4
scenes-app-inbox-tabs--reports-state-filtered--light:
- hash: v1.k794b7964.a89b15e2c0caa264b2eecf3d10be668696b7cfffb103d12086a87f333996eb10.eU27SyH25vlJskAX_ikx1Q2Fab2NeTtEa1vNruZgNe0
+ hash: v1.k794b7964.80050a2a72cdf14971be974d0be03ecf6e86e29a03abe3cbb6327a8b8c37e91a.g5sAY86SD6ZqSCAaFpwQ4ysGII88HDHonaCqcWUozU8
scenes-app-inbox-tabs--runs--dark:
hash: v1.k794b7964.b0eb8ed605bd36103e79e0a60b214bb3923082a8a3e942619b209e2e63c4c27b.tc-_hXddEA1-okpf16Of3a1wM9gWn-D4ZW1_LLaPKq4
scenes-app-inbox-tabs--runs--light:
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 56ac3975c933..502a3d034133 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -5020,6 +5020,8 @@ const api = {
scout_prefix?: string
/** true returns only the filtered total: `results` is empty and no rows are serialized. */
count_only?: 'true' | 'false'
+ /** false skips the ClickHouse lookup for `source_products` and `scout_name`, which then come back empty. */
+ include_source_metadata?: 'true' | 'false'
}): Promise<CountedPaginatedResponse<SignalReport>> {
return await new ApiRequest().signalReports().withQueryString(params).get()
},
diff --git a/products/signals/backend/serializers.py b/products/signals/backend/serializers.py
index eac3e8e2137c..45b3f7a37639 100644
--- a/products/signals/backend/serializers.py
+++ b/products/signals/backend/serializers.py
@@ -1646,6 +1646,65 @@ class SignalReportListSerializer(SignalReportSerializer):
)
+class SignalReportListQuerySerializer(serializers.Serializer):
+ count_only = serializers.BooleanField(
+ required=False,
+ default=False,
+ help_text=(
+ "Return the filtered total with an empty results page. Skips report ordering, "
+ "serialization, and decorative metadata lookups. Defaults to false."
+ ),
+ )
+ include_source_metadata = serializers.BooleanField(
+ required=False,
+ default=True,
+ help_text=(
+ "Fill `source_products` and `scout_name` on each row. These come from ClickHouse, so pass "
+ "false to skip that lookup and get the page from Postgres only: rows then carry an empty "
+ "`source_products` and a null `scout_name`. Load them after with `source_metadata`. "
+ "Defaults to true."
+ ),
+ )
+
+
+# One list page, with room for a next page's ids that have not loaded yet.
+MAX_SOURCE_METADATA_REPORTS = 100
+
+
+class SignalReportSourceMetadataRequestSerializer(serializers.Serializer):
+ report_ids = serializers.ListField(
+ child=serializers.UUIDField(),
+ min_length=1,
+ max_length=MAX_SOURCE_METADATA_REPORTS,
+ help_text=f"Reports to describe. At most {MAX_SOURCE_METADATA_REPORTS} ids per call.",
+ )
+
+
+class SignalReportSourceMetadataSerializer(serializers.Serializer):
+ id = serializers.UUIDField(read_only=True, help_text="Report id.")
+ source_products = serializers.ListField(
+ child=serializers.CharField(),
+ read_only=True,
+ help_text="Distinct source products contributing signals to this report. Empty when it has none yet.",
+ )
+ scout_name = serializers.CharField(
+ read_only=True,
+ allow_null=True,
+ help_text="skill_name slug of the scout that authored this report, when scout-authored; null otherwise.",
+ )
+
+
+class SignalReportSourceMetadataResponseSerializer(serializers.Serializer):
+ reports = SignalReportSourceMetadataSerializer(
+ many=True,
+ read_only=True,
+ help_text=(
+ "One entry per requested id, in request order, duplicates removed. An id with no signals in "
+ "this project, including one that is not a report here, gets empty values."
+ ),
+ )
+
+
class SignalReportMetricRefreshRequestSerializer(serializers.Serializer):
report_ids = serializers.ListField(
child=serializers.UUIDField(),
diff --git a/products/signals/backend/test/test_signal_report_api.py b/products/signals/backend/test/test_signal_report_api.py
index d94a32d35485..d05f4f6e0975 100644
--- a/products/signals/backend/test/test_signal_report_api.py
+++ b/products/signals/backend/test/test_signal_report_api.py
@@ -1824,6 +1824,63 @@ class TestSignalReportListAPI(APIBaseTest):
# scout_name flows from the ClickHouse meta through the view's map split into the serializer.
assert response.json()["scout_name"] == "signals-scout-error-tracking"
+ @parameterized.expand(
+ [
+ ("default", {}, True),
+ ("opted_out", {"include_source_metadata": "false"}, False),
+ ]
+ )
+ def test_list_source_metadata_opt_out(self, _name, query, expect_lookup):
+ report = self._create_report()
+
+ with patch(
+ "products.signals.backend.views.fetch_source_products_for_reports",
+ return_value={
+ str(report.id): ReportSignalMeta(source_products=["zendesk"], scout_name="signals-scout-support")
+ },
+ ) as fetch_source_products:
+ response = self.client.get(self._list_url(**query))
+
+ assert response.status_code == status.HTTP_200_OK
+ row = next(r for r in response.json()["results"] if r["id"] == str(report.id))
+ assert fetch_source_products.called is expect_lookup
+ assert row["source_products"] == (["zendesk"] if expect_lookup else [])
+ assert row["scout_name"] == ("signals-scout-support" if expect_lookup else None)
+
+ def test_source_metadata_returns_one_entry_per_requested_id(self):
+ known, unknown = str(uuid.uuid4()), str(uuid.uuid4())
+
+ with patch(
+ "products.signals.backend.views.fetch_source_products_for_reports",
+ return_value={known: ReportSignalMeta(source_products=["zendesk"], scout_name="signals-scout-support")},
+ ) as fetch_source_products:
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/signals/reports/source_metadata/",
+ {"report_ids": [unknown, known, unknown]},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json() == {
+ "reports": [
+ {"id": unknown, "source_products": [], "scout_name": None},
+ {"id": known, "source_products": ["zendesk"], "scout_name": "signals-scout-support"},
+ ]
+ }
+ fetch_source_products.assert_called_once_with(self.team, [unknown, known])
+
+ @parameterized.expand([("empty", 0), ("over_cap", 101)])
+ def test_source_metadata_rejects_out_of_range_id_lists(self, _name, id_count):
+ with patch("products.signals.backend.views.fetch_source_products_for_reports") as fetch_source_products:
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/signals/reports/source_metadata/",
+ {"report_ids": [str(uuid.uuid4()) for _ in range(id_count)]},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ fetch_source_products.assert_not_called()
+
def test_source_products_present_on_signals_action(self):
report = self._create_report()
diff --git a/products/signals/backend/views.py b/products/signals/backend/views.py
index 530de171bf13..29deef3688aa 100644
--- a/products/signals/backend/views.py
+++ b/products/signals/backend/views.py
@@ -177,18 +177,21 @@ from products.signals.backend.serializers import (
SignalReportArtefactWriteSerializer,
SignalReportCheckSerializer,
SignalReportClaimSerializer,
+ SignalReportListQuerySerializer,
SignalReportListSerializer,
SignalReportMetricRefreshRequestSerializer,
SignalReportMetricRefreshResponseSerializer,
SignalReportRefundSerializer,
SignalReportSerializer,
+ SignalReportSourceMetadataRequestSerializer,
+ SignalReportSourceMetadataResponseSerializer,
SignalReportSuggestedReviewersArtefactSerializer,
SignalSourceConfigSerializer,
SignalTeamConfigSerializer,
SignalUserAutonomyConfigCreateSerializer,
SignalUserAutonomyConfigSerializer,
)
-from products.signals.backend.signal_metadata import fetch_source_products_for_reports
+from products.signals.backend.signal_metadata import ReportSignalMeta, fetch_source_products_for_reports
from products.signals.backend.slack_notification_targets import (
is_slack_member_target,
resolve_own_direct_message_target,
@@ -1278,26 +1281,19 @@ class SignalReportViewSet(
# contract of 404ing on suppressed reports.
if self.action != "list":
return False
- raw = self.request.query_params.get("include_all_statuses")
- if raw is None or not raw.strip():
- return False
- value = raw.strip().lower()
- if value in ("1", "true", "yes"):
- return True
- if value in ("0", "false", "no"):
- return False
- raise serializers.ValidationError({"include_all_statuses": f"Invalid value: {raw!r}. Allowed: true, false."})
+ return self._bool_query_param("include_all_statuses") is True
- def _count_only_requested(self) -> bool:
- raw = self.request.query_params.get("count_only")
+ def _bool_query_param(self, name: str) -> bool | None:
+ """Parse a true/false query param. None when the param is absent or blank."""
+ raw = self.request.query_params.get(name)
if raw is None or not raw.strip():
- return False
+ return None
value = raw.strip().lower()
if value in ("1", "true", "yes"):
return True
if value in ("0", "false", "no"):
return False
- raise serializers.ValidationError({"count_only": f"Invalid value: {raw!r}. Allowed: true, false."})
+ raise serializers.ValidationError({name: f"Invalid value: {raw!r}. Allowed: true, false."})
def _apply_signal_report_search_filter(self, queryset):
search = self.request.query_params.get("search")
@@ -1381,32 +1377,16 @@ class SignalReportViewSet(
# requests" tab) with a cheap count query instead of paging the whole list
# and filtering client-side. Absent or empty param leaves the list
# unchanged; an unrecognized value is a 400.
- raw = self.request.query_params.get("has_implementation_pr")
- if raw is None or not raw.strip():
+ wants_pr = self._bool_query_param("has_implementation_pr")
+ if wants_pr is None:
return queryset
- value = raw.strip().lower()
- if value in ("1", "true", "yes"):
- wants_pr = True
- elif value in ("0", "false", "no"):
- wants_pr = False
- else:
- raise serializers.ValidationError(
- {"has_implementation_pr": f"Invalid value: {raw!r}. Allowed: true, false."}
- )
pr_filter = self._implementation_pr_report_filter()
return queryset.filter(pr_filter) if wants_pr else queryset.exclude(pr_filter)
def _apply_signal_report_unclaimed_filter(self, queryset):
- raw = self.request.query_params.get("unclaimed")
- if raw is None or not raw.strip():
+ wants_unclaimed = self._bool_query_param("unclaimed")
+ if wants_unclaimed is None:
return queryset
- value = raw.strip().lower()
- if value in ("1", "true", "yes"):
- wants_unclaimed = True
- elif value in ("0", "false", "no"):
- wants_unclaimed = False
- else:
- raise serializers.ValidationError({"unclaimed": f"Invalid value: {raw!r}. Allowed: true, false."})
has_review_pr = implementation_pr_report_filter(team_id=self.team.id, active_only=True)
is_unclaimed = (
~Q(status=SignalReport.Status.RESOLVED) & ~reports_with_active_claim(team_id=self.team_id) & ~has_review_pr
@@ -1564,17 +1544,12 @@ class SignalReportViewSet(
return queryset.filter(latest_actionability__in=values)
def _apply_signal_report_already_addressed_filter(self, queryset):
- raw = self.request.query_params.get("already_addressed")
- if raw is None or not raw.strip():
+ already_addressed = self._bool_query_param("already_addressed")
+ if already_addressed is None:
return queryset
- value = raw.strip().lower()
- if value in ("1", "true", "yes"):
- return queryset.filter(latest_already_addressed=True)
- if value in ("0", "false", "no"):
- # `=False`, not `exclude(=True)`: a report with no parseable judgment holds NULL, and
- # "not already addressed" has never covered reports nobody judged.
- return queryset.filter(latest_already_addressed=False)
- raise serializers.ValidationError({"already_addressed": f"Invalid value: {raw!r}. Allowed: true, false."})
+ # `=False`, not `exclude(=True)`: a report with no parseable judgment holds NULL, and
+ # "not already addressed" has never covered reports nobody judged.
+ return queryset.filter(latest_already_addressed=already_addressed)
def _apply_signal_report_inbox_view_filter(self, queryset):
inbox_view = self.request.query_params.get("view")
@@ -1960,7 +1935,9 @@ class SignalReportViewSet(
)
return Response(SignalReportSerializer(report, context=self._enriched_report_context(report)).data)
- @extend_schema(
+ @validated_request(
+ query_serializer=SignalReportListQuerySerializer,
+ responses={200: SignalReportListSerializer},
parameters=[
OpenApiParameter(
name="status",
@@ -2181,29 +2158,21 @@ class SignalReportViewSet(
enum=["me"],
description="Use 'me' to return reports claimed by the current user, task, or MCP agent.",
),
- OpenApiParameter(
- name="count_only",
- type=OpenApiTypes.BOOL,
- location=OpenApiParameter.QUERY,
- required=False,
- description=(
- "Return the filtered total with an empty results page. Skips report ordering, "
- "serialization, and decorative metadata lookups. Defaults to false."
- ),
- ),
],
)
@tracer.start_as_current_span("signals.reports.list")
- def list(self, request, *args, **kwargs):
+ def list(self, request: ValidatedRequest, *args, **kwargs):
# The reports list is the primary inbox-load endpoint. Each phase gets its own child span
# so a slow load can be attributed to Postgres (queryset annotations), ClickHouse (source
# products), the task facade (PR urls), or serialization, rather than one opaque request.
- count_only = self._count_only_requested()
+ count_only: bool = request.validated_query_data["count_only"]
+ include_source_metadata: bool = request.validated_query_data["include_source_metadata"]
list_span = trace.get_current_span()
list_span.set_attribute(
"signals.reports.list.client", classify_report_list_client(request.headers.get("user-agent"))
)
list_span.set_attribute("signals.reports.list.count_only", count_only)
+ list_span.set_attribute("signals.reports.list.include_source_metadata", include_source_metadata)
with tracer.start_as_current_span("signals.reports.list.queryset"):
queryset = self.filter_queryset(self.get_queryset())
@@ -2235,13 +2204,15 @@ class SignalReportViewSet(
)
# Source metadata is decorative. The serializer degrades to empty values when ClickHouse is
- # unavailable, so a metadata failure does not hide otherwise available reports.
- with tracer.start_as_current_span("signals.reports.list.fetch_source_products"):
- try:
- signal_meta_map = fetch_source_products_for_reports(self.team, report_ids) if report_ids else {}
- except Exception:
- logger.exception("signals.reports.list.source_products_failed", report_count=len(report_ids))
- signal_meta_map = {}
+ # unavailable, so a metadata failure does not hide otherwise available reports. The web inbox
+ # opts out and loads it after the rows render, so the page does not wait on ClickHouse.
+ signal_meta_map: dict[str, ReportSignalMeta] = {}
+ if include_source_metadata and report_ids:
+ with tracer.start_as_current_span("signals.reports.list.fetch_source_products"):
+ try:
+ signal_meta_map = fetch_source_products_for_reports(self.team, report_ids)
+ except Exception:
+ logger.exception("signals.reports.list.source_products_failed", report_count=len(report_ids))
with tracer.start_as_current_span("signals.reports.list.fetch_implementation_prs"):
try:
@@ -2735,6 +2706,47 @@ class SignalReportViewSet(
)
return Response(serializer.data)
+ @validated_request(
+ request_serializer=SignalReportSourceMetadataRequestSerializer,
+ responses={200: OpenApiResponse(response=SignalReportSourceMetadataResponseSerializer)},
+ summary="Get the source products and authoring scout of the reports on screen",
+ description=(
+ "Read which source products contributed signals to each given report, and which scout "
+ "authored it. These values come from ClickHouse, so the inbox list skips them "
+ "(`include_source_metadata=false`) and calls this after the rows render. Returns one entry "
+ "per requested id. An id with no signals in this project gets empty values."
+ ),
+ operation_id="signals_reports_source_metadata_create",
+ )
+ # POST, like `refresh_metrics`, so a page of ids never has to fit in a URL.
+ @action(
+ detail=False,
+ methods=["post"],
+ url_path="source_metadata",
+ required_scopes=["task:read"],
+ throttle_classes=[ClickHouseBurstRateThrottle, ClickHouseSustainedRateThrottle],
+ )
+ @tracer.start_as_current_span("signals.reports.source_metadata")
+ def source_metadata(self, request: ValidatedRequest, **kwargs) -> Response:
+ # No Postgres read: the signal store is scoped to this team, so an id from another project
+ # matches no rows and comes back empty.
+ report_ids = list(dict.fromkeys(str(report_id) for report_id in request.validated_data["report_ids"]))
+ signal_meta_map = fetch_source_products_for_reports(self.team, report_ids)
+ empty = ReportSignalMeta(source_products=[], scout_name=None)
+ serializer = SignalReportSourceMetadataResponseSerializer(
+ {
+ "reports": [
+ {
+ "id": report_id,
+ "source_products": signal_meta_map.get(report_id, empty).source_products,
+ "scout_name": signal_meta_map.get(report_id, empty).scout_name,
+ }
+ for report_id in report_ids
+ ]
+ }
+ )
+ return Response(serializer.data)
+
def _forward_dismissal_note(
self,
*,
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index deb4e65da683..0bb381d394bd 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -3092,6 +3092,32 @@ export interface SignalReportRefundSummaryResponseApi {
quota_limited: boolean
}
+export interface SignalReportSourceMetadataRequestApi {
+ /**
+ * Reports to describe. At most 100 ids per call.
+ * @minItems 1
+ * @maxItems 100
+ */
+ report_ids: string[]
+}
+
+export interface SignalReportSourceMetadataApi {
+ /** Report id. */
+ readonly id: string
+ /** Distinct source products contributing signals to this report. Empty when it has none yet. */
+ readonly source_products: readonly string[]
+ /**
+ * skill_name slug of the scout that authored this report, when scout-authored; null otherwise.
+ * @nullable
+ */
+ readonly scout_name: string | null
+}
+
+export interface SignalReportSourceMetadataResponseApi {
+ /** One entry per requested id, in request order, duplicates removed. An id with no signals in this project, including one that is not a report here, gets empty values. */
+ readonly reports: readonly SignalReportSourceMetadataApi[]
+}
+
export interface LLMSkillFileInputApi {
/**
* File path relative to skill root, e.g. 'scripts/setup.sh' or 'references/guide.md'.
@@ -6493,6 +6519,10 @@ export type SignalsReportsListParams = {
* When true, the list includes reports in every status with no default exclusions applied — currently that adds suppressed (dismissed) reports, which are otherwise hidden. Use it to see the full inbox state (e.g. deduplicating before creating a report) and read each row's status (plus dismissal_reason/dismissal_note on dismissed rows) before acting. Deleted reports are terminal and never returned. Defaults to false, which keeps the existing default exclusions. Ignored when an explicit 'status' filter is set — that filter alone decides which statuses are returned.
*/
include_all_statuses?: boolean
+ /**
+ * Fill `source_products` and `scout_name` on each row. These come from ClickHouse, so pass false to skip that lookup and get the page from Postgres only: rows then carry an empty `source_products` and a null `scout_name`. Load them after with `source_metadata`. Defaults to true.
+ */
+ include_source_metadata?: boolean
/**
* Number of results to return per page.
*/
diff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.ts
index 9c6f6551f2b4..bcd0c0f7836a 100644
--- a/products/signals/frontend/generated/api.ts
+++ b/products/signals/frontend/generated/api.ts
@@ -87,6 +87,8 @@ import type {
SignalReportRefundResponseApi,
SignalReportRefundSummaryResponseApi,
SignalReportReingestionStatusApi,
+ SignalReportSourceMetadataRequestApi,
+ SignalReportSourceMetadataResponseApi,
SignalReportStateRequestApi,
SignalReportSuggestedReviewersArtefactApi,
SignalScoutConfigApi,
@@ -1227,6 +1229,27 @@ export const signalsReportsRefundSummaryRetrieve = async (
})
}
+export const getSignalsReportsSourceMetadataCreateUrl = (projectId: string) => {
+ return `/api/projects/${projectId}/signals/reports/source_metadata/`
+}
+
+/**
+ * Read which source products contributed signals to each given report, and which scout authored it. These values come from ClickHouse, so the inbox list skips them (`include_source_metadata=false`) and calls this after the rows render. Returns one entry per requested id. An id with no signals in this project gets empty values.
+ * @summary Get the source products and authoring scout of the reports on screen
+ */
+export const signalsReportsSourceMetadataCreate = async (
+ projectId: string,
+ signalReportSourceMetadataRequestApi: SignalReportSourceMetadataRequestApi,
+ options?: RequestInit
+): Promise<SignalReportSourceMetadataResponseApi> => {
+ return apiMutator<SignalReportSourceMetadataResponseApi>(getSignalsReportsSourceMetadataCreateUrl(projectId), {
+ ...options,
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
+ body: JSON.stringify(signalReportSourceMetadataRequestApi),
+ })
+}
+
export const getSignalsScoutCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/signals/scout/`
}
diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.ts
index 0a2ad6c01d68..74f2a7fb30fd 100644
--- a/products/signals/frontend/generated/api.zod.ts
+++ b/products/signals/frontend/generated/api.zod.ts
@@ -571,6 +571,20 @@ export const SignalsReportsRefreshMetricsCreateBody = /* @__PURE__ */ zod.object
),
})
+/**
+ * Read which source products contributed signals to each given report, and which scout authored it. These values come from ClickHouse, so the inbox list skips them (`include_source_metadata=false`) and calls this after the rows render. Returns one entry per requested id. An id with no signals in this project gets empty values.
+ * @summary Get the source products and authoring scout of the reports on screen
+ */
+export const signalsReportsSourceMetadataCreateBodyReportIdsMax = 100
+
+export const SignalsReportsSourceMetadataCreateBody = /* @__PURE__ */ zod.object({
+ report_ids: zod
+ .array(zod.uuid())
+ .min(1)
+ .max(signalsReportsSourceMetadataCreateBodyReportIdsMax)
+ .describe('Reports to describe. At most 100 ids per call.'),
+})
+
/**
* Create a scout skill and its runnable config atomically. Give it a `display_name` — the label people read, kept exactly as written — and the scout's permanent skill name is generated from it, with a numeric suffix when that name is taken, so two scouts may share a label without sharing an identity. Pass `name` instead to pick that identifier yourself; any valid skill name works, since the config row is what makes a skill a scout. The skill always receives the report-channel tools. The optional config controls schedule, enablement, dry-run posture, network access, and typed destinations such as Slack. Repeating the same definition is safe and applies any supplied config fields; reusing an explicit `name` for a different definition returns 409.
* @summary Create a scout
diff --git a/products/signals/frontend/inbox/InboxScene.stories.tsx b/products/signals/frontend/inbox/InboxScene.stories.tsx
index b40911ec8b0a..b4793c99becb 100644
--- a/products/signals/frontend/inbox/InboxScene.stories.tsx
+++ b/products/signals/frontend/inbox/InboxScene.stories.tsx
@@ -16,6 +16,7 @@ import {
mockReviewers,
mockSignals,
mockSourceConfigs,
+ mockSourceMetadata,
mockTask,
mockTeamConfig,
pullRequestReports,
@@ -77,6 +78,9 @@ const sceneMocks = mswDecorator({
'/api/projects/:id/external_data_sources': () => [200, { results: [], count: 0 }],
'/api/projects/:id/external_data_sources/': () => [200, { results: [], count: 0 }],
},
+ post: {
+ '/api/projects/:id/signals/reports/source_metadata/': mockSourceMetadata(allReports),
+ },
})
const meta: Meta = {
diff --git a/products/signals/frontend/inbox/__mocks__/inboxMocks.ts b/products/signals/frontend/inbox/__mocks__/inboxMocks.ts
index f6487ee9e50f..268242c0896f 100644
--- a/products/signals/frontend/inbox/__mocks__/inboxMocks.ts
+++ b/products/signals/frontend/inbox/__mocks__/inboxMocks.ts
@@ -268,6 +268,26 @@ export const allReports: SignalReport[] = [...reportTabReports, ...pullRequestRe
// ── Detail-endpoint payloads ────────────────────────────────────────────────
+/** Answers `POST signals/reports/source_metadata/` from the given reports, as the inbox list loads its source line. */
+export function mockSourceMetadata(
+ reports: SignalReport[]
+): ({ request }: { request: Request }) => Promise<[number, { reports: object[] }]> {
+ return async ({ request }) => {
+ const { report_ids } = (await request.json()) as { report_ids: string[] }
+ const byId = new Map(reports.map((report) => [report.id, report]))
+ return [
+ 200,
+ {
+ reports: report_ids.map((id) => ({
+ id,
+ source_products: byId.get(id)?.source_products ?? [],
+ scout_name: byId.get(id)?.scout_name ?? null,
+ })),
+ },
+ ]
+ }
+}
+
export function mockSignals(reportId: string, count = 4): SignalNode[] {
return Array.from({ length: count }).map((_, i) => ({
signal_id: `${reportId}-sig-${i}`,
diff --git a/products/signals/frontend/inbox/components/tabs/InboxTabs.stories.tsx b/products/signals/frontend/inbox/components/tabs/InboxTabs.stories.tsx
index 68277fb97200..50194c2c8f77 100644
--- a/products/signals/frontend/inbox/components/tabs/InboxTabs.stories.tsx
+++ b/products/signals/frontend/inbox/components/tabs/InboxTabs.stories.tsx
@@ -8,7 +8,7 @@ import { urls } from 'scenes/urls'
import { mswDecorator } from '~/mocks/browser'
-import { pullRequestReports, reportTabReports } from '../../__mocks__/inboxMocks'
+import { mockSourceMetadata, pullRequestReports, reportTabReports } from '../../__mocks__/inboxMocks'
import { inboxSceneLogic } from '../../inboxSceneLogic'
import { SignalReport, SignalRun } from '../../types'
import { PullRequestsTab } from './PullRequestsTab'
@@ -58,6 +58,9 @@ function reportsListDecorator(reports: SignalReport[]): Decorator {
'/api/projects/:id/signals/reports/available_reviewers': () => [200, []],
'/api/projects/:id/signals/scout/configs': () => [200, []],
},
+ post: {
+ '/api/projects/:id/signals/reports/source_metadata/': mockSourceMetadata(reports),
+ },
})
}
diff --git a/products/signals/frontend/inbox/logics/reportListLogic.test.ts b/products/signals/frontend/inbox/logics/reportListLogic.test.ts
index 2bd306fe2084..b3df0d2e9d8a 100644
--- a/products/signals/frontend/inbox/logics/reportListLogic.test.ts
+++ b/products/signals/frontend/inbox/logics/reportListLogic.test.ts
@@ -267,6 +267,91 @@ describe('reportListLogic', () => {
)
})
+ // The list skips the ClickHouse source lookup so it renders from Postgres alone. The source line
+ // must then fill in from one follow-up request, and a refresh must ask again so new sources show.
+ describe('lazy source line', () => {
+ let logic: ReturnType<typeof reportListLogic.build>
+ let includeSourceMetadata: (string | null)[]
+ let queriedReportIds: string[][]
+ let scoutName: string
+
+ beforeEach(async () => {
+ includeSourceMetadata = []
+ queriedReportIds = []
+ scoutName = 'signals-scout-support'
+ useMocks({
+ get: {
+ '/api/projects/:team_id/signals/reports/available_reviewers': {},
+ [REPORTS_URL]: ({ request }) => {
+ const { searchParams } = new URL(request.url)
+ if (searchParams.get('count_only') !== 'true') {
+ includeSourceMetadata.push(searchParams.get('include_source_metadata'))
+ }
+ return [
+ 200,
+ {
+ count: 2,
+ next: null,
+ previous: null,
+ results: ['scouted', 'no-signals'].map((id) => ({
+ ...makeReport(id),
+ source_products: [],
+ scout_name: null,
+ })),
+ },
+ ]
+ },
+ },
+ post: {
+ '/api/projects/:team_id/signals/reports/source_metadata/': async ({ request }) => {
+ const { report_ids } = (await request.json()) as { report_ids: string[] }
+ queriedReportIds.push(report_ids)
+ return [
+ 200,
+ {
+ reports: report_ids.map((id) =>
+ id === 'scouted'
+ ? { id, source_products: ['signals_scout'], scout_name: scoutName }
+ : { id, source_products: [], scout_name: null }
+ ),
+ },
+ ]
+ },
+ },
+ })
+ initKeaTests()
+ logic = reportListLogic({
+ sectionKey: 'needs-decision',
+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS['needs-decision'],
+ })
+ logic.mount()
+ logic.actions.ensureLoaded()
+ await expectLogic(logic).toFinishAllListeners()
+ })
+
+ afterEach(() => logic.unmount())
+
+ it('fills the source line after the rows load and refreshes it with the rows', async () => {
+ expect(includeSourceMetadata).toEqual(['false'])
+ expect(queriedReportIds).toEqual([['scouted', 'no-signals']])
+ expect(
+ logic.values.reports.map(({ id, source_products, scout_name }) => ({ id, source_products, scout_name }))
+ ).toEqual([
+ { id: 'scouted', source_products: ['signals_scout'], scout_name: 'signals-scout-support' },
+ { id: 'no-signals', source_products: [], scout_name: null },
+ ])
+
+ scoutName = 'signals-scout-billing'
+ logic.actions.refresh()
+ await expectLogic(logic).toFinishAllListeners()
+ expect(queriedReportIds).toEqual([
+ ['scouted', 'no-signals'],
+ ['scouted', 'no-signals'],
+ ])
+ expect(logic.values.reports[0].scout_name).toEqual('signals-scout-billing')
+ })
+ })
+
// Which rows get a CI glyph, and which pull requests the batch endpoint is asked about. A landed
// or dropped pull request has no CI worth reading, and asking about it spends a GitHub call.
describe('pull requests still in flight on the page', () => {
diff --git a/products/signals/frontend/inbox/logics/reportListLogic.ts b/products/signals/frontend/inbox/logics/reportListLogic.ts
index 6fb8fe0c41df..2d70d24ab8fc 100644
--- a/products/signals/frontend/inbox/logics/reportListLogic.ts
+++ b/products/signals/frontend/inbox/logics/reportListLogic.ts
@@ -1,9 +1,10 @@
import { MakeLogicType, actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
+import posthog from 'posthog-js'
import { lemonToast } from '@posthog/lemon-ui'
-import api, { CountedPaginatedResponse } from 'lib/api'
+import api, { ApiConfig, CountedPaginatedResponse } from 'lib/api'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
import { derivePrState } from 'lib/signals/prState'
@@ -12,7 +13,10 @@ import { userLogic } from 'scenes/userLogic'
import type { UserType } from '~/types'
-import { signalsReportsRefreshMetricsCreate } from 'products/signals/frontend/generated/api'
+import {
+ signalsReportsRefreshMetricsCreate,
+ signalsReportsSourceMetadataCreate,
+} from 'products/signals/frontend/generated/api'
import type { SignalReportMetricSnapshotsApi } from 'products/signals/frontend/generated/api.schemas'
import { captureInboxReportAction, type InboxReportActionSurface } from '../inboxAnalytics'
@@ -41,6 +45,9 @@ const PAGE_SIZE = 50
// The refresh endpoint's own id cap per call.
const METRIC_REFRESH_PAGE_SIZE = 20
+/** The row fields the list leaves empty (`include_source_metadata=false`) and `source_metadata` fills in. */
+export type ReportSourceMeta = Pick<SignalReport, 'source_products' | 'scout_name'>
+
/** Fixed, section-defining server filter (e.g. `{ has_implementation_pr: 'true' }`). */
export type ReportListParams = Record<string, string>
@@ -163,6 +170,7 @@ export interface reportListLogicValues {
loadedQueryKey: string | null
pageLoadFailed: boolean
primarySectionKey: InboxReportSectionKey
+ reportSourceMeta: Record<string, ReportSourceMeta>
reports: SignalReport[]
reportsLoadFailed: boolean
reportsResponse: ReportListResponse | null
@@ -218,6 +226,9 @@ export interface reportListLogicActions {
applyReportMetricSnapshots: (snapshots: SignalReportMetricSnapshotsApi[]) => {
snapshots: SignalReportMetricSnapshotsApi[]
}
+ applyReportSourceMeta: (meta: Record<string, ReportSourceMeta>) => {
+ meta: Record<string, ReportSourceMeta>
+ }
dismissReport: (
reportId: string,
dismissal: DismissalFeedback
@@ -261,6 +272,9 @@ export interface reportListLogicActions {
reportsResponse: ReportListResponse
payload?: any
}
+ loadReportSourceMeta: (reportIds: string[]) => {
+ reportIds: string[]
+ }
loadReports: () => any
loadReportsFailure: (
error: string,
@@ -319,7 +333,10 @@ export interface reportListLogicMeta {
scopeReviewerUuid: string | undefined,
arg: any
) => any
- reports: (reportsResponse: ReportListResponse | null) => SignalReport[]
+ reports: (
+ reportsResponse: ReportListResponse | null,
+ reportSourceMeta: Record<string, ReportSourceMeta>
+ ) => SignalReport[]
staleMetricReportIds: (reports: SignalReport[]) => string[]
hasMore: (reportsResponse: ReportListResponse | null) => boolean
isLoaded: (reportsResponse: ReportListResponse | null) => boolean
@@ -407,6 +424,10 @@ export const reportListLogic = kea<reportListLogicType>([
// failure leaves the rows on their saved snapshot.
refreshReportMetrics: (reportIds: string[]) => ({ reportIds }),
applyReportMetricSnapshots: (snapshots: SignalReportMetricSnapshotsApi[]) => ({ snapshots }),
+ // Source products and scout come from ClickHouse, so the rows load without them and this
+ // fills them in once the page is on screen. Best effort: a failure leaves the source line empty.
+ loadReportSourceMeta: (reportIds: string[]) => ({ reportIds }),
+ applyReportSourceMeta: (meta: Record<string, ReportSourceMeta>) => ({ meta }),
}),
loaders(({ values, cache }) => ({
@@ -463,6 +484,14 @@ export const reportListLogic = kea<reportListLogicType>([
})),
reducers({
+ // Kept apart from `reportsResponse` so a refresh that replaces the rows does not blank the
+ // source line while the lookup runs again.
+ reportSourceMeta: [
+ {} as Record<string, ReportSourceMeta>,
+ {
+ applyReportSourceMeta: (state, { meta }) => ({ ...state, ...meta }),
+ },
+ ],
reportsResponse: {
// Only the numbers change: the row keeps its title, summary, and query as loaded.
applyReportMetricSnapshots: (state, { snapshots }) =>
@@ -558,12 +587,20 @@ export const reportListLogic = kea<reportListLogicType>([
scout: scoutFilter.length > 0 ? scoutFilter.join(',') : undefined,
priority: priorityFilter.length > 0 ? priorityFilter.join(',') : undefined,
suggested_reviewers: suggestedReviewer,
+ // Rows render from Postgres alone; `loadReportSourceMeta` fills the source line after.
+ include_source_metadata: 'false',
}
},
],
reports: [
- (s) => [s.reportsResponse],
- (reportsResponse: ReportListResponse | null): SignalReport[] => reportsResponse?.results ?? [],
+ (s) => [s.reportsResponse, s.reportSourceMeta],
+ (
+ reportsResponse: ReportListResponse | null,
+ reportSourceMeta: Record<string, ReportSourceMeta>
+ ): SignalReport[] =>
+ (reportsResponse?.results ?? []).map((report) =>
+ reportSourceMeta[report.id] ? { ...report, ...reportSourceMeta[report.id] } : report
+ ),
],
// Rows whose metric snapshot is missing or older than the server's freshness window. Rows
// refreshed on an earlier page are fresh, so a next-page load only sends the new ones.
@@ -632,10 +669,43 @@ export const reportListLogic = kea<reportListLogicType>([
loadReportsSuccess: () => {
actions.trackReports(props.sectionKey, values.livePrReportIds)
actions.refreshReportMetrics(values.staleMetricReportIds)
+ // A first page or a refresh asks again for every row, because a report gains sources as
+ // new signals land. The rows keep their previous values until the answer arrives.
+ actions.loadReportSourceMeta(values.reports.map((report) => report.id))
},
loadMoreReportsSuccess: () => {
actions.trackReports(props.sectionKey, values.livePrReportIds)
actions.refreshReportMetrics(values.staleMetricReportIds)
+ actions.loadReportSourceMeta(
+ values.reports.map((report) => report.id).filter((id) => !(id in values.reportSourceMeta))
+ )
+ },
+ // Skips the ids a request already in flight covers, so overlapping page loads do not repeat
+ // the ClickHouse query.
+ loadReportSourceMeta: async ({ reportIds }) => {
+ const inFlight: Set<string> = (cache.sourceMetaInFlight ??= new Set<string>())
+ const requested = reportIds.filter((id) => !inFlight.has(id))
+ if (requested.length === 0) {
+ return
+ }
+ requested.forEach((id) => inFlight.add(id))
+ try {
+ const response = await signalsReportsSourceMetadataCreate(String(ApiConfig.getCurrentProjectId()), {
+ report_ids: requested,
+ })
+ actions.applyReportSourceMeta(
+ Object.fromEntries(
+ response.reports.map(({ id, source_products, scout_name }) => [
+ id,
+ { source_products: [...source_products], scout_name },
+ ])
+ )
+ )
+ } catch (error) {
+ posthog.captureException(error)
+ } finally {
+ requested.forEach((id) => inFlight.delete(id))
+ }
},
removeReport: ({ reportId }) => {
cache.removedWhilePageLoads?.add(reportId)
diff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yaml
index e7d332ee9c9b..65638499bea8 100644
--- a/products/signals/mcp/tools.yaml
+++ b/products/signals/mcp/tools.yaml
@@ -1251,6 +1251,9 @@ tools:
signals-reports-signals-retrieve:
operation: signals_reports_signals_retrieve
enabled: false
+ signals-reports-source-metadata-create:
+ operation: signals_reports_source_metadata_create
+ enabled: false
signals-reports-viewed-create:
operation: signals_reports_viewed_create
enabled: false
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 3067675c8796..0be9b1b5635b 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -91927,6 +91927,32 @@ export namespace Schemas {
report_id: string;
}
+ export interface SignalReportSourceMetadata {
+ /** Report id. */
+ readonly id: string;
+ /** Distinct source products contributing signals to this report. Empty when it has none yet. */
+ readonly source_products: readonly string[];
+ /**
+ * skill_name slug of the scout that authored this report, when scout-authored; null otherwise.
+ * @nullable
+ */
+ readonly scout_name: string | null;
+ }
+
+ export interface SignalReportSourceMetadataRequest {
+ /**
+ * Reports to describe. At most 100 ids per call.
+ * @minItems 1
+ * @maxItems 100
+ */
+ report_ids: string[];
+ }
+
+ export interface SignalReportSourceMetadataResponse {
+ /** One entry per requested id, in request order, duplicates removed. An id with no signals in this project, including one that is not a report here, gets empty values. */
+ readonly reports: readonly SignalReportSourceMetadata[];
+ }
+
export interface SignalReportStateRequest {
/** Target state for the report. Use 'suppressed' to dismiss the report from the inbox, 'potential' to snooze/reopen it for later review, or 'resolved' when the work this report asked for has been done. Resolving is allowed from ready, pending_input, or failed, or from a suppressed report that previously held one of those statuses or resolved. Resolving an already resolved report succeeds. Other statuses return 409 (skipped in bulk). Dismissing or resolving closes the report's open implementation PR, if it has one.
*
@@ -117808,6 +117834,10 @@ export namespace Schemas {
* When true, the list includes reports in every status with no default exclusions applied — currently that adds suppressed (dismissed) reports, which are otherwise hidden. Use it to see the full inbox state (e.g. deduplicating before creating a report) and read each row's status (plus dismissal_reason/dismissal_note on dismissed rows) before acting. Deleted reports are terminal and never returned. Defaults to false, which keeps the existing default exclusions. Ignored when an explicit 'status' filter is set — that filter alone decides which statuses are returned.
*/
include_all_statuses?: boolean;
+ /**
+ * Fill `source_products` and `scout_name` on each row. These come from ClickHouse, so pass false to skip that lookup and get the page from Postgres only: rows then carry an empty `source_products` and a null `scout_name`. Load them after with `source_metadata`. Defaults to true.
+ */
+ include_source_metadata?: boolean;
/**
* Number of results to return per page.
*/
diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.ts
index d9ce4940c4f1..976e7c90e3ae 100644
--- a/services/mcp/src/generated/signals/api.ts
+++ b/services/mcp/src/generated/signals/api.ts
@@ -16,6 +16,9 @@ export const SignalsReportsListParams = () => zod.object({
),
})
+export const signalsReportsListQueryCountOnlyDefault = false
+export const signalsReportsListQueryIncludeSourceMetadataDefault = true
+
export const SignalsReportsListQueryParams = () => zod.object({
actionability: zod
.string()
@@ -41,7 +44,7 @@ export const SignalsReportsListQueryParams = () => zod.object({
),
count_only: zod
.boolean()
- .optional()
+ .default(signalsReportsListQueryCountOnlyDefault)
.describe(
'Return the filtered total with an empty results page. Skips report ordering, serialization, and decorative metadata lookups. Defaults to false.'
),
@@ -57,6 +60,12 @@ export const SignalsReportsListQueryParams = () => zod.object({
.describe(
"When true, the list includes reports in every status with no default exclusions applied — currently that adds suppressed (dismissed) reports, which are otherwise hidden. Use it to see the full inbox state (e.g. deduplicating before creating a report) and read each row's status (plus dismissal_reason\/dismissal_note on dismissed rows) before acting. Deleted reports are terminal and never returned. Defaults to false, which keeps the existing default exclusions. Ignored when an explicit 'status' filter is set — that filter alone decides which statuses are returned."
),
+ include_source_metadata: zod
+ .boolean()
+ .default(signalsReportsListQueryIncludeSourceMetadataDefault)
+ .describe(
+ 'Fill `source_products` and `scout_name` on each row. These come from ClickHouse, so pass false to skip that lookup and get the page from Postgres only: rows then carry an empty `source_products` and a null `scout_name`. Load them after with `source_metadata`. Defaults to true.'
+ ),
limit: zod.number().optional().describe('Number of results to return per page.'),
offset: zod.number().optional().describe('The initial index from which to return the results.'),
ordering: zod
diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.ts
index 3903ccccbb67..dd3b913d3f60 100644
--- a/services/mcp/src/tools/generated/signals.ts
+++ b/services/mcp/src/tools/generated/signals.ts
@@ -354,6 +354,7 @@ const inboxReportsList = (): ToolBase<
count_only: params.count_only,
has_implementation_pr: params.has_implementation_pr,
include_all_statuses: params.include_all_statuses,
+ include_source_metadata: params.include_source_metadata,
limit: params.limit,
offset: params.offset,
ordering: params.ordering,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json
index 56536a48d294..48647d3a3c96 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json
@@ -19,6 +19,7 @@
"type": "string"
},
"count_only": {
+ "default": false,
"description": "Return the filtered total with an empty results page. Skips report ordering, serialization, and decorative metadata lookups. Defaults to false.",
"type": "boolean"
},
@@ -30,6 +31,11 @@
"description": "When true, the list includes reports in every status with no default exclusions applied — currently that adds suppressed (dismissed) reports, which are otherwise hidden. Use it to see the full inbox state (e.g. deduplicating before creating a report) and read each row's status (plus dismissal_reason/dismissal_note on dismissed rows) before acting. Deleted reports are terminal and never returned. Defaults to false, which keeps the existing default exclusions. Ignored when an explicit 'status' filter is set — that filter alone decides which statuses are returned.",
"type": "boolean"
},
+ "include_source_metadata": {
+ "default": true,
+ "description": "Fill `source_products` and `scout_name` on each row. These come from ClickHouse, so pass false to skip that lookup and get the page from Postgres only: rows then carry an empty `source_products` and a null `scout_name`. Load them after with `source_metadata`. Defaults to true.",
+ "type": "boolean"
+ },
"limit": {
"description": "Number of results to return per page.",
"type": "number"