Skip to content

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

fix(signals): reduce self-driving inbox load time (#90548)

Dylan Martin39b00e686cd4
diff --git a/products/desktop/packages/api-client/src/posthog-client.test.ts b/products/desktop/packages/api-client/src/posthog-client.test.ts
index 25eb19b8c3be..a7543a6f7eb5 100644
--- a/products/desktop/packages/api-client/src/posthog-client.test.ts
+++ b/products/desktop/packages/api-client/src/posthog-client.test.ts
@@ -1719,6 +1719,38 @@ describe("PostHogAPIClient", () => {
});
});
+ describe("getSignalReports", () => {
+ it("sends count-only requests to the reports endpoint", async () => {
+ const fetch = vi.fn().mockResolvedValue({
+ ok: true,
+ json: async () => ({ count: 3, results: [] }),
+ });
+ const client = new PostHogAPIClient(
+ "http://localhost:8000",
+ async () => "token",
+ async () => "token",
+ 123,
+ );
+ (
+ client as unknown as {
+ api: { baseUrl: string; fetcher: { fetch: typeof fetch } };
+ }
+ ).api = {
+ baseUrl: "http://localhost:8000",
+ fetcher: { fetch },
+ };
+
+ await expect(
+ client.getSignalReports({ count_only: true }),
+ ).resolves.toEqual({ count: 3, results: [] });
+
+ const request = fetch.mock.calls[0]?.[0] as { url: URL };
+ expect(request.url.toString()).toBe(
+ "http://localhost:8000/api/projects/123/signals/reports/?count_only=true",
+ );
+ });
+ });
+
describe("getSignalReport", () => {
function makeClient(fetch: ReturnType<typeof vi.fn>) {
const client = new PostHogAPIClient(
diff --git a/products/desktop/packages/api-client/src/posthog-client.ts b/products/desktop/packages/api-client/src/posthog-client.ts
index e190914f81c6..ed59a0f865c7 100644
--- a/products/desktop/packages/api-client/src/posthog-client.ts
+++ b/products/desktop/packages/api-client/src/posthog-client.ts
@@ -4808,6 +4808,9 @@ export class PostHogAPIClient {
if (params?.priority) {
url.searchParams.set("priority", params.priority);
}
+ if (params?.count_only != null) {
+ url.searchParams.set("count_only", String(params.count_only));
+ }
if (params?.has_implementation_pr != null) {
url.searchParams.set(
"has_implementation_pr",
diff --git a/products/desktop/packages/shared/src/domain-types.ts b/products/desktop/packages/shared/src/domain-types.ts
index f590e3d13542..52e99f67c7b3 100644
--- a/products/desktop/packages/shared/src/domain-types.ts
+++ b/products/desktop/packages/shared/src/domain-types.ts
@@ -1076,9 +1076,11 @@ export interface SignalReportsQueryParams {
suggested_reviewers?: string;
/** Comma-separated `P0`–`P4` priorities — only returns reports with one of these priorities. */
priority?: string;
+ /** Return the filtered total without fetching or enriching report rows. */
+ count_only?: boolean;
/**
* Filter by whether a shipped implementation pull request exists. `true` keeps only PR
- * reports, `false` only non-PR reports. Pair with `limit: 1` to count PR reports cheaply.
+ * reports, `false` only non-PR reports.
*/
has_implementation_pr?: boolean;
/** A space (task channel) UUID — only returns reports assigned to that space. Omit for the general view, which returns every report. */
diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.test.tsx b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.test.tsx
index 0f033fbbc346..0dd9eea9e350 100644
--- a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.test.tsx
+++ b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.test.tsx
@@ -74,12 +74,27 @@ function fakeServer(params?: SignalReportsQueryParams): SignalReportsResponse {
if (params?.has_implementation_pr === false) {
return { count: REPORT_TAB_TOTAL, results: [] };
}
+ const offset = params?.offset ?? 0;
+ const limit = params?.limit ?? 100;
+ const resultCount = Math.max(0, Math.min(limit, PIPELINE_TOTAL - offset));
return {
count: PIPELINE_TOTAL,
- results: Array.from({ length: 100 }, (_, i) => readyReport(i)),
+ results: Array.from({ length: resultCount }, (_, i) =>
+ readyReport(offset + i),
+ ),
};
}
+function pipelineRequests(): SignalReportsQueryParams[] {
+ const requests: SignalReportsQueryParams[] = [];
+ for (const [params] of mockGetSignalReports.mock.calls) {
+ if (params?.has_implementation_pr == null && params?.count_only == null) {
+ requests.push(params);
+ }
+ }
+ return requests;
+}
+
/** Params of the Reports-count request, or undefined if it was never fired. */
function reportsCountParams(): SignalReportsQueryParams | undefined {
for (const [params] of mockGetSignalReports.mock.calls) {
@@ -121,6 +136,27 @@ describe("useInboxAllReports", () => {
// the Reports tab routes elsewhere, which is what made the badge disagree
// with the list it labels.
expect(reportsCountParams()?.status).toBe("ready");
+ expect(reportsCountParams()?.count_only).toBe(true);
+ });
+
+ it("stitches subsequent pages without gaps or duplicate reports", async () => {
+ const { result } = renderCounts();
+
+ await waitFor(() => {
+ expect(result.current.allReports).toHaveLength(50);
+ });
+
+ await result.current.fetchNextPage();
+
+ await waitFor(() => {
+ expect(result.current.allReports.map((report) => report.id)).toEqual(
+ Array.from({ length: 100 }, (_, index) => `report-${index}`),
+ );
+ });
+ expect(pipelineRequests()).toMatchObject([
+ { limit: 50, offset: 0 },
+ { limit: 50, offset: 50 },
+ ]);
});
it("skips the Reports count query for consumers that only read the pulls badge", async () => {
diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.ts b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.ts
index e46856bd0098..d4b7f7d3b519 100644
--- a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.ts
+++ b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxAllReports.ts
@@ -144,8 +144,8 @@ export function useInboxAllReports(options?: {
// True count of pull-request reports for the active scope. The infinite list
// only holds the first page(s), so deriving pulls from loaded reports caps at
// the page size and depends on ordering (a PR can sit past page 1). A cheap
- // `limit: 1` count query with the server-side `has_implementation_pr` filter
- // returns the real total regardless of page size.
+ // count-only query with the server-side `has_implementation_pr` filter returns
+ // the real total without fetching or enriching a report row.
const pullRequestCountQuery = useInboxReports(
{
status: INBOX_PULL_REQUEST_STATUS_FILTER,
@@ -161,7 +161,7 @@ export function useInboxAllReports(options?: {
suggested_reviewers: reviewerUuid
? buildSuggestedReviewerFilterParam([reviewerUuid])
: undefined,
- limit: 1,
+ count_only: true,
},
{
enabled: enabled && (!isForYou || reviewerUuid != null),
@@ -172,7 +172,7 @@ export function useInboxAllReports(options?: {
const pullRequestTotal = pullRequestCountQuery.data?.count ?? 0;
// True count of Reports-tab reports for the active scope, on the same
- // `limit: 1` pattern as the pull-request count above. Deriving it instead by
+ // count-only pattern as the pull-request count above. Deriving it instead by
// subtracting from the pipeline total only works if every non-report item is
// visible in the loaded pages, and the list is ordered `ready` first, so the
// queued, live and failed runs sit past page 1 and never get subtracted.
@@ -188,7 +188,7 @@ export function useInboxAllReports(options?: {
suggested_reviewers: reviewerUuid
? buildSuggestedReviewerFilterParam([reviewerUuid])
: undefined,
- limit: 1,
+ count_only: true,
},
{
enabled:
diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxDecisionCount.test.tsx b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxDecisionCount.test.tsx
index a3a3c50a7551..fa411e5098a6 100644
--- a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxDecisionCount.test.tsx
+++ b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxDecisionCount.test.tsx
@@ -57,7 +57,7 @@ describe("useInboxDecisionCount", () => {
expect(mockGetSignalReports).toHaveBeenCalledOnce();
expect(mockGetSignalReports).toHaveBeenCalledWith(
expect.objectContaining({
- limit: 1,
+ count_only: true,
priority: undefined,
source_product: undefined,
status: "ready",
diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxDecisionCount.ts b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxDecisionCount.ts
index 4e00c6dfd536..731b4411ef85 100644
--- a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxDecisionCount.ts
+++ b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxDecisionCount.ts
@@ -62,7 +62,7 @@ export function useInboxDecisionCount(options?: {
suggested_reviewers: reviewerUuid
? buildSuggestedReviewerFilterParam([reviewerUuid])
: undefined,
- limit: 1,
+ count_only: true,
},
{
enabled: enabled && scopeReady,
diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxReports.ts b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxReports.ts
index a586eeb5d123..2c7e11383b4b 100644
--- a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxReports.ts
+++ b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxReports.ts
@@ -27,7 +27,7 @@ import type { InfiniteData } from "@tanstack/react-query";
import { useQueryClient } from "@tanstack/react-query";
import { useEffect, useMemo } from "react";
-const REPORTS_PAGE_SIZE = 100;
+const REPORTS_PAGE_SIZE = 50;
export const reportKeys = inboxReportKeys;
diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxSectionCounts.ts b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxSectionCounts.ts
index 05b0108ebdbe..2ad7ed799f9f 100644
--- a/products/desktop/packages/ui/src/features/inbox/hooks/useInboxSectionCounts.ts
+++ b/products/desktop/packages/ui/src/features/inbox/hooks/useInboxSectionCounts.ts
@@ -31,9 +31,9 @@ export interface InboxSectionCounts {
* At this dataset's real size (tens of thousands of live reports in a shared
* project) any count derived from loaded pages is a count of a window, not of
* reality — which is where every badge/section mismatch came from. So each
- * number here is a `limit: 1` count query on the dimensions the API can
- * actually filter server-side (status, PR presence, reviewer scope, source,
- * priority), and the sections are deliberately defined on those dimensions.
+ * number here is a count-only query on the dimensions the API can filter
+ * server-side (status, PR presence, reviewer scope, source, priority), and the
+ * sections are deliberately defined on those dimensions.
*
* Scope and the filter bar's source/priority choices are mirrored into every
* query so the counts move with what the list shows. Search is not — it's a
@@ -71,7 +71,7 @@ export function useInboxSectionCounts(): InboxSectionCounts {
suggested_reviewers: reviewerUuid
? buildSuggestedReviewerFilterParam([reviewerUuid])
: undefined,
- limit: 1,
+ count_only: true,
};
const options = {
// "For you" must carry the user's reviewer filter; hold until it resolves.
diff --git a/products/signals/ARCHITECTURE.md b/products/signals/ARCHITECTURE.md
index 0b31b7eaf093..9860e3d5daca 100644
--- a/products/signals/ARCHITECTURE.md
+++ b/products/signals/ARCHITECTURE.md
@@ -852,7 +852,7 @@ Read + delete + state transitions. Uses `IsAuthenticated` + `APIScopePermission`
| Method | Path | Description |
| ------ | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| GET | `signals/reports/` | List reports. Excludes `deleted` always and excludes `suppressed` by default. Supports `?status=`, `?search=`, `?source_product=`, `?suggested_reviewers=`, `?task_id=` (resolved through `task_run` artefacts), and `?ordering=`. |
+| GET | `signals/reports/` | List reports. Excludes `deleted` always and excludes `suppressed` by default. Supports `?status=`, `?search=`, `?source_product=`, `?suggested_reviewers=`, `?task_id=` (resolved through `task_run` artefacts), and `?ordering=`. Use `?count_only=true` for the filtered total without report rows or metadata enrichment. |
| GET | `signals/reports/{id}/` | Retrieve a single report |
| DELETE | `signals/reports/{id}/` | Soft-delete a report and its signals. Starts `SignalReportDeletionWorkflow`. On success returns `202`. If the workflow is already running, returns `200 {"status": "already_running"}`. The API immediately transitions the Postgres report to `deleted` to hide it from list results while ClickHouse cleanup runs asynchronously. |
| POST | `signals/reports/{id}/state/` | Transition report state. Body: `{ "state": "suppressed" \| "potential" \| "resolved", ...transition_to kwargs }`. `suppressed`, `potential`, and `resolved` are exposed via API (`resolved` for user-driven "work is done"; the model still gates which statuses may resolve). Returns `409` on invalid transitions and `400` on invalid arguments. |
diff --git a/products/signals/backend/signal_metadata.py b/products/signals/backend/signal_metadata.py
index 66f84246d76d..46189e9548c4 100644
--- a/products/signals/backend/signal_metadata.py
+++ b/products/signals/backend/signal_metadata.py
@@ -13,6 +13,8 @@ from dataclasses import dataclass
from posthog.schema import EmbeddingModelName
from posthog.hogql import ast
+from posthog.hogql.context import HogQLContext
+from posthog.hogql.database.database import Database
from posthog.hogql.query import execute_hogql_query
from posthog.clickhouse.query_tagging import Feature, Product, tag_queries
@@ -31,6 +33,12 @@ SIGNAL_DOCUMENT_TYPE = "signal"
SIGNAL_DOCUMENT_RENDERING = "plain"
+def _signals_query_context(team: Team) -> HogQLContext:
+ # These internal queries only use the static document_embeddings table. Supplying that catalog
+ # avoids loading every team-specific warehouse table before each synchronous inbox query.
+ return HogQLContext(team=team, database=Database(), restricted_properties=set())
+
+
def _deduped_signals_subquery(
*,
include_embedding: bool = False,
@@ -188,6 +196,7 @@ def fetch_source_products_for_reports(team: Team, report_ids: list[str]) -> dict
query_type="SignalsFetchSourceProductsForReports",
query=ch_query,
team=team,
+ context=_signals_query_context(team),
placeholders={
"model_name": ast.Constant(value=EMBEDDING_MODEL.value),
"report_ids": ast.Tuple(exprs=[ast.Constant(value=rid) for rid in report_ids]),
diff --git a/products/signals/backend/test/test_signal_queries.py b/products/signals/backend/test/test_signal_queries.py
index 9c254016736f..33027cc13c8a 100644
--- a/products/signals/backend/test/test_signal_queries.py
+++ b/products/signals/backend/test/test_signal_queries.py
@@ -4,7 +4,7 @@ import json
import uuid
from datetime import UTC, datetime, timedelta
-from posthog.test.base import APIBaseTest, ClickhouseTestMixin
+from posthog.test.base import APIBaseTest, ClickhouseTestMixin, FuzzyInt
from unittest.mock import patch
from parameterized import parameterized
@@ -109,7 +109,8 @@ class TestFetchSourceProductsForReports(_SignalEmbeddingsTestBase):
self._emit_version(document_id="d3", report_id="rA", source_product="errors", inserted_at=self.base)
self._emit_version(document_id="d4", report_id="rB", source_product="surveys", inserted_at=self.base)
- result = fetch_source_products_for_reports(self.team, ["rA", "rB"])
+ with self.assertNumQueries(FuzzyInt(0, 1)):
+ result = fetch_source_products_for_reports(self.team, ["rA", "rB"])
assert result == {
"rA": ReportSignalMeta(source_products=["errors", "replay"], scout_name=None),
diff --git a/products/signals/backend/test/test_signal_report_api.py b/products/signals/backend/test/test_signal_report_api.py
index cf10e80c6f57..fed29d37cba5 100644
--- a/products/signals/backend/test/test_signal_report_api.py
+++ b/products/signals/backend/test/test_signal_report_api.py
@@ -11,6 +11,7 @@ from unittest.mock import patch
from django.apps import apps
from django.core.cache import cache
from django.db import connection
+from django.test import SimpleTestCase
from django.test.utils import CaptureQueriesContext
from django.utils import timezone
@@ -47,6 +48,7 @@ from products.signals.backend.task_run_artefacts import (
record_implementation_task,
record_report_task,
)
+from products.signals.backend.views import classify_report_list_client
from products.tasks.backend.facade.api import Channel
if TYPE_CHECKING:
@@ -70,6 +72,18 @@ def authenticate_as_sandbox_token(test: APIBaseTest) -> None:
test.client.credentials(HTTP_AUTHORIZATION=f"Bearer {token}")
+class TestReportListClientClassification(SimpleTestCase):
+ @parameterized.expand(
+ [
+ ("desktop", "posthog/desktop.hog.dev; version: 0.61.84", "desktop"),
+ ("web", "Mozilla/5.0 AppleWebKit/537.36 Chrome/140.0.0.0", "web"),
+ ("other", "PostmanRuntime/7.45.0", "other"),
+ ]
+ )
+ def test_classifies_user_agent(self, _name: str, user_agent: str, expected: str) -> None:
+ assert classify_report_list_client(user_agent) == expected
+
+
class TestSignalReportDeleteAPI(APIBaseTest):
def _url(self, report_id: str | None = None) -> str:
base = f"/api/projects/{self.team.id}/signals/reports/"
@@ -980,6 +994,25 @@ class TestSignalReportListAPI(APIBaseTest):
assert body["count"] == 3
assert len(body["results"]) == 1
+ def test_filter_has_implementation_pr_count_only_skips_report_enrichment(self):
+ for i in range(3):
+ report = self._create_report(title=f"PR report {i}")
+ self._create_implementation_task_with_run(report, pr_url=f"https://github.com/org/repo/pull/{i}")
+ self._create_report(title="No PR report")
+
+ with (
+ patch("products.signals.backend.views.fetch_source_products_for_reports") as fetch_source_products,
+ patch(
+ "products.signals.backend.views.fetch_implementation_pr_state_for_reports"
+ ) as fetch_implementation_prs,
+ ):
+ response = self.client.get(self._list_url(has_implementation_pr="true", count_only="true"))
+
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json() == {"count": 3, "next": None, "previous": None, "results": []}
+ fetch_source_products.assert_not_called()
+ fetch_implementation_prs.assert_not_called()
+
def test_filter_has_implementation_pr_empty_value_is_noop(self):
report_with_pr = self._create_report(title="Report with PR")
report_without_pr = self._create_report(title="Report without PR")
diff --git a/products/signals/backend/views.py b/products/signals/backend/views.py
index c1440c54fb8a..a6ddd39316cb 100644
--- a/products/signals/backend/views.py
+++ b/products/signals/backend/views.py
@@ -180,6 +180,14 @@ REVIEWER_PAGINATION_THRESHOLD = 1200
PR_GITHUB_CACHE_SECONDS = 15
+def classify_report_list_client(user_agent: str | None) -> str:
+ if user_agent and user_agent.startswith("posthog/desktop.hog.dev;"):
+ return "desktop"
+ if user_agent and user_agent.startswith("Mozilla/"):
+ return "web"
+ return "other"
+
+
class EmitSignalSerializer(serializers.Serializer):
source_product = serializers.CharField(max_length=100)
source_type = serializers.CharField(max_length=100)
@@ -931,6 +939,17 @@ class SignalReportViewSet(
return False
raise serializers.ValidationError({"include_all_statuses": f"Invalid value: {raw!r}. Allowed: true, false."})
+ def _count_only_requested(self) -> bool:
+ raw = self.request.query_params.get("count_only")
+ 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({"count_only": f"Invalid value: {raw!r}. Allowed: true, false."})
+
def _apply_signal_report_search_filter(self, queryset):
search = self.request.query_params.get("search")
if not search:
@@ -1584,7 +1603,17 @@ class SignalReportViewSet(
description=(
"Filter reports by whether a shipped implementation pull request exists. "
"'true' keeps only reports with a PR; 'false' keeps only those without. "
- "Pair with limit=1 to count PR reports cheaply."
+ "Pair with count_only=true to return only the filtered total."
+ ),
+ ),
+ 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."
),
),
],
@@ -1594,13 +1623,41 @@ class SignalReportViewSet(
# 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()
+ 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)
+
with tracer.start_as_current_span("signals.reports.list.queryset"):
queryset = self.filter_queryset(self.get_queryset())
- page = self.paginate_queryset(queryset)
- reports = list(page if page is not None else queryset)
+ if count_only:
+ total_count = queryset.count()
+ else:
+ page = self.paginate_queryset(queryset)
+ reports = list(page if page is not None else queryset)
+
+ if count_only:
+ list_span.set_attribute("signals.reports.list.total_count", total_count)
+ return Response({"count": total_count, "next": None, "previous": None, "results": []})
report_ids = [str(r.id) for r in reports]
- trace.get_current_span().set_attribute("signals.reports.list.count", len(report_ids))
+ list_span.set_attribute("signals.reports.list.count", len(report_ids))
+ if page is not None:
+ page_limit = getattr(self.paginator, "limit", None)
+ page_offset = getattr(self.paginator, "offset", None)
+ total_count = getattr(self.paginator, "count", None)
+ if isinstance(page_limit, int):
+ list_span.set_attribute("signals.reports.list.page_limit", page_limit)
+ if isinstance(page_offset, int):
+ list_span.set_attribute("signals.reports.list.page_offset", page_offset)
+ if isinstance(total_count, int):
+ list_span.set_attribute("signals.reports.list.total_count", total_count)
+ if isinstance(page_offset, int):
+ list_span.set_attribute(
+ "signals.reports.list.has_next_page", page_offset + len(report_ids) < total_count
+ )
# Both lookups are best-effort decorative metadata (source-product badges, scout names, PR
# urls). The serializer degrades to empty values when a map is missing, so a ClickHouse or
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index fc7fcc85c0b4..20d523781b49 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -4108,7 +4108,11 @@ export type SignalsReportsListParams = {
*/
channel_id?: string
/**
- * Filter reports by whether a shipped implementation pull request exists. 'true' keeps only reports with a PR; 'false' keeps only those without. Pair with limit=1 to count PR reports cheaply.
+ * Return the filtered total with an empty results page. Skips report ordering, serialization, and decorative metadata lookups. Defaults to false.
+ */
+ count_only?: boolean
+ /**
+ * Filter reports by whether a shipped implementation pull request exists. 'true' keeps only reports with a PR; 'false' keeps only those without. Pair with count_only=true to return only the filtered total.
*/
has_implementation_pr?: boolean
/**
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index ed6ef5531744..0e42d3ff4411 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -97223,7 +97223,11 @@ export namespace Schemas {
*/
channel_id?: string;
/**
- * Filter reports by whether a shipped implementation pull request exists. 'true' keeps only reports with a PR; 'false' keeps only those without. Pair with limit=1 to count PR reports cheaply.
+ * Return the filtered total with an empty results page. Skips report ordering, serialization, and decorative metadata lookups. Defaults to false.
+ */
+ count_only?: boolean;
+ /**
+ * Filter reports by whether a shipped implementation pull request exists. 'true' keeps only reports with a PR; 'false' keeps only those without. Pair with count_only=true to return only the filtered total.
*/
has_implementation_pr?: boolean;
/**
diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.ts
index 280900975a90..21d5dc26eca9 100644
--- a/services/mcp/src/generated/signals/api.ts
+++ b/services/mcp/src/generated/signals/api.ts
@@ -23,11 +23,17 @@ export const SignalsReportsListQueryParams = /* @__PURE__ */ zod.object({
.describe(
'Narrow to reports assigned to one space (channel). Absent or empty means all reports regardless of assignment.'
),
+ count_only: zod
+ .boolean()
+ .optional()
+ .describe(
+ 'Return the filtered total with an empty results page. Skips report ordering, serialization, and decorative metadata lookups. Defaults to false.'
+ ),
has_implementation_pr: zod
.boolean()
.optional()
.describe(
- "Filter reports by whether a shipped implementation pull request exists. 'true' keeps only reports with a PR; 'false' keeps only those without. Pair with limit=1 to count PR reports cheaply."
+ "Filter reports by whether a shipped implementation pull request exists. 'true' keeps only reports with a PR; 'false' keeps only those without. Pair with count_only=true to return only the filtered total."
),
include_all_statuses: zod
.boolean()
diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.ts
index 8f6ee5766fe7..c24609c841cb 100644
--- a/services/mcp/src/tools/generated/signals.ts
+++ b/services/mcp/src/tools/generated/signals.ts
@@ -232,6 +232,7 @@ const inboxReportsList = (): ToolBase<
path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/reports/`,
query: {
channel_id: params.channel_id,
+ count_only: params.count_only,
has_implementation_pr: params.has_implementation_pr,
include_all_statuses: params.include_all_statuses,
limit: params.limit,
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 25fd5bcc9ab6..d6ba9dfc75bf 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
@@ -5,8 +5,12 @@
"description": "Narrow to reports assigned to one space (channel). Absent or empty means all reports regardless of assignment.",
"type": "string"
},
+ "count_only": {
+ "description": "Return the filtered total with an empty results page. Skips report ordering, serialization, and decorative metadata lookups. Defaults to false.",
+ "type": "boolean"
+ },
"has_implementation_pr": {
- "description": "Filter reports by whether a shipped implementation pull request exists. 'true' keeps only reports with a PR; 'false' keeps only those without. Pair with limit=1 to count PR reports cheaply.",
+ "description": "Filter reports by whether a shipped implementation pull request exists. 'true' keeps only reports with a PR; 'false' keeps only those without. Pair with count_only=true to return only the filtered total.",
"type": "boolean"
},
"include_all_statuses": {