: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(signals): filter inbox reports by scout name (#73022)
Andrew Maguire784987b8b860
diff --git a/frontend/src/scenes/inbox/components/shell/InboxSearchFilterBar.tsx b/frontend/src/scenes/inbox/components/shell/InboxSearchFilterBar.tsxindex a1c9920ee487..6fe63cf96ff4 100644--- a/frontend/src/scenes/inbox/components/shell/InboxSearchFilterBar.tsx+++ b/frontend/src/scenes/inbox/components/shell/InboxSearchFilterBar.tsx@@ -1,5 +1,5 @@import { useActions, useValues } from 'kea'-import { useState } from 'react'+import { useEffect, useState } from 'react'import { IconCheck, IconChevronDown, IconFlag, IconRefresh, IconSearch, IconSort, IconTarget } from '@posthog/icons'import { LemonButton, LemonDropdown, LemonInput } from '@posthog/lemon-ui'@@ -15,6 +15,8 @@ import {inboxSourceFilterLabel,} from '../../filterOptions'import { inboxFiltersLogic } from '../../logics/inboxFiltersLogic'+import { scoutFleetLogic } from '../../logics/scoutFleetLogic'+import { prettifyScoutSkillName } from '../../utils/scoutRunsWindow'/** A single filter trigger + dropdown overlay, matching desktop's `InboxFilterPopover`. */function FilterPopover({@@ -88,6 +90,57 @@ function FilterItem({)}+/**+ * Collapsible per-scout sub-filter nested under the "Scout" source row. Collapsed by default+ * (fleets can be large); auto-expanded while any scout is selected so active filters stay visible.+ */+function ScoutSubFilter({+ scoutNames,+ scoutFilter,+ onToggle,+}: {+ scoutNames: string[]+ scoutFilter: string[]+ onToggle: (scout: string) => void+}): JSX.Element {+ const [expanded, setExpanded] = useState(scoutFilter.length > 0)+ // Auto-expand whenever a scout selection appears — including URL navigation or persisted-state+ // hydration into an already-mounted popover — so active filters stay visible. Still collapsible+ // by hand once no scout is selected.+ useEffect(() => {+ if (scoutFilter.length > 0) {+ setExpanded(true)+ }+ }, [scoutFilter.length])+ return (+ <div className="pl-5">+ <button+ type="button"+ onClick={() => setExpanded(!expanded)}+ className="flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs text-muted transition-colors hover:bg-surface-secondary"+ >+ <IconChevronDown className={`shrink-0 text-sm transition-transform ${expanded ? '' : '-rotate-90'}`} />+ <span>+ Filter by scout+ {scoutFilter.length > 0 && <span className="text-default"> · {scoutFilter.length}</span>}+ </span>+ </button>+ {expanded && (+ <div className="max-h-48 overflow-y-auto deprecated-space-y-px">+ {scoutNames.map((skillName) => (+ <FilterItem+ key={skillName}+ label={prettifyScoutSkillName(skillName)}+ active={scoutFilter.includes(skillName)}+ onClick={() => onToggle(skillName)}+ />+ ))}+ </div>+ )}+ </div>+ )+}+interface InboxSearchFilterBarProps {searchPlaceholder?: string/** Triggers a reload of the report list (lives on `inboxSceneLogic`). */@@ -107,12 +160,19 @@ export function InboxSearchFilterBar({onRefresh,refreshing,}: InboxSearchFilterBarProps): JSX.Element {- const { searchQuery, sortField, sortDirection, sourceProductFilter, priorityFilter } = useValues(inboxFiltersLogic)- const { setSearchQuery, setSort, toggleSourceProduct, togglePriority } = useActions(inboxFiltersLogic)+ const { searchQuery, sortField, sortDirection, sourceProductFilter, scoutFilter, priorityFilter } =+ useValues(inboxFiltersLogic)+ const { setSearchQuery, setSort, toggleSourceProduct, toggleScout, togglePriority } = useActions(inboxFiltersLogic)+ const { scoutConfigs } = useValues(scoutFleetLogic)const activeSort = INBOX_SORT_OPTIONS.find((o) => o.field === sortField && o.direction === sortDirection)const activeSortKey = inboxSortOptionKey(sortField, sortDirection)+ // Selected scouts always stay listed (even if their config was since deleted) so they can be untoggled.+ const scoutNames = [...new Set([...(scoutConfigs ?? []).map((c) => c.skill_name), ...scoutFilter])].sort((a, b) =>+ prettifyScoutSkillName(a).localeCompare(prettifyScoutSkillName(b))+ )+return (<div className="flex items-center gap-2 flex-wrap w-full"><LemonInput@@ -148,18 +208,26 @@ export function InboxSearchFilterBar({<FilterPopoverlabel="Source"- value={inboxSourceFilterLabel(sourceProductFilter)}+ value={inboxSourceFilterLabel(sourceProductFilter, scoutFilter)}icon={<IconTarget />}- active={sourceProductFilter.length > 0}+ active={sourceProductFilter.length > 0 || scoutFilter.length > 0}>{INBOX_SOURCE_OPTIONS.map((option) => (- <FilterItem- key={option.value}- icon={option.icon}- label={option.label}- active={sourceProductFilter.includes(option.value)}- onClick={() => toggleSourceProduct(option.value)}- />+ <div key={option.value}>+ <FilterItem+ icon={option.icon}+ label={option.label}+ active={sourceProductFilter.includes(option.value)}+ onClick={() => toggleSourceProduct(option.value)}+ />+ {option.value === 'signals_scout' && scoutNames.length > 0 && (+ <ScoutSubFilter+ scoutNames={scoutNames}+ scoutFilter={scoutFilter}+ onToggle={toggleScout}+ />+ )}+ </div>))}</FilterPopover>diff --git a/frontend/src/scenes/inbox/filterOptions.tsx b/frontend/src/scenes/inbox/filterOptions.tsxindex d438f038a7b2..b55de4085900 100644--- a/frontend/src/scenes/inbox/filterOptions.tsx+++ b/frontend/src/scenes/inbox/filterOptions.tsx@@ -21,6 +21,7 @@ import { LemonTagType } from '@posthog/lemon-ui'import type { InboxSortDirection, InboxSortField } from './logics/inboxFiltersLogic'import { SignalReportPriority } from './types'+import { prettifyScoutSkillName } from './utils/scoutRunsWindow'/*** Single source of truth for per-priority color. P0–P4 each get a DISTINCT hue so@@ -107,12 +108,19 @@ export function inboxPriorityFilterLabel(selected: SignalReportPriority[]): strireturn [...selected].sort().join(', ')}-export function inboxSourceFilterLabel(selected: string[]): string {- if (selected.length === 0) {- return 'All sources'- }+export function inboxSourceFilterLabel(selected: string[], selectedScouts: string[] = []): string {+ const parts: string[] = []if (selected.length === 1) {- return INBOX_SOURCE_OPTIONS.find((o) => o.value === selected[0])?.label ?? selected[0]+ parts.push(INBOX_SOURCE_OPTIONS.find((o) => o.value === selected[0])?.label ?? selected[0])+ } else if (selected.length > 1) {+ parts.push(`${selected.length} sources`)+ }+ if (selectedScouts.length === 1) {+ // "Scout · " disambiguates from same-named source products (e.g. the error tracking+ // scout vs the error tracking source), matching the report rows' attribution label.+ parts.push(`Scout · ${prettifyScoutSkillName(selectedScouts[0])}`)+ } else if (selectedScouts.length > 1) {+ parts.push(`${selectedScouts.length} scouts`)}- return `${selected.length} sources`+ return parts.length > 0 ? parts.join(' · ') : 'All sources'}diff --git a/frontend/src/scenes/inbox/logics/inboxFiltersLogic.test.ts b/frontend/src/scenes/inbox/logics/inboxFiltersLogic.test.tsindex b54b78a250e6..ecc3e95c7f48 100644--- a/frontend/src/scenes/inbox/logics/inboxFiltersLogic.test.ts+++ b/frontend/src/scenes/inbox/logics/inboxFiltersLogic.test.ts@@ -8,6 +8,7 @@ import {const DEFAULT_STATE: InboxFilterState = {scope: 'for-you',sourceProductFilter: [],+ scoutFilter: [],priorityFilter: [],sortField: 'priority',sortDirection: 'asc',@@ -42,10 +43,13 @@ describe('inboxFiltersLogic', () => {it.each<[string, InboxFilterState, Record<string, string>]>([[- 'scope + sources + priorities + custom sort + search',+ 'scope + sources + scouts + priorities + custom sort + search',{scope: 'entire-project',sourceProductFilter: ['error_tracking', 'github'],+ // Scout slugs are team-specific and dynamic, so they round-trip without a+ // static valid-set check — unlike sources.+ scoutFilter: ['signals-scout-error-tracking', 'my-custom-scout'],priorityFilter: ['P0', 'P2'],sortField: 'created_at',sortDirection: 'desc',@@ -54,6 +58,7 @@ describe('inboxFiltersLogic', () => {{scope: 'entire-project',source: 'error_tracking,github',+ scout: 'signals-scout-error-tracking,my-custom-scout',priority: 'P0,P2',sort: 'created_at:desc',search: 'checkout crash',diff --git a/frontend/src/scenes/inbox/logics/inboxFiltersLogic.ts b/frontend/src/scenes/inbox/logics/inboxFiltersLogic.tsindex a34a9b3556e3..a6c097d2a0ec 100644--- a/frontend/src/scenes/inbox/logics/inboxFiltersLogic.ts+++ b/frontend/src/scenes/inbox/logics/inboxFiltersLogic.ts@@ -23,7 +23,7 @@ const DEFAULT_SORT_FIELD: InboxSortField = 'priority'const DEFAULT_SORT_DIRECTION: InboxSortDirection = 'asc'// Query-param keys that mirror the filter state so a view can be shared via URL.-const FILTER_URL_KEYS = ['scope', 'source', 'priority', 'sort', 'search'] as const+const FILTER_URL_KEYS = ['scope', 'source', 'scout', 'priority', 'sort', 'search'] as constconst VALID_SOURCE_VALUES = new Set(INBOX_SOURCE_OPTIONS.map((o) => o.value))const VALID_PRIORITIES = new Set<string>(INBOX_PRIORITY_OPTIONS)@@ -34,6 +34,7 @@ const VALID_SORT_KEYS = new Set(INBOX_SORT_OPTIONS.map((o) => `${o.field}:${o.diexport interface InboxFilterState {scope: InboxScopesourceProductFilter: string[]+ scoutFilter: string[]priorityFilter: SignalReportPriority[]sortField: InboxSortFieldsortDirection: InboxSortDirection@@ -61,6 +62,19 @@ function parseListParam(raw: unknown, valid: Set<string>): string[] {return raw.split(',').filter((v) => valid.has(v))}+// Scout skill names are team-specific and dynamic, so there is no static valid set to check a+// shared link against — accept any non-empty comma-separated slugs; an unknown scout simply+// matches no reports server-side.+function parseScoutParam(raw: unknown): string[] {+ if (typeof raw !== 'string' || raw.length === 0) {+ return []+ }+ return raw+ .split(',')+ .map((v) => v.trim())+ .filter((v) => v.length > 0)+}+/** Decode the filter query params into filter state, ignoring unknown/invalid values and falling back to defaults. */export function parseFilterSearchParams(searchParams: Record<string, any>): InboxFilterState {let sortField = DEFAULT_SORT_FIELD@@ -73,6 +87,7 @@ export function parseFilterSearchParams(searchParams: Record<string, any>): Inboreturn {scope: parseScopeParam(searchParams.scope),sourceProductFilter: parseListParam(searchParams.source, VALID_SOURCE_VALUES),+ scoutFilter: parseScoutParam(searchParams.scout),priorityFilter: parseListParam(searchParams.priority, VALID_PRIORITIES) as SignalReportPriority[],sortField,sortDirection,@@ -93,6 +108,9 @@ export function filterSearchParams(values: InboxFilterState): Record<string, strif (values.sourceProductFilter.length > 0) {params.source = values.sourceProductFilter.join(',')}+ if (values.scoutFilter.length > 0) {+ params.scout = values.scoutFilter.join(',')+ }if (values.priorityFilter.length > 0) {params.priority = values.priorityFilter.join(',')}@@ -149,6 +167,7 @@ export interface inboxFiltersLogicValues {hasUserChosenScope: booleanpriorityFilter: SignalReportPriority[]scope: InboxScope+ scoutFilter: string[]searchQuery: stringsortDirection: InboxSortDirectionsortField: InboxSortField@@ -214,6 +233,9 @@ export interface inboxFiltersLogicActions {togglePriority: (priority: SignalReportPriority) => {priority: SignalReportPriority}+ toggleScout: (scout: string) => {+ scout: string+ }toggleSourceProduct: (source: string) => {source: string}@@ -225,6 +247,7 @@ export interface inboxFiltersLogicMeta {hasActiveFilters: (searchQuery: string,sourceProductFilter: string[],+ scoutFilter: string[],priorityFilter: SignalReportPriority[]) => boolean}@@ -263,6 +286,7 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([setSearchQuery: (searchQuery: string) => ({ searchQuery }),setSort: (field: InboxSortField, direction: InboxSortDirection) => ({ field, direction }),toggleSourceProduct: (source: string) => ({ source }),+ toggleScout: (scout: string) => ({ scout }),togglePriority: (priority: SignalReportPriority) => ({ priority }),// Atomically apply a full filter set. Used when hydrating from a shared URL so the whole view// is restored in one action — one list refresh, no fan-out race between partial states.@@ -350,6 +374,18 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([clearFilters: () => [],},],+ // Raw scout skill_name slugs (e.g. "signals-scout-error-tracking") — a sub-filter of the+ // Scout source, narrowing to reports authored by specific scouts.+ scoutFilter: [+ [] as string[],+ { persist: true },+ {+ toggleScout: (state, { scout }) =>+ state.includes(scout) ? state.filter((s) => s !== scout) : [...state, scout],+ setFilters: (_, { filters }) => filters.scoutFilter,+ clearFilters: () => [],+ },+ ],priorityFilter: [[] as SignalReportPriority[],{ persist: true },@@ -366,9 +402,17 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([// Whether any list-narrowing filter is active. Scope and sort are excluded: they don't hide// reports the way search/source/priority do, and `clearFilters` leaves them untouched.hasActiveFilters: [- (s) => [s.searchQuery, s.sourceProductFilter, s.priorityFilter],- (searchQuery: string, sourceProductFilter: string[], priorityFilter: SignalReportPriority[]): boolean =>- searchQuery.trim().length > 0 || sourceProductFilter.length > 0 || priorityFilter.length > 0,+ (s) => [s.searchQuery, s.sourceProductFilter, s.scoutFilter, s.priorityFilter],+ (+ searchQuery: string,+ sourceProductFilter: string[],+ scoutFilter: string[],+ priorityFilter: SignalReportPriority[]+ ): boolean =>+ searchQuery.trim().length > 0 ||+ sourceProductFilter.length > 0 ||+ scoutFilter.length > 0 ||+ priorityFilter.length > 0,],}),@@ -382,6 +426,7 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([applyDefaultScope: toUrl,setSort: toUrl,toggleSourceProduct: toUrl,+ toggleScout: toUrl,togglePriority: toUrl,setSearchQuery: toUrl,clearFilters: toUrl,@@ -412,6 +457,7 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([const changed =values.scope !== parsed.scope ||!sameSet(values.sourceProductFilter, parsed.sourceProductFilter) ||+ !sameSet(values.scoutFilter, parsed.scoutFilter) ||!sameSet(values.priorityFilter, parsed.priorityFilter) ||values.sortField !== parsed.sortField ||values.sortDirection !== parsed.sortDirection ||diff --git a/frontend/src/scenes/inbox/logics/reportListLogic.ts b/frontend/src/scenes/inbox/logics/reportListLogic.tsindex 5028342495dc..1bc59ab1940f 100644--- a/frontend/src/scenes/inbox/logics/reportListLogic.ts+++ b/frontend/src/scenes/inbox/logics/reportListLogic.ts@@ -65,6 +65,7 @@ function requestContextFromValues(values: {scope: InboxScopesearchQuery: stringsourceProductFilter: string[]+ scoutFilter: string[]priorityFilter: SignalReportPriority[]}): { scope: InboxScope; hasActiveFilters: boolean } {return {@@ -72,6 +73,7 @@ function requestContextFromValues(values: {hasActiveFilters:values.searchQuery.trim().length > 0 ||values.sourceProductFilter.length > 0 ||+ values.scoutFilter.length > 0 ||values.priorityFilter.length > 0,}}@@ -104,6 +106,7 @@ export interface reportListLogicValues {hasUserChosenScope: boolean // inboxFiltersLogicpriorityFilter: SignalReportPriority[] // inboxFiltersLogicscope: InboxScope // inboxFiltersLogic+ scoutFilter: string[] // inboxFiltersLogicsearchQuery: string // inboxFiltersLogicsortDirection: InboxSortDirection // inboxFiltersLogicsortField: InboxSortField // inboxFiltersLogic@@ -152,6 +155,9 @@ export interface reportListLogicActions {togglePriority: (priority: SignalReportPriority) => {priority: SignalReportPriority} // inboxFiltersLogic+ toggleScout: (scout: string) => {+ scout: string+ } // inboxFiltersLogictoggleSourceProduct: (source: string) => {source: string} // inboxFiltersLogic@@ -241,6 +247,7 @@ export interface reportListLogicMeta {sortField: InboxSortField,sortDirection: InboxSortDirection,sourceProductFilter: string[],+ scoutFilter: string[],priorityFilter: SignalReportPriority[],scope: InboxScope,user: UserType | null,@@ -289,6 +296,7 @@ export const reportListLogic = kea<reportListLogicType>(['sortField','sortDirection','sourceProductFilter',+ 'scoutFilter','priorityFilter',],userLogic,@@ -300,6 +308,7 @@ export const reportListLogic = kea<reportListLogicType>(['setSearchQuery','setSort','toggleSourceProduct',+ 'toggleScout','togglePriority','setScope','applyDefaultScope',@@ -386,6 +395,7 @@ export const reportListLogic = kea<reportListLogicType>([s.sortField,s.sortDirection,s.sourceProductFilter,+ s.scoutFilter,s.priorityFilter,s.scope,s.user,@@ -396,6 +406,7 @@ export const reportListLogic = kea<reportListLogicType>([sortField: import('./inboxFiltersLogic').InboxSortField,sortDirection: import('./inboxFiltersLogic').InboxSortDirection,sourceProductFilter: string[],+ scoutFilter: string[],priorityFilter: import('../types').SignalReportPriority[],scope: InboxScope,user: null | import('../../../types').UserType,@@ -408,6 +419,7 @@ export const reportListLogic = kea<reportListLogicType>([search: searchQuery.trim() || undefined,ordering: buildSignalReportListOrdering(sortField, sortDirection),source_product: sourceProductFilter.length > 0 ? sourceProductFilter.join(',') : undefined,+ scout: scoutFilter.length > 0 ? scoutFilter.join(',') : undefined,priority: priorityFilter.length > 0 ? priorityFilter.join(',') : undefined,suggested_reviewers: suggestedReviewer,}@@ -491,6 +503,7 @@ export const reportListLogic = kea<reportListLogicType>([},setSort: () => actions.refresh(),toggleSourceProduct: () => actions.refresh(),+ toggleScout: () => actions.refresh(),togglePriority: () => actions.refresh(),setScope: () => actions.refresh(),applyDefaultScope: () => actions.refresh(),diff --git a/products/signals/backend/temporal/signal_queries.py b/products/signals/backend/temporal/signal_queries.pyindex f209be0b9ece..6719f04a84d8 100644--- a/products/signals/backend/temporal/signal_queries.py+++ b/products/signals/backend/temporal/signal_queries.py@@ -566,14 +566,21 @@ def fetch_signals_for_report_sync(team: Team, report_id: str) -> list[dict]:# fetch_report_ids_for_source_products — synchronous, for the viewset list filter# ---------------------------------------------------------------------------+# Bounds the report-id set handed to the Django `id__in` inbox filters (source/scout). The cap is+# applied after a deterministic `ORDER BY max(timestamp) DESC`, so it keeps the most-recently-active+# matching reports and the same set across list/count calls.+_REPORT_ID_FILTER_CAP = 300+def fetch_report_ids_for_source_products(team: Team, source_products: list[str]) -> set[str]:"""Return the set of report IDs that have at least one non-deleted signal from the given source products.Uses argMax deduplication to give stable results regardless of ReplacingMergeTree merge state.+ Capped at `_REPORT_ID_FILTER_CAP` most-recently-active matching reports after a deterministic+ `ORDER BY` so the list and count requests that both call this see the identical truncated set."""ch_query = f"""- SELECT DISTINCT report_id+ SELECT report_idFROM (SELECTJSONExtractString(metadata, 'report_id') as report_id,@@ -581,12 +588,13 @@ def fetch_report_ids_for_source_products(team: Team, source_products: list[str])JSONExtractString(metadata, 'source_product') as source_product,timestampFROM ({_deduped_signals_subquery()})- ORDER BY timestamp DESC)WHERE NOT is_deletedAND report_id != ''AND source_product IN ({{source_products}})- LIMIT 300+ GROUP BY report_id+ ORDER BY max(timestamp) DESC+ LIMIT {_REPORT_ID_FILTER_CAP}"""tag_queries(product=Product.SIGNALS, feature=Feature.QUERY)@@ -603,6 +611,56 @@ def fetch_report_ids_for_source_products(team: Team, source_products: list[str])return {row[0] for row in (result.results or []) if row[0]}+# ---------------------------------------------------------------------------+# fetch_report_ids_for_scout_names — synchronous, for the viewset list filter+# ---------------------------------------------------------------------------+++def fetch_report_ids_for_scout_names(team: Team, scout_names: list[str]) -> set[str]:+ """Return the set of report IDs that have at least one non-deleted signal authored by the given scouts.++ Scout-emitted signals carry the authoring scout's raw skill_name slug (e.g.+ "signals-scout-error-tracking") in `extra.skill_name`; other sources leave it empty, so+ matching on it alone is already scoped to scout signals. Uses argMax deduplication to give+ stable results regardless of ReplacingMergeTree merge state.++ Capped at `_REPORT_ID_FILTER_CAP` most-recently-active matching reports (by newest signal+ timestamp). The cap is applied after a deterministic `ORDER BY` so the list and count requests+ that both call this see the identical set — without the ordering the truncated set could differ+ between calls, flickering reports in and out across refreshes.+ """+ ch_query = f"""+ SELECT report_id+ FROM (+ SELECT+ JSONExtractString(metadata, 'report_id') as report_id,+ JSONExtractBool(metadata, 'deleted') as is_deleted,+ JSONExtractString(metadata, 'extra', 'skill_name') as skill_name,+ timestamp+ FROM ({_deduped_signals_subquery()})+ )+ WHERE NOT is_deleted+ AND report_id != ''+ AND skill_name IN ({{scout_names}})+ GROUP BY report_id+ ORDER BY max(timestamp) DESC+ LIMIT {_REPORT_ID_FILTER_CAP}+ """++ tag_queries(product=Product.SIGNALS, feature=Feature.QUERY)+ result = execute_hogql_query(+ query_type="SignalsFilterByScoutName",+ query=ch_query,+ team=team,+ placeholders={+ "model_name": ast.Constant(value=EMBEDDING_MODEL.value),+ "scout_names": ast.Tuple(exprs=[ast.Constant(value=name) for name in scout_names]),+ },+ )++ return {row[0] for row in (result.results or []) if row[0]}++# ---------------------------------------------------------------------------# fetch_report_ids_for_source_ids — synchronous, for the scout reverse lookup# ---------------------------------------------------------------------------diff --git a/products/signals/backend/test/test_signal_queries.py b/products/signals/backend/test/test_signal_queries.pyindex 346ab9ef2600..40d653b78dab 100644--- a/products/signals/backend/test/test_signal_queries.py+++ b/products/signals/backend/test/test_signal_queries.py@@ -14,7 +14,10 @@ from products.signals.backend.signal_metadata import (ReportSignalMeta,fetch_source_products_for_reports,)-from products.signals.backend.temporal.signal_queries import fetch_signals_for_report_sync+from products.signals.backend.temporal.signal_queries import (+ fetch_report_ids_for_scout_names,+ fetch_signals_for_report_sync,+)_MODEL_TABLE = f"distributed_posthog_document_embeddings_{EMBEDDING_MODEL.value.replace('-', '_')}"_EMBEDDING = [0.0] * 1536@@ -181,6 +184,52 @@ class TestFetchSourceProductsForReports(_SignalEmbeddingsTestBase):assert fetch_source_products_for_reports(self.team, report_ids) == expected+class TestFetchReportIdsForScoutNames(_SignalEmbeddingsTestBase):+ def test_returns_only_reports_authored_by_the_named_scouts(self) -> None:+ # Guards the nested `extra.skill_name` extraction driving the inbox scout filter — a broken+ # JSON path would silently match nothing and the filter would empty every filtered view.+ self._emit_version(+ document_id="d1",+ report_id="rErrors",+ source_product="signals_scout",+ inserted_at=self.base,+ skill_name="signals-scout-error-tracking",+ )+ self._emit_version(+ document_id="d2",+ report_id="rReplay",+ source_product="signals_scout",+ inserted_at=self.base,+ skill_name="signals-scout-session-replay",+ )+ self._emit_version(document_id="d3", report_id="rPipeline", source_product="errors", inserted_at=self.base)++ assert fetch_report_ids_for_scout_names(self.team, ["signals-scout-error-tracking"]) == {"rErrors"}+ assert fetch_report_ids_for_scout_names(+ self.team, ["signals-scout-error-tracking", "signals-scout-session-replay"]+ ) == {"rErrors", "rReplay"}+ assert fetch_report_ids_for_scout_names(self.team, ["signals-scout-unknown"]) == set()++ def test_deleted_in_latest_version_drops_out(self) -> None:+ self._emit_version(+ document_id="moving",+ report_id="rA",+ source_product="signals_scout",+ inserted_at=self.base,+ skill_name="signals-scout-apm",+ )+ self._emit_version(+ document_id="moving",+ report_id="rA",+ source_product="signals_scout",+ inserted_at=self.base + timedelta(hours=1),+ deleted=True,+ skill_name="signals-scout-apm",+ )++ assert fetch_report_ids_for_scout_names(self.team, ["signals-scout-apm"]) == set()++class TestFetchSignalsForReportSync(_SignalEmbeddingsTestBase):def _signal_ids(self, report_id: str) -> set[str]:return {s["signal_id"] for s in fetch_signals_for_report_sync(self.team, report_id)}diff --git a/products/signals/backend/views.py b/products/signals/backend/views.pyindex 874429a91b19..3a7d07f269bb 100644--- a/products/signals/backend/views.py+++ b/products/signals/backend/views.py@@ -133,6 +133,7 @@ from products.signals.backend.temporal.deletion import SignalReportDeletionWorkffrom products.signals.backend.temporal.grouping_v2 import TeamSignalGroupingV2Workflowfrom products.signals.backend.temporal.reingestion import SignalReportReingestionWorkflowfrom products.signals.backend.temporal.signal_queries import (+ fetch_report_ids_for_scout_names,fetch_report_ids_for_source_products,fetch_signals_for_report_sync,)@@ -714,6 +715,7 @@ class SignalReportViewSet(qs = self._apply_signal_report_status_filter(qs)qs = self._apply_signal_report_search_filter(qs)qs = self._apply_signal_report_source_product_filter(qs)+ qs = self._apply_signal_report_scout_filter(qs)qs = self._apply_signal_report_implementation_pr_filter(qs)qs = self._apply_signal_report_suggested_reviewer_filter(qs)qs = self._apply_signal_report_task_filter(qs)@@ -836,6 +838,18 @@ class SignalReportViewSet(report_ids_with_source = fetch_report_ids_for_source_products(self.team, source_products)return queryset.filter(id__in=report_ids_with_source)+ def _apply_signal_report_scout_filter(self, queryset):+ scout_filter = self.request.query_params.get("scout")+ if not scout_filter:+ return queryset++ scout_names = [s.strip() for s in scout_filter.split(",") if s.strip()]+ if not scout_names:+ return queryset++ report_ids_with_scout = fetch_report_ids_for_scout_names(self.team, scout_names)+ return queryset.filter(id__in=report_ids_with_scout)+def _latest_suggested_reviewers_qs(self):"""`suggested_reviewers` rows that are the *current* (latest) version for the correlatedouter report (`OuterRef("id")`).@@ -1293,6 +1307,17 @@ class SignalReportViewSet("their contributing signals comes from one of these products (e.g. error_tracking, session_replay)."),),+ OpenApiParameter(+ name="scout",+ type=OpenApiTypes.STR,+ location=OpenApiParameter.QUERY,+ required=False,+ description=(+ "Comma-separated list of scout skill_name slugs (e.g. signals-scout-error-tracking). "+ "Reports are kept if at least one of their contributing signals was authored by one of "+ "these scouts. Combines with source_product as an AND."+ ),+ ),OpenApiParameter(name="suggested_reviewers",type=OpenApiTypes.STR,diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex 6176c020859a..b3f34474ce37 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -3095,6 +3095,10 @@ export type SignalsReportsListParams = {* Comma-separated list of priorities to include. Valid values: P0, P1, P2, P3, P4. Reports without a priority assignment are excluded when this filter is set.*/priority?: string+ /**+ * Comma-separated list of scout skill_name slugs (e.g. signals-scout-error-tracking). Reports are kept if at least one of their contributing signals was authored by one of these scouts. Combines with source_product as an AND.+ */+ scout?: string/*** Case-insensitive substring match against report title and summary.*/diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 09f5c6da9937..669c6d5d58ca 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -79111,6 +79111,10 @@ export namespace Schemas {* Comma-separated list of priorities to include. Valid values: P0, P1, P2, P3, P4. Reports without a priority assignment are excluded when this filter is set.*/priority?: string;+ /**+ * Comma-separated list of scout skill_name slugs (e.g. signals-scout-error-tracking). Reports are kept if at least one of their contributing signals was authored by one of these scouts. Combines with source_product as an AND.+ */+ scout?: string;/*** Case-insensitive substring match against report title and summary.*/diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex cc2dd195a505..c0201a1f0b84 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -43,6 +43,12 @@ export const SignalsReportsListQueryParams = /* @__PURE__ */ zod.object({.describe('Comma-separated list of priorities to include. Valid values: P0, P1, P2, P3, P4. Reports without a priority assignment are excluded when this filter is set.'),+ scout: zod+ .string()+ .optional()+ .describe(+ 'Comma-separated list of scout skill_name slugs (e.g. signals-scout-error-tracking). Reports are kept if at least one of their contributing signals was authored by one of these scouts. Combines with source_product as an AND.'+ ),search: zod.string().optional().describe('Case-insensitive substring match against report title and summary.'),source_product: zod.string()diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex 9cc5c49a043e..05dd67aa49d9 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -221,6 +221,7 @@ const inboxReportsList = (): ToolBase<offset: params.offset,ordering: params.ordering,priority: params.priority,+ scout: params.scout,search: params.search,source_product: params.source_product,status: params.status,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.jsonindex 18896d749499..79553e205be7 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@@ -25,6 +25,10 @@"description": "Comma-separated list of priorities to include. Valid values: P0, P1, P2, P3, P4. Reports without a priority assignment are excluded when this filter is set.","type": "string"},+ "scout": {+ "description": "Comma-separated list of scout skill_name slugs (e.g. signals-scout-error-tracking). Reports are kept if at least one of their contributing signals was authored by one of these scouts. Combines with source_product as an AND.",+ "type": "string"+ },"search": {"description": "Case-insensitive substring match against report title and summary.","type": "string"