: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): scout findings page + inbox entry point (#66545)
Andrew Maguireacb72b08b4c2
diff --git a/frontend/src/scenes/inbox/InboxScene.tsx b/frontend/src/scenes/inbox/InboxScene.tsxindex 2b2c2fe21a39..31fca028456e 100644--- a/frontend/src/scenes/inbox/InboxScene.tsx+++ b/frontend/src/scenes/inbox/InboxScene.tsx@@ -14,6 +14,7 @@ import { ScoutDetailView } from './components/config/scouts/ScoutDetailView'import { AgentRunDetail } from './components/detail/AgentRunDetail'import { InboxDetailHeader } from './components/detail/InboxDetailHeader'import { ReportDetail, ReportDetailSkeleton } from './components/detail/ReportDetail'+import { FindingsPanel } from './components/findings/FindingsPanel'import { InboxOnboardingBanner, InboxOnboardingTakeover } from './components/onboarding/InboxOnboarding'import { ScratchpadPanel } from './components/scratchpad/ScratchpadPanel'import { AgentSetupColumn } from './components/shell/AgentSetupColumn'@@ -138,12 +139,10 @@ function InboxDetailView({ report }: { report: SignalReport }): JSX.Element {}/**- * Fleet-memory (scratchpad) detail surface: the browse/search panel under a back link, rendered- * full-width over the list like the scout detail. Reached from the fleet-memory callout.+ * Shared chrome for the full-width scout panels (scratchpad, findings): a "Scouts" back link over the+ * panel body, rendered full-width over the list like the scout detail. Reached from their callouts.*/-function InboxScratchpadView(): JSX.Element {- const { setScratchpadOpen } = useActions(inboxSceneLogic)-+function InboxPanelView({ onBack, children }: { onBack: () => void; children: JSX.Element }): JSX.Element {return (<div className="flex flex-col min-h-0 flex-1 overflow-auto"><div className="px-4 pt-3">@@ -151,13 +150,13 @@ function InboxScratchpadView(): JSX.Element {type="tertiary"size="small"icon={<IconArrowLeft />}- onClick={() => setScratchpadOpen(false)}+ onClick={onBack}className="self-start">Scouts</LemonButton></div>- <ScratchpadPanel />+ {children}</div>)}@@ -170,8 +169,9 @@ export function InboxScene(): JSX.Element {selectedReportLoading,selectedScoutSkillName,isScratchpadOpen,+ isFindingsOpen,} = useValues(inboxSceneLogic)- const { runSessionAnalysis } = useActions(inboxSceneLogic)+ const { runSessionAnalysis, setScratchpadOpen, setFindingsOpen } = useActions(inboxSceneLogic)const { onboardingMode } = useValues(inboxOnboardingLogic)const { isDev } = useValues(preflightLogic)@@ -179,7 +179,7 @@ export function InboxScene(): JSX.Element {// stays *mounted* (just hidden) rather than being unmounted. That keeps `reportListLogic` and the scroll// container alive, so clicking "back" lands on the same scroll position with the same loaded pages —// instead of remounting and resetting to the first page at the top.- const showDetail = !!selectedReportId || !!selectedScoutSkillName || isScratchpadOpen+ const showDetail = !!selectedReportId || !!selectedScoutSkillName || isScratchpadOpen || isFindingsOpenreturn (<SceneContent className="gap-y-0 border-b-0 flex-1 min-h-0">@@ -220,8 +220,14 @@ export function InboxScene(): JSX.Element {{showDetail && (<div className="flex flex-col -mx-4 flex-1 min-h-0">- {isScratchpadOpen ? (- <InboxScratchpadView />+ {isFindingsOpen ? (+ <InboxPanelView onBack={() => setFindingsOpen(false)}>+ <FindingsPanel />+ </InboxPanelView>+ ) : isScratchpadOpen ? (+ <InboxPanelView onBack={() => setScratchpadOpen(false)}>+ <ScratchpadPanel />+ </InboxPanelView>) : selectedScoutSkillName ? (<ScoutDetailView skillName={selectedScoutSkillName} />) : selectedReport ? (diff --git a/frontend/src/scenes/inbox/components/config/scouts/FleetFindingsCallout.tsx b/frontend/src/scenes/inbox/components/config/scouts/FleetFindingsCallout.tsxnew file mode 100644index 000000000000..4f854affb2bd--- /dev/null+++ b/frontend/src/scenes/inbox/components/config/scouts/FleetFindingsCallout.tsx@@ -0,0 +1,48 @@+import { useValues } from 'kea'++import { IconArrowRight, IconSparkles } from '@posthog/icons'++import { TZLabel } from 'lib/components/TZLabel'+import { pluralize } from 'lib/utils/strings'++import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'++/**+ * Findings stat card for the scout troop list, above the scratchpad callout. Advertises the troop's+ * recent findings (count · scouts · recency) and links into the cross-fleet findings page. Reads the+ * cheap `emittedFindingsSummary` so it never triggers the per-run fetch the page does on open. Renders+ * nothing until there's at least one finding.+ */+export function FleetFindingsCallout({ onOpen }: { onOpen: () => void }): JSX.Element | null {+ const { emittedFindingsSummary, runsWindowLoadedOnce } = useValues(scoutFleetLogic)++ // Hold until the first runs-window load settles, then only show when there's something to read.+ if (!runsWindowLoadedOnce || emittedFindingsSummary.count === 0) {+ return null+ }++ return (+ <button+ type="button"+ onClick={onOpen}+ className="flex w-full items-center gap-3 rounded border border-primary bg-bg-light px-4 py-3.5 text-left transition-colors hover:border-primary-3000 hover:bg-bg-3000"+ >+ <IconSparkles className="size-5 shrink-0 text-primary-3000" />+ <div className="flex min-w-0 flex-col">+ <span className="text-sm font-medium text-default">Scout findings</span>+ <span className="truncate text-xs text-secondary leading-snug">+ {pluralize(emittedFindingsSummary.count, 'finding')} across{' '}+ {pluralize(emittedFindingsSummary.scoutCount, 'scout')}+ {emittedFindingsSummary.latestAt ? (+ <>+ {' · latest '}+ <TZLabel time={emittedFindingsSummary.latestAt} />+ </>+ ) : null}+ </span>+ </div>+ <span className="flex-1" />+ <IconArrowRight className="size-4 shrink-0 text-muted" />+ </button>+ )+}diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsxindex d538d62d521b..d48eba4cf1ba 100644--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx@@ -20,6 +20,7 @@ import {scoutRunsWindowLabel,} from '../../../utils/scoutRunsWindow'import { agentSetupModalLogic } from '../../shell/agentSetupModalLogic'+import { FleetFindingsCallout } from './FleetFindingsCallout'import { FleetMemoryCallout } from './FleetMemoryCallout'import { ScoutHelperSkillLinks } from './ScoutHelperSkillLinks'import { ScoutRowCard } from './ScoutRowCard'@@ -33,7 +34,7 @@ import { ScoutRowCard } from './ScoutRowCard'export function ScoutsFleetSection(): JSX.Element {const { scoutConfigs, scoutConfigsLoading } = useValues(scoutFleetLogic)const { loadScoutConfigs, startRunsPolling, stopRunsPolling } = useActions(scoutFleetLogic)- const { setScratchpadOpen } = useActions(inboxSceneLogic)+ const { setScratchpadOpen, setFindingsOpen } = useActions(inboxSceneLogic)const { closeSetupModal } = useActions(agentSetupModalLogic)// Poll the runs window only while the fleet list is open — the always-mounted setup@@ -76,6 +77,14 @@ export function ScoutsFleetSection(): JSX.Element {<div className="flex flex-col gap-3"><ScoutAlphaBanner /><FleetStatsHeader />+ <FleetFindingsCallout+ onOpen={() => {+ // This section can render inside the scout-troop setup modal; dismiss it so the+ // findings view isn't left hidden behind the portal'd modal. No-op outside a modal.+ closeSetupModal()+ setFindingsOpen(true)+ }}+ /><FleetMemoryCalloutonOpen={() => {// This section can render inside the scout-troop setup modal; dismiss it so thediff --git a/frontend/src/scenes/inbox/components/findings/FindingsPanel.tsx b/frontend/src/scenes/inbox/components/findings/FindingsPanel.tsxnew file mode 100644index 000000000000..c72412d5d50c--- /dev/null+++ b/frontend/src/scenes/inbox/components/findings/FindingsPanel.tsx@@ -0,0 +1,200 @@+import { useActions, useValues } from 'kea'++import { IconSparkles } from '@posthog/icons'+import { LemonBanner, LemonButton, LemonInput, LemonSelect, LemonSkeleton } from '@posthog/lemon-ui'++import { TZLabel } from 'lib/components/TZLabel'+import { pluralize } from 'lib/utils/strings'++import {+ FINDINGS_SCOUT_FILTER_ALL,+ FINDINGS_SEVERITY_FILTER_ALL,+ findingsLogic,+ FindingsSortKey,+} from '../../logics/findingsLogic'+import { SignalReportPriority } from '../../types'+import { SCOUT_RUNS_WINDOW_SPAN } from '../../utils/scoutRunsWindow'+import { ScoutEmissionCard } from '../config/scouts/ScoutEmissionCard'++const SEVERITY_OPTIONS: SignalReportPriority[] = ['P0', 'P1', 'P2', 'P3', 'P4']+const SORT_OPTIONS: { value: FindingsSortKey; label: string }[] = [+ { value: 'newest', label: 'Newest' },+ { value: 'oldest', label: 'Oldest' },+ { value: 'severity', label: 'Severity' },+ { value: 'confidence', label: 'Confidence' },+]++/**+ * Cross-fleet findings browser — every finding the troop emitted recently in one place, newest first,+ * searchable and filterable by scout/severity with a sort toggle. Reuses the per-scout+ * `ScoutEmissionCard` with `showScout` on. Read-only; acting on a finding happens in its inbox report.+ */+export function FindingsPanel(): JSX.Element {+ const {+ filteredRows,+ availableScouts,+ totalCount,+ scoutCount,+ latestEmittedAt,+ searchText,+ scoutFilter,+ severityFilter,+ sortKey,+ hasLoadedOnce,+ emissionsLoadFailed,+ emissionsLoading,+ emissionsPartialFailedRuns,+ } = useValues(findingsLogic)+ const { setSearchText, setScoutFilter, setSeverityFilter, setSortKey, loadEmissions } = useActions(findingsLogic)++ const isFiltering =+ searchText.trim().length > 0 ||+ scoutFilter !== FINDINGS_SCOUT_FILTER_ALL ||+ severityFilter !== FINDINGS_SEVERITY_FILTER_ALL++ return (+ <div className="flex flex-col gap-4 px-4 py-3">+ <FindingsHeader totalCount={totalCount} scoutCount={scoutCount} latestEmittedAt={latestEmittedAt} />++ <div className="flex flex-wrap items-center gap-2">+ <LemonInput+ type="search"+ placeholder="Search findings…"+ value={searchText}+ onChange={setSearchText}+ className="flex-1 min-w-[12rem]"+ allowClear+ />+ <LemonSelect+ size="small"+ value={scoutFilter}+ onChange={setScoutFilter}+ options={[+ { value: FINDINGS_SCOUT_FILTER_ALL, label: 'All scouts' },+ ...availableScouts.map((scout) => ({+ value: scout.skillName,+ label: `${scout.label} (${scout.count})`,+ })),+ ]}+ />+ <LemonSelect+ size="small"+ value={severityFilter}+ onChange={setSeverityFilter}+ options={[+ { value: FINDINGS_SEVERITY_FILTER_ALL, label: 'All severities' },+ ...SEVERITY_OPTIONS.map((severity) => ({ value: severity, label: severity })),+ ]}+ />+ <LemonSelect+ size="small"+ value={sortKey}+ onChange={setSortKey}+ options={SORT_OPTIONS}+ // `renderButtonContent` is handed the selected leaf, not its label string — read+ // `leaf.label` so the button reads "Sort: Newest" rather than "Sort: [object Object]".+ renderButtonContent={(leaf) => <>Sort: {leaf?.label ?? ''}</>}+ />+ </div>++ {hasLoadedOnce && (emissionsPartialFailedRuns > 0 || (emissionsLoadFailed && totalCount > 0)) && (+ // Incomplete fetch: either some runs' findings loaded and others failed (partial), or a+ // later poll/retry failed outright while a prior set is still on screen (stale). Either+ // way the list a user triages against may be incomplete — warn rather than show it silently.+ <LemonBanner+ type="warning"+ action={{ children: 'Retry', onClick: () => loadEmissions(), loading: emissionsLoading }}+ >+ Some findings couldn't be loaded, so this list may be incomplete.+ </LemonBanner>+ )}++ {!hasLoadedOnce ? (+ <div className="flex flex-col gap-2">+ <LemonSkeleton className="h-14 w-full rounded" />+ <LemonSkeleton className="h-14 w-full rounded" />+ <LemonSkeleton className="h-14 w-full rounded" />+ </div>+ ) : emissionsLoadFailed && totalCount === 0 ? (+ <FindingsErrorState onRetry={() => loadEmissions()} loading={emissionsLoading} />+ ) : filteredRows.length === 0 ? (+ <FindingsEmptyState isFiltering={isFiltering} />+ ) : (+ <div className="flex flex-col gap-2">+ {filteredRows.map((row) => (+ <ScoutEmissionCard+ // emission.id, not source_id — a run can re-emit a finding_id, sharing source_id.+ key={row.emission.id}+ skillName={row.run.skill_name}+ emission={row.emission}+ run={row.run}+ report={row.report}+ showScout+ />+ ))}+ </div>+ )}+ </div>+ )+}++function FindingsHeader({+ totalCount,+ scoutCount,+ latestEmittedAt,+}: {+ totalCount: number+ scoutCount: number+ latestEmittedAt: string | null+}): JSX.Element {+ return (+ <div className="flex flex-col gap-1">+ <div className="flex items-center gap-2">+ <IconSparkles className="size-5 text-primary-3000" />+ <span className="text-base font-semibold text-default">Scout findings</span>+ </div>+ <p className="mb-0 text-sm text-secondary">+ Every signal your scouts have emitted recently, in one place — newest first. See what's been surfaced+ across the whole troop, which scout found it, and the inbox report it fed into.+ </p>+ {totalCount > 0 && (+ <span className="text-xs text-muted">+ {pluralize(totalCount, 'finding')} · {pluralize(scoutCount, 'scout')}+ {latestEmittedAt ? (+ <>+ {' · latest '}+ <TZLabel time={latestEmittedAt} />+ </>+ ) : null}+ </span>+ )}+ <span className="text-xs text-muted">+ Covers findings from the most recent {SCOUT_RUNS_WINDOW_SPAN} of troop runs. Older findings live on in+ the inbox reports they produced.+ </span>+ </div>+ )+}++function FindingsErrorState({ onRetry, loading }: { onRetry: () => void; loading: boolean }): JSX.Element {+ return (+ <div className="flex flex-col items-center gap-2 rounded border border-dashed border-primary bg-bg-light px-4 py-8 text-center text-sm text-muted">+ <span>+ Couldn't load findings. The scout API may be unavailable or this project may not be enrolled yet.+ </span>+ <LemonButton type="secondary" size="small" onClick={onRetry} loading={loading}>+ Retry+ </LemonButton>+ </div>+ )+}++function FindingsEmptyState({ isFiltering }: { isFiltering: boolean }): JSX.Element {+ return (+ <div className="rounded border border-dashed border-primary bg-bg-light px-4 py-8 text-center text-sm text-muted">+ {isFiltering+ ? 'No findings match your search and filters.'+ : "Your scouts haven't emitted any findings yet. As they scan your project, what they surface shows up here."}+ </div>+ )+}diff --git a/frontend/src/scenes/inbox/inboxSceneLogic.ts b/frontend/src/scenes/inbox/inboxSceneLogic.tsindex 155af2c1bf52..2ba274970605 100644--- a/frontend/src/scenes/inbox/inboxSceneLogic.ts+++ b/frontend/src/scenes/inbox/inboxSceneLogic.ts@@ -97,6 +97,33 @@ function findReportRank(return { rank: null, listSize: null }}+/**+ * The URL for whichever full-width inbox surface is open, or the list otherwise. The four (report,+ * scout detail, scratchpad, findings) are mutually exclusive, so a fixed priority order resolves them.+ */+function inboxSurfaceUrl(values: {+ selectedReportId: string | null+ activeTab: InboxTabKey+ selectedScoutSkillName: string | null+ selectedScoutFindingId: string | null+ isScratchpadOpen: boolean+ isFindingsOpen: boolean+}): string {+ if (values.selectedReportId) {+ return urls.inboxReport(values.activeTab, values.selectedReportId)+ }+ if (values.selectedScoutSkillName) {+ return urls.inboxScout(values.selectedScoutSkillName, values.selectedScoutFindingId ?? undefined)+ }+ if (values.isScratchpadOpen) {+ return urls.inboxScratchpad()+ }+ if (values.isFindingsOpen) {+ return urls.inboxFindings()+ }+ return urls.inbox(values.activeTab)+}+/** Open-report engagement tracking state, kept on the logic's `cache` (not reactive). */interface InboxOpenTracking {report: SignalReport@@ -136,6 +163,9 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([// Scout fleet-memory (scratchpad) surface: a full-width browse/search view over the list,// mutually exclusive with the report and scout-detail views. Reached from the fleet-memory callout.setScratchpadOpen: (open: boolean) => ({ open }),+ // Cross-fleet findings surface: full-width browse/search/filter of every finding the troop+ // emitted recently, mutually exclusive with the other full-width views.+ setFindingsOpen: (open: boolean) => ({ open }),runSessionAnalysis: true,runSessionAnalysisSuccess: true,runSessionAnalysisFailure: (error: string) => ({ error }),@@ -197,9 +227,20 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([false,{setScratchpadOpen: (_, { open }) => open,- // Opening a report or a scout closes the memory view.+ // Opening a report, a scout, or the findings view closes the memory view.setSelectedReportId: (state, { id }) => (id ? false : state),setSelectedScoutSkillName: (state, { skillName }) => (skillName ? false : state),+ setFindingsOpen: (state, { open }) => (open ? false : state),+ },+ ],+ isFindingsOpen: [+ false,+ {+ setFindingsOpen: (_, { open }) => open,+ // Opening a report, a scout, or the memory view closes the findings view.+ setSelectedReportId: (state, { id }) => (id ? false : state),+ setSelectedScoutSkillName: (state, { skillName }) => (skillName ? false : state),+ setScratchpadOpen: (state, { open }) => (open ? false : state),},],// The finding deep-linked within the selected scout, if any. Cleared whenever a scout is@@ -329,6 +370,19 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([clearScratchpadSearch()}},+ setFindingsOpen: ({ open }) => {+ if (open) {+ // Same dwell-tracking-preserving close as the scratchpad path; clear its transient+ // search so the memory callout isn't left hidden behind a stale filter on the way back.+ clearScratchpadSearch()+ if (values.selectedReportId !== null) {+ actions.setSelectedReportId(null)+ }+ if (values.selectedScoutSkillName !== null) {+ actions.setSelectedScoutSkillName(null)+ }+ }+ },loadSourceConfigsSuccess: () => {clearInterval(cache.sessionAnalysisPollInterval)if (values.isSessionAnalysisRunning) {@@ -380,34 +434,28 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([router.values.hashParams,{ replace: false },],+ // Each toggle resolves to whichever full-width view is left open (or the list), so clearing one+ // because another opened honors that surface's URL rather than bouncing to the list.setSelectedReportId: () => [- // When a report is cleared because a scout or the memory view was just opened (mutually- // exclusive views), honor that surface's URL rather than bouncing to the list.- values.selectedReportId- ? urls.inboxReport(values.activeTab, values.selectedReportId)- : values.isScratchpadOpen- ? urls.inboxScratchpad()- : values.selectedScoutSkillName- ? urls.inboxScout(values.selectedScoutSkillName, values.selectedScoutFindingId ?? undefined)- : urls.inbox(values.activeTab),+ inboxSurfaceUrl(values),router.values.searchParams,router.values.hashParams,{ replace: false },],setSelectedScoutSkillName: () => [- values.selectedScoutSkillName- ? urls.inboxScout(values.selectedScoutSkillName, values.selectedScoutFindingId ?? undefined)- : values.isScratchpadOpen- ? urls.inboxScratchpad()- : values.selectedReportId- ? urls.inboxReport(values.activeTab, values.selectedReportId)- : urls.inbox(values.activeTab),+ inboxSurfaceUrl(values),router.values.searchParams,router.values.hashParams,{ replace: false },],setScratchpadOpen: () => [- values.isScratchpadOpen ? urls.inboxScratchpad() : urls.inbox(values.activeTab),+ inboxSurfaceUrl(values),+ router.values.searchParams,+ router.values.hashParams,+ { replace: false },+ ],+ setFindingsOpen: () => [+ inboxSurfaceUrl(values),router.values.searchParams,router.values.hashParams,{ replace: false },@@ -420,6 +468,11 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([actions.setScratchpadOpen(true)}},+ [urls.inboxFindings()]: () => {+ if (!values.isFindingsOpen) {+ actions.setFindingsOpen(true)+ }+ },[urls.inbox()]: () => {cache.inboxListVisited = trueif (values.selectedReportId !== null) {@@ -431,6 +484,9 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([if (values.isScratchpadOpen) {actions.setScratchpadOpen(false)}+ if (values.isFindingsOpen) {+ actions.setFindingsOpen(false)+ }},[urls.inbox(':tab')]: ({ tab }: { tab?: string }) => {// A bare report deep-link `/inbox/<reportId>` redirected to report form. Mark the list as@@ -462,10 +518,14 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([if (values.isScratchpadOpen) {actions.setScratchpadOpen(false)}+ if (values.isFindingsOpen) {+ actions.setFindingsOpen(false)+ }},[urls.inboxScout(':skillName')]: ({ skillName }: { skillName?: string }) => {- // `/inbox/scouts/scratchpad` also matches this pattern; the memory handler owns that path.- if (skillName === 'scratchpad') {+ // `/inbox/scouts/scratchpad` and `/inbox/scouts/findings` also match this pattern; their own+ // handlers own those paths (no real scout skill_name collides — they're `signals-scout-*`).+ if (skillName === 'scratchpad' || skillName === 'findings') {return}const name = skillName ?? nulldiff --git a/frontend/src/scenes/urls.ts b/frontend/src/scenes/urls.tsindex 2b45ebfebcbf..c6f2732cd88d 100644--- a/frontend/src/scenes/urls.ts+++ b/frontend/src/scenes/urls.ts@@ -309,6 +309,8 @@ export const urls = {},// Scout fleet memory (scratchpad) browse/search surface, reached from the fleet-memory callout.inboxScratchpad: (): string => '/inbox/scouts/scratchpad',+ // Cross-fleet findings browse/search surface, reached from the scout-findings callout.+ inboxFindings: (): string => '/inbox/scouts/findings',webAnalyticsBotAnalytics: (): string => '/web/bots',webAnalyticsHealth: (): string => '/web/health',pipelineStatus: (): string => '/health/pipeline-status',