: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): include scout report activity in fleet findings surfaces (#71835)
Andrew Maguired742dafdb03d
diff --git a/frontend/src/scenes/inbox/components/config/scouts/FleetFindingsCallout.tsx b/frontend/src/scenes/inbox/components/config/scouts/FleetFindingsCallout.tsxindex 561b177160ce..b6db54f40fae 100644--- a/frontend/src/scenes/inbox/components/config/scouts/FleetFindingsCallout.tsx+++ b/frontend/src/scenes/inbox/components/config/scouts/FleetFindingsCallout.tsx@@ -9,18 +9,32 @@ 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` (a single backend query) so it appears as soon as that lands rather- * than after the full paginated runs-window walk. Renders nothing until there's at least one finding.+ * recent output — legacy findings plus reports authored/edited via the report channel — and links+ * into the cross-fleet findings page. Reads the cheap `emittedFindingsSummary` (a single backend+ * query) so it appears as soon as that lands rather than after the full paginated runs-window walk.+ * Renders nothing until there's at least one finding or touched report.*/export function FleetFindingsCallout({ onOpen }: { onOpen: () => void }): JSX.Element | null {const { emittedFindingsSummary, fleetFindingsSummaryLoadedOnce } = useValues(scoutFleetLogic)- // Hold until the cheap summary lands, then only show when there's something to read.- if (!fleetFindingsSummaryLoadedOnce || emittedFindingsSummary.count === 0) {+ const { count, authoredReportCount, editedReportCount, scoutCount, latestAt } = emittedFindingsSummary++ // Hold until the cheap summary lands, then only show when there's something to read on either channel.+ if (!fleetFindingsSummaryLoadedOnce || (count === 0 && authoredReportCount === 0 && editedReportCount === 0)) {return null}+ const outputParts: string[] = []+ if (count > 0) {+ outputParts.push(pluralize(count, 'finding'))+ }+ if (authoredReportCount > 0) {+ outputParts.push(`${pluralize(authoredReportCount, 'report')} authored`)+ }+ if (editedReportCount > 0) {+ outputParts.push(`${pluralize(editedReportCount, 'report')} edited`)+ }+return (<buttontype="button"@@ -31,12 +45,11 @@ export function FleetFindingsCallout({ onOpen }: { onOpen: () => void }): JSX.El<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 ? (+ {outputParts.join(' · ')} across {pluralize(scoutCount, 'scout')}+ {latestAt ? (<>{' · latest '}- <TZLabel time={emittedFindingsSummary.latestAt} />+ <TZLabel time={latestAt} /></>) : null}</span>diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutReportCard.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutReportCard.tsxindex dca76795a11c..7b591cddf6f7 100644--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutReportCard.tsx+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutReportCard.tsx@@ -6,16 +6,27 @@ import { urls } from 'scenes/urls'import { ScoutReportAction } from '../../../logics/scoutDetailLogic'import { SignalReport } from '../../../types'+import { prettifyScoutSkillName } from '../../../utils/scoutRunsWindow'import { SignalReportPriorityBadge } from '../../badges/SignalReportPriorityBadge'import { SignalReportStatusBadge } from '../../badges/SignalReportStatusBadge'/**- * One report this scout touched through the report channel (`emit_report` / `edit_report`), in the- * detail Reports section. Unlike a finding's "In report" chip, the run carries the report id directly,- * so this links straight to the inbox report — the whole card is the link. An "Authored" vs "Edited"- * tag records how the scout touched it; priority/status come from the live report.+ * One report a scout touched through the report channel (`emit_report` / `edit_report`), in the+ * detail Reports section and the cross-fleet findings page. Unlike a finding's "In report" chip, the+ * run carries the report id directly, so this links straight to the inbox report — the whole card is+ * the link. An "Authored" vs "Edited" tag records how the scout touched it; priority/status come from+ * the live report. Cross-fleet listings pass `skillName` to surface which scout touched it.*/-export function ScoutReportCard({ report, action }: { report: SignalReport; action: ScoutReportAction }): JSX.Element {+export function ScoutReportCard({+ report,+ action,+ skillName,+}: {+ report: SignalReport+ action: ScoutReportAction+ /** Set on cross-fleet listings to show the touching scout's name (omitted on the per-scout detail page). */+ skillName?: string+}): JSX.Element {return (<Linkto={urls.inboxReport('reports', report.id)}@@ -27,6 +38,11 @@ export function ScoutReportCard({ report, action }: { report: SignalReport; acti</LemonTag><SignalReportPriorityBadge priority={report.priority} /><SignalReportStatusBadge status={report.status} />+ {skillName && (+ <span className="truncate text-xs font-medium text-default">+ {prettifyScoutSkillName(skillName)}+ </span>+ )}<span className="flex-1" /><span className="whitespace-nowrap text-[11px] text-muted">{humanFriendlyDetailedTime(report.updated_at)}diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsxindex 62b223aa8e2e..36a4ec83e656 100644--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx@@ -115,7 +115,7 @@ function ScoutAlphaBanner(): JSX.Element | null {)}-/** One-line fleet pulse: running, success rate, signals emitted + emit rate. */+/** One-line fleet pulse: running, success rate, output on both emit channels + output rate. */function summarize(summary: FleetSummary | null): string {if (!summary) {return 'None running now'@@ -124,11 +124,23 @@ function summarize(summary: FleetSummary | null): string {if (summary.successRate !== null) {parts.push(`${percentage(summary.successRate, 0)} success`)}- const emittedPart =- summary.emitRate !== null- ? `${pluralize(summary.emittedCount, 'signal')} emitted (${percentage(summary.emitRate, 0)})`- : `${pluralize(summary.emittedCount, 'signal')} emitted`- parts.push(emittedPart)+ // Output across both emit channels, zero parts dropped — a report-only fleet reads+ // "4 reports touched", not "0 signals emitted". The rate shares the channel-agnostic+ // definition of output (`emitRate`), so the count and the percentage always agree.+ const outputParts: string[] = []+ if (summary.emittedCount > 0) {+ outputParts.push(pluralize(summary.emittedCount, 'finding'))+ }+ if (summary.touchedReportCount > 0) {+ outputParts.push(`${pluralize(summary.touchedReportCount, 'report')} touched`)+ }+ if (outputParts.length === 0) {+ parts.push('no output yet')+ } else if (summary.emitRate !== null) {+ parts.push(`${outputParts.join(' · ')} (${percentage(summary.emitRate, 0)} of runs)`)+ } else {+ parts.push(outputParts.join(' · '))+ }return parts.join(' · ')}diff --git a/frontend/src/scenes/inbox/components/findings/FindingsPanel.tsx b/frontend/src/scenes/inbox/components/findings/FindingsPanel.tsxindex 30cf0de06874..ef4fab0617f1 100644--- a/frontend/src/scenes/inbox/components/findings/FindingsPanel.tsx+++ b/frontend/src/scenes/inbox/components/findings/FindingsPanel.tsx@@ -15,6 +15,7 @@ import {import { SignalReportPriority } from '../../types'import { SCOUT_RUNS_WINDOW_SPAN } from '../../utils/scoutRunsWindow'import { ScoutEmissionCard } from '../config/scouts/ScoutEmissionCard'+import { ScoutReportCard } from '../config/scouts/ScoutReportCard'const SEVERITY_OPTIONS: SignalReportPriority[] = ['P0', 'P1', 'P2', 'P3', 'P4']const SORT_OPTIONS: { value: FindingsSortKey; label: string }[] = [@@ -25,15 +26,22 @@ const SORT_OPTIONS: { value: FindingsSortKey; label: string }[] = []/**- * 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.+ * Cross-fleet findings browser — everything the troop surfaced recently in one place, newest first:+ * legacy `emit_signal` findings plus the inbox reports scouts authored/edited via the report channel.+ * Searchable and filterable by scout/severity with a sort toggle. Reuses the per-scout+ * `ScoutEmissionCard` / `ScoutReportCard` with scout attribution on. Read-only; acting on a finding+ * happens in its inbox report.*/export function FindingsPanel(): JSX.Element {const {filteredRows,+ filteredReportRows,+ reportRows,+ touchedReports,availableScouts,totalCount,+ authoredReportCount,+ editedReportCount,scoutCount,latestEmittedAt,searchText,@@ -43,17 +51,29 @@ export function FindingsPanel(): JSX.Element {hasLoadedOnce,emissionsLoadFailed,emissionsLoading,+ scoutReportsLoading,+ scoutReportsLoadFailed,} = useValues(findingsLogic)- const { setSearchText, setScoutFilter, setSeverityFilter, setSortKey, loadEmissions } = useActions(findingsLogic)+ const { setSearchText, setScoutFilter, setSeverityFilter, setSortKey, loadEmissions, loadScoutReports } =+ useActions(findingsLogic)const isFiltering =searchText.trim().length > 0 ||scoutFilter !== FINDINGS_SCOUT_FILTER_ALL ||severityFilter !== FINDINGS_SEVERITY_FILTER_ALL+ // Keyed on the *touched* ids (from the runs window), not the resolved rows — a failed report+ // fetch must keep the section on screen in an error state, not silently hide it.+ const hasReports = touchedReports.length > 0return (<div className="flex flex-col gap-4 px-4 py-3">- <FindingsHeader totalCount={totalCount} scoutCount={scoutCount} latestEmittedAt={latestEmittedAt} />+ <FindingsHeader+ totalCount={totalCount}+ authoredReportCount={authoredReportCount}+ editedReportCount={editedReportCount}+ scoutCount={scoutCount}+ latestEmittedAt={latestEmittedAt}+ /><div className="flex flex-wrap items-center gap-2"><LemonInput@@ -116,24 +136,98 @@ export function FindingsPanel(): JSX.Element {<LemonSkeleton className="h-14 w-full rounded" /><LemonSkeleton className="h-14 w-full rounded" /></div>- ) : emissionsLoadFailed && totalCount === 0 ? (+ ) : emissionsLoadFailed && totalCount === 0 && !hasReports ? (<FindingsErrorState onRetry={() => loadEmissions()} loading={emissionsLoading} />- ) : filteredRows.length === 0 ? (+ ) : totalCount === 0 && !hasReports ? (<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>+ <>+ {/* Reports the fleet authored/edited via the report channel. Hidden entirely when+ no report was touched, so the legacy findings-only layout stays flat. */}+ {hasReports && (+ <div className="flex flex-col gap-2">+ <span className="text-xs font-medium text-default uppercase tracking-wide">Reports</span>+ {scoutReportsLoadFailed &&+ reportRows.length > 0 && (+ // A later refresh failed while a previously resolved set is still on+ // screen — the cards may be stale or missing newly touched reports.+ <LemonBanner+ type="warning"+ action={{+ children: 'Retry',+ onClick: () => loadScoutReports(),+ loading: scoutReportsLoading,+ }}+ >+ Some reports couldn't be refreshed, so this list may be stale or incomplete.+ </LemonBanner>+ )}+ {scoutReportsLoading && reportRows.length === 0 ? (+ <LemonSkeleton className="h-12 w-full rounded" />+ ) : reportRows.length === 0 ? (+ // Touched ids exist but none resolved — the fetches failed (or the+ // reports were deleted). Don't render a false "no reports": say so+ // and offer a retry, since the poll won't refetch an unchanged set.+ <div className="flex flex-col items-center gap-2 rounded border border-dashed border-primary bg-bg-light px-4 py-6 text-center text-sm text-muted">+ <span>Couldn't load the reports your scouts authored or edited.</span>+ <LemonButton+ type="secondary"+ size="small"+ onClick={() => loadScoutReports()}+ loading={scoutReportsLoading}+ >+ Retry+ </LemonButton>+ </div>+ ) : filteredReportRows.length === 0 ? (+ <div className="rounded border border-dashed border-primary bg-bg-light px-4 py-6 text-center text-sm text-muted">+ No reports match your search and filters.+ </div>+ ) : (+ filteredReportRows.map((row) => (+ <ScoutReportCard+ key={row.report.id}+ report={row.report}+ action={row.action}+ skillName={row.skillName}+ />+ ))+ )}+ </div>+ )}++ {/* Legacy emit_signal findings. When reports are also on screen the section gets a+ heading; hidden when the fleet only produced reports (and nothing failed),+ mirroring the per-scout detail view's hide-empty-section rule. */}+ {(totalCount > 0 || emissionsLoadFailed) && (+ <div className="flex flex-col gap-2">+ {hasReports && (+ <span className="text-xs font-medium text-default uppercase tracking-wide">+ Findings+ </span>+ )}+ {emissionsLoadFailed && totalCount === 0 ? (+ <FindingsErrorState onRetry={() => loadEmissions()} loading={emissionsLoading} />+ ) : filteredRows.length === 0 ? (+ <div className="rounded border border-dashed border-primary bg-bg-light px-4 py-6 text-center text-sm text-muted">+ No findings match your search and filters.+ </div>+ ) : (+ 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>)@@ -141,13 +235,27 @@ export function FindingsPanel(): JSX.Element {function FindingsHeader({totalCount,+ authoredReportCount,+ editedReportCount,scoutCount,latestEmittedAt,}: {totalCount: number+ authoredReportCount: number+ editedReportCount: numberscoutCount: numberlatestEmittedAt: string | null}): JSX.Element {+ const tallyParts: string[] = []+ if (totalCount > 0) {+ tallyParts.push(pluralize(totalCount, 'finding'))+ }+ if (authoredReportCount > 0) {+ tallyParts.push(`${pluralize(authoredReportCount, 'report')} authored`)+ }+ if (editedReportCount > 0) {+ tallyParts.push(`${pluralize(editedReportCount, 'report')} edited`)+ }return (<div className="flex flex-col gap-1"><div className="flex items-center gap-2">@@ -155,12 +263,13 @@ function FindingsHeader({<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.+ Everything your scouts have surfaced recently, in one place — newest first: the signals they emitted and+ the inbox reports they authored or edited. See what's been found across the whole troop and which scout+ found it.</p>- {totalCount > 0 && (+ {tallyParts.length > 0 && (<span className="text-xs text-muted">- {pluralize(totalCount, 'finding')} · {pluralize(scoutCount, 'scout')}+ {tallyParts.join(' · ')} · {pluralize(scoutCount, 'scout')}{latestEmittedAt ? (<>{' · latest '}@@ -170,8 +279,8 @@ function FindingsHeader({</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.+ Covers the most recent {SCOUT_RUNS_WINDOW_SPAN} of troop runs. Older findings live on in the inbox+ reports they produced.</span></div>)@@ -194,8 +303,8 @@ function FindingsEmptyState({ isFiltering }: { isFiltering: boolean }): JSX.Elemreturn (<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."}+ ? 'No findings or reports match your search and filters.'+ : "Your scouts haven't surfaced anything yet. As they scan your project, the findings they emit and the reports they author show up here."}</div>)}diff --git a/frontend/src/scenes/inbox/logics/findingsLogic.ts b/frontend/src/scenes/inbox/logics/findingsLogic.tsindex a187ca53e6fa..3efaadaeaf5f 100644--- a/frontend/src/scenes/inbox/logics/findingsLogic.ts+++ b/frontend/src/scenes/inbox/logics/findingsLogic.ts@@ -7,13 +7,19 @@ import { dayjs } from 'lib/dayjs'import {LinkedSignalReport,+ SignalReport,SignalReportPriority,SignalScoutEmission,SignalScoutEmissionReportLink,SignalScoutRunSummary,} from '../types'-import { mostRecentEmittedRuns, prettifyScoutSkillName } from '../utils/scoutRunsWindow'-import { ScoutEmissionRow } from './scoutDetailLogic'+import {+ isSettledRun,+ mostRecentEmittedRuns,+ prettifyScoutSkillName,+ runTouchedReports,+} from '../utils/scoutRunsWindow'+import { ScoutEmissionRow, ScoutReportAction } from './scoutDetailLogic'import { scoutFleetLogic } from './scoutFleetLogic'// Report linkage is eventually consistent, so keep retrying the reverse lookup on the runs-window@@ -23,6 +29,21 @@ const REPORT_LINK_RETRY_WINDOW_MINUTES = 30// Cadence of the page's own runs-window poll (matches the fleet section's); retries cold/failed loads.const RUNS_REFETCH_INTERVAL_MS = 60_000+// Bound the reports the fleet-wide surfaces consider (tallies, fetch fan-out, rendered list), the+// same way the per-scout detail view bounds its own report fetches. Applied in the `touchedReports`+// selector — keeping the most recently touched — so every consumer describes the same set.+const MAX_FLEET_TOUCHED_REPORTS = 50++/** A report the fleet touched via the report channel, joined with how and by which scout(s). */+export interface FleetScoutReportRow {+ report: SignalReport+ action: ScoutReportAction+ /** Primary attribution for the card: the authoring scout, else the most recent editor. */+ skillName: string+ /** Every scout that touched the report in the window — what the scout filter matches against. */+ skillNames: string[]+}+export type FindingsSortKey = 'newest' | 'oldest' | 'severity' | 'confidence'export const FINDINGS_SCOUT_FILTER_ALL = 'all'export const FINDINGS_SEVERITY_FILTER_ALL = 'all'@@ -41,11 +62,13 @@ export interface findingsLogicValues {} // scoutFleetLogicrunsWindowComplete: boolean // scoutFleetLogicrunsWindowLoadedOnce: boolean // scoutFleetLogic+ authoredReportCount: numberavailableScouts: {count: numberlabel: stringskillName: string}[]+ editedReportCount: numberemissionReports: SignalScoutEmissionReportLink[]emissionReportsLoading: booleanemissions: SignalScoutEmission[]@@ -53,17 +76,31 @@ export interface findingsLogicValues {emissionsLoading: booleanemittedRuns: SignalScoutRunSummary[]emittedRunsKey: string+ filteredReportRows: FleetScoutReportRow[]filteredRows: ScoutEmissionRow[]hasLoadedOnce: booleanlatestEmittedAt: string | nullreportBySourceId: Map<string, LinkedSignalReport>+ reportRows: FleetScoutReportRow[]rows: ScoutEmissionRow[]scoutCount: numberscoutFilter: string+ scoutReports: SignalReport[]+ scoutReportsLoadFailed: boolean+ scoutReportsLoading: booleansearchText: stringseverityFilter: stringsortKey: FindingsSortKeytotalCount: number+ touchedReports: {+ action: ScoutReportAction+ hasLiveTouch: boolean+ id: string+ runIds: string[]+ skillName: string+ skillNames: string[]+ }[]+ touchedReportsKey: string}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -98,6 +135,27 @@ export interface findingsLogicActions {emissions: SignalScoutEmission[]payload?: any}+ loadScoutReports: (ids?: string[]) => {+ ids: string[] | undefined+ }+ loadScoutReportsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadScoutReportsSuccess: (+ scoutReports: SignalReport[],+ payload?: {+ ids: string[] | undefined+ }+ ) => {+ scoutReports: SignalReport[]+ payload?: {+ ids: string[] | undefined+ }+ }setScoutFilter: (scoutFilter: string) => {scoutFilter: string}@@ -117,13 +175,59 @@ export interface findingsLogicMeta {__keaTypeGenInternalSelectorTypes: {emittedRuns: (runsWindow: { complete: boolean; runs: SignalScoutRunSummary[] }) => SignalScoutRunSummary[]emittedRunsKey: (emittedRuns: SignalScoutRunSummary[]) => string+ touchedReports: (emittedRuns: SignalScoutRunSummary[]) => {+ action: ScoutReportAction+ hasLiveTouch: boolean+ id: string+ runIds: string[]+ skillName: string+ skillNames: string[]+ }[]+ touchedReportsKey: (+ touchedReports: {+ action: ScoutReportAction+ hasLiveTouch: boolean+ id: string+ runIds: string[]+ skillName: string+ skillNames: string[]+ }[]+ ) => string+ reportRows: (+ scoutReports: SignalReport[],+ touchedReports: {+ action: ScoutReportAction+ hasLiveTouch: boolean+ id: string+ runIds: string[]+ skillName: string+ skillNames: string[]+ }[]+ ) => FleetScoutReportRow[]+ filteredReportRows: (+ reportRows: FleetScoutReportRow[],+ searchText: string,+ scoutFilter: string,+ severityFilter: string,+ sortKey: FindingsSortKey+ ) => FleetScoutReportRow[]reportBySourceId: (emissionReports: SignalScoutEmissionReportLink[]) => Map<string, LinkedSignalReport>rows: (emissions: SignalScoutEmission[],emittedRuns: SignalScoutRunSummary[],reportBySourceId: Map<string, LinkedSignalReport>) => ScoutEmissionRow[]- availableScouts: (rows: ScoutEmissionRow[]) => {+ availableScouts: (+ rows: ScoutEmissionRow[],+ touchedReports: {+ action: ScoutReportAction+ hasLiveTouch: boolean+ id: string+ runIds: string[]+ skillName: string+ skillNames: string[]+ }[]+ ) => {count: numberlabel: stringskillName: string@@ -136,6 +240,26 @@ export interface findingsLogicMeta {sortKey: FindingsSortKey) => ScoutEmissionRow[]totalCount: (rows: ScoutEmissionRow[]) => number+ authoredReportCount: (+ touchedReports: {+ action: ScoutReportAction+ hasLiveTouch: boolean+ id: string+ runIds: string[]+ skillName: string+ skillNames: string[]+ }[]+ ) => number+ editedReportCount: (+ touchedReports: {+ action: ScoutReportAction+ hasLiveTouch: boolean+ id: string+ runIds: string[]+ skillName: string+ skillNames: string[]+ }[]+ ) => numberscoutCount: (availableScouts: {count: number@@ -143,12 +267,22 @@ export interface findingsLogicMeta {skillName: string}[]) => number- latestEmittedAt: (rows: ScoutEmissionRow[]) => string | null+ latestEmittedAt: (rows: ScoutEmissionRow[], emittedRuns: SignalScoutRunSummary[]) => string | nullhasLoadedOnce: (runsWindowLoadedOnce: boolean,emittedRuns: SignalScoutRunSummary[],emissionsLoading: boolean,- emissions: SignalScoutEmission[]+ emissions: SignalScoutEmission[],+ touchedReports: {+ action: ScoutReportAction+ hasLiveTouch: boolean+ id: string+ runIds: string[]+ skillName: string+ skillNames: string[]+ }[],+ scoutReportsLoading: boolean,+ scoutReports: SignalReport[]) => boolean}}@@ -162,10 +296,12 @@ export type findingsLogicType = MakeLogicType</*** Fleet-wide findings logic — the cross-troop counterpart of the per-scout `scoutDetailLogic`. Reuses- * `scoutFleetLogic`'s polled runs window to find every scout's recent emitted runs, fetches their+ * `scoutFleetLogic`'s polled runs window to find every scout's recent output runs, fetches their* emissions + report links in two batched requests, and flattens them into one- * searchable/filterable/sortable list. Singleton, mounted only by the findings page, so the fetch stays- * lazy (the callout reads the cheap `scoutFleetLogic.emittedFindingsSummary` instead).+ * searchable/filterable/sortable list. Also resolves the reports the fleet authored/edited via the+ * report channel (`emit_report` / `edit_report`) so the page lists both emit channels. Singleton,+ * mounted only by the findings page, so the fetch stays lazy (the callout reads the cheap+ * `scoutFleetLogic.emittedFindingsSummary` instead).*/export const findingsLogic = kea<findingsLogicType>([path(['scenes', 'inbox', 'logics', 'findingsLogic']),@@ -179,6 +315,10 @@ export const findingsLogic = kea<findingsLogicType>([setScoutFilter: (scoutFilter: string) => ({ scoutFilter }),setSeverityFilter: (severityFilter: string) => ({ severityFilter }),setSortKey: (sortKey: FindingsSortKey) => ({ sortKey }),+ // `ids` = targeted refresh (the poll retries): fetch only those reports and merge into the+ // retained set. Omitted = full load of every touched report. Each retrieve is an expensive+ // annotated query server-side, so the 60s poll must not re-fetch all ~50 for one needy id.+ loadScoutReports: (ids?: string[]) => ({ ids }),}),loaders(({ values }) => ({@@ -186,7 +326,10 @@ export const findingsLogic = kea<findingsLogicType>([[] as SignalScoutEmission[],{loadEmissions: async () => {- const runs = values.emittedRuns+ // Only runs that emitted a finding — report-only runs have no emissions to fetch,+ // and a report-only fleet must not hit (or surface an error from) this legacy+ // endpoint at all.+ const runs = values.emittedRuns.filter((run) => (run.emitted_count ?? 0) > 0)if (runs.length === 0) {return []}@@ -201,7 +344,9 @@ export const findingsLogic = kea<findingsLogicType>([[] as SignalScoutEmissionReportLink[],{loadEmissionReports: async () => {- const runs = values.emittedRuns+ // Report links only exist for emitted findings — same finding-producing subset+ // as `loadEmissions`.+ const runs = values.emittedRuns.filter((run) => (run.emitted_count ?? 0) > 0)if (runs.length === 0) {return []}@@ -220,6 +365,53 @@ export const findingsLogic = kea<findingsLogicType>([},},],+ // The reports the fleet authored/edited directly via the report channel. Unlike findings, the+ // run already carries the report id (no async grouping), so each report is fetched straight by+ // id to resolve its title + live status. The `touchedReports` selector already caps the set.+ // On a partially failed fan-out, a still-touched report that resolved on a *previous* round is+ // kept (possibly stale) rather than dropped — otherwise retries would oscillate between+ // subsets as different requests fail. When *every* fetch fails while touched ids exist, throw —+ // an outage must show the Reports section's error/retry state, not a false "no reports".+ scoutReports: [+ [] as SignalReport[],+ {+ loadScoutReports: async ({ ids }: { ids?: string[] } = {}) => {+ const touched = values.touchedReports+ if (touched.length === 0) {+ return []+ }+ const touchedIds = new Set(touched.map(({ id }) => id))+ // Targeted refresh fetches only the named (still-touched) ids; a full load+ // fetches the whole capped set.+ const fetchIds = ids ? [...new Set(ids)].filter((id) => touchedIds.has(id)) : [...touchedIds]+ if (fetchIds.length === 0) {+ return values.scoutReports+ }+ const settled = await Promise.allSettled(fetchIds.map((id) => api.signalReports.get(id)))+ const byId = new Map<string, SignalReport>()+ for (const result of settled) {+ if (result.status === 'fulfilled') {+ byId.set(result.value.id, result.value)+ }+ }+ // Every fetch rejected — throw BEFORE merging cached rows, so an outage flags+ // `scoutReportsLoadFailed` (warning banner over the stale set kea-loaders keeps)+ // instead of laundering the cache into a "successful" refresh.+ if (byId.size === 0) {+ throw new Error('Failed to load the reports scouts touched')+ }+ // Keep prior resolved reports for still-touched ids that weren't (successfully)+ // fetched this round — a partial failure must not drop them, and a targeted+ // refresh must not discard the untargeted rest.+ for (const previous of values.scoutReports) {+ if (!byId.has(previous.id) && touchedIds.has(previous.id)) {+ byId.set(previous.id, previous)+ }+ }+ return [...byId.values()]+ },+ },+ ],})),reducers({@@ -239,6 +431,16 @@ export const findingsLogic = kea<findingsLogicType>([loadEmissionsFailure: () => true,},],+ // True only when the most recent reports load failed outright (every per-report fetch+ // rejected). Lets the Reports section show an error/retry state instead of a false empty.+ scoutReportsLoadFailed: [+ false,+ {+ loadScoutReports: () => false,+ loadScoutReportsSuccess: () => false,+ loadScoutReportsFailure: () => true,+ },+ ],}),selectors({@@ -259,6 +461,184 @@ export const findingsLogic = kea<findingsLogicType>([.sort().join(','),],+ // The distinct reports the fleet touched via the report channel in the window, most recently+ // touched first, each tagged with how (authoring supersedes a later edit of the same report,+ // matching the scout detail view) and by which scout — the authoring run's skill wins; an+ // edited-only report gets the most recent editing run's skill. Runs arrive newest first, so+ // first-writer-wins per pass. Capped at MAX_FLEET_TOUCHED_REPORTS *here* — not just in the+ // loader — so the header tallies, the fetch, and the rendered list all describe the same set,+ // and the cap keeps the most recently touched reports rather than arbitrary ones.+ touchedReports: [+ (s) => [s.emittedRuns],+ (+ emittedRuns: SignalScoutRunSummary[]+ ): {+ id: string+ action: ScoutReportAction+ skillName: string+ skillNames: string[]+ runIds: string[]+ hasLiveTouch: boolean+ }[] => {+ // First-touch order (runs arrive newest first) drives the recency cap. Also collects+ // *every* touching run (for the refetch key — a run first observed after it settled+ // must still trigger a reload), whether any touching run is still live (the poll+ // refreshes live-touched reports; the live→settled flip changes the key so the run's+ // final pre-completion edit gets one last reload), and every touching scout, so a+ // report scout B edited stays findable under B's filter even when scout A's+ // authoring wins the card attribution.+ const orderedIds = new Map<string, null>()+ const runIdsById = new Map<string, string[]>()+ const liveTouchIds = new Set<string>()+ const skillNamesById = new Map<string, string[]>()+ for (const run of emittedRuns) {+ for (const id of [...(run.edited_report_ids ?? []), ...(run.emitted_report_ids ?? [])]) {+ if (!orderedIds.has(id)) {+ orderedIds.set(id, null)+ }+ const runIds = runIdsById.get(id) ?? []+ if (!runIds.includes(run.run_id)) {+ runIds.push(run.run_id)+ runIdsById.set(id, runIds)+ }+ if (!isSettledRun(run)) {+ liveTouchIds.add(id)+ }+ const skills = skillNamesById.get(id) ?? []+ if (!skills.includes(run.skill_name)) {+ skills.push(run.skill_name)+ skillNamesById.set(id, skills)+ }+ }+ }+ const byId = new Map<string, { action: ScoutReportAction; skillName: string }>()+ for (const run of emittedRuns) {+ for (const id of run.edited_report_ids ?? []) {+ if (!byId.has(id)) {+ byId.set(id, { action: 'edited', skillName: run.skill_name })+ }+ }+ }+ for (const run of emittedRuns) {+ for (const id of run.emitted_report_ids ?? []) {+ if (byId.get(id)?.action !== 'authored') {+ byId.set(id, { action: 'authored', skillName: run.skill_name })+ }+ }+ }+ // orderedIds' insertion order is newest-touch-first, so slicing keeps recency.+ return [...orderedIds.keys()].slice(0, MAX_FLEET_TOUCHED_REPORTS).map((id) => ({+ id,+ ...byId.get(id)!,+ skillNames: skillNamesById.get(id) ?? [],+ runIds: runIdsById.get(id) ?? [],+ hasLiveTouch: liveTouchIds.has(id),+ }))+ },+ ],+ // Stable key over the touched report set — refetch the reports only when the set actually+ // changes, not on every runs-window poll that returns the same runs. Includes *every*+ // touching run id, so any newly observed touch refetches the report's live title/status —+ // including an overlapping run's edit first observed after that run settled — plus the+ // live/settled state, so a touching run completing fires one final reload that catches its+ // last pre-completion edit (which no id in the key would otherwise reflect).+ touchedReportsKey: [+ (s) => [s.touchedReports],+ (+ touchedReports: {+ id: string+ action: ScoutReportAction+ skillName: string+ runIds: string[]+ hasLiveTouch: boolean+ }[]+ ): string =>+ touchedReports+ .map(+ ({ id, action, runIds, hasLiveTouch }) =>+ `${id}:${action}:${[...runIds].sort().join('+')}:${hasLiveTouch ? 'live' : 'settled'}`+ )+ .sort()+ .join(','),+ ],+ // Join the fetched reports back to how/who touched each, newest-updated first. A touched id+ // whose report fetch failed (deleted/inaccessible) is skipped.+ reportRows: [+ (s) => [s.scoutReports, s.touchedReports],+ (+ scoutReports: SignalReport[],+ touchedReports: {+ id: string+ action: ScoutReportAction+ skillName: string+ skillNames: string[]+ }[]+ ): FleetScoutReportRow[] => {+ const touchedById = new Map(touchedReports.map((touched) => [touched.id, touched]))+ return scoutReports+ .map((report) => {+ const touched = touchedById.get(report.id)+ return touched+ ? {+ report,+ action: touched.action,+ skillName: touched.skillName,+ skillNames: touched.skillNames,+ }+ : null+ })+ .filter((row): row is FleetScoutReportRow => row !== null)+ .sort((a, b) => (b.report.updated_at ?? '').localeCompare(a.report.updated_at ?? ''))+ },+ ],+ // Visible report set: same search / scout / severity filters and sort control as the findings+ // (severity matches the report's priority). The shared sort applies where it has meaning —+ // newest/oldest by report update time, severity by priority; the finding-only "confidence"+ // key falls back to newest so one control never leaves the two lists contradicting each other.+ filteredReportRows: [+ (s) => [s.reportRows, s.searchText, s.scoutFilter, s.severityFilter, s.sortKey],+ (+ reportRows: FleetScoutReportRow[],+ searchText: string,+ scoutFilter: string,+ severityFilter: string,+ sortKey: FindingsSortKey+ ): FleetScoutReportRow[] => {+ const needle = searchText.trim().toLowerCase()+ const filtered = reportRows.filter((row) => {+ // Match any touching scout, not just the card's primary attribution — a report+ // scout B edited must surface under B's filter even when scout A authored it.+ if (scoutFilter !== FINDINGS_SCOUT_FILTER_ALL && !row.skillNames.includes(scoutFilter)) {+ return false+ }+ if (severityFilter !== FINDINGS_SEVERITY_FILTER_ALL && row.report.priority !== severityFilter) {+ return false+ }+ if (needle) {+ // Title + summary (matching the backend report search) + touching scout names.+ const haystack = `${row.report.title ?? ''} ${row.report.summary ?? ''} ${row.skillNames+ .map(prettifyScoutSkillName)+ .join(' ')}`.toLowerCase()+ if (!haystack.includes(needle)) {+ return false+ }+ }+ return true+ })+ const byNewest = (a: FleetScoutReportRow, b: FleetScoutReportRow): number =>+ (b.report.updated_at ?? '').localeCompare(a.report.updated_at ?? '')+ return filtered.slice().sort((a, b) => {+ if (sortKey === 'oldest') {+ return -byNewest(a, b)+ }+ if (sortKey === 'severity') {+ const diff = severityRank(a.report.priority ?? null) - severityRank(b.report.priority ?? null)+ return diff !== 0 ? diff : byNewest(a, b)+ }+ return byNewest(a, b)+ })+ },+ ],reportBySourceId: [(s) => [s.emissionReports],(emissionReports: SignalScoutEmissionReportLink[]): Map<string, LinkedSignalReport> =>@@ -285,14 +665,31 @@ export const findingsLogic = kea<findingsLogicType>([.filter((row): row is ScoutEmissionRow => row !== null)},],- // Distinct scouts present in the loaded findings, with a per-scout count, for the scout filter.+ // Distinct scouts present in the loaded findings and touched reports, with a per-scout row+ // count (findings + reports), for the scout filter. Report-side scouts come from the touched+ // set — not the resolved rows — so a failed report fetch can't contradict the header tallies+ // ("1 report authored · 0 scouts") or drop the scout from the filter; every touching scout+ // counts, not just the card's primary attribution.availableScouts: [- (s) => [s.rows],- (rows: ScoutEmissionRow[]): { skillName: string; label: string; count: number }[] => {+ (s) => [s.rows, s.touchedReports],+ (+ rows: ScoutEmissionRow[],+ touchedReports: {+ id: string+ action: ScoutReportAction+ skillName: string+ skillNames: string[]+ }[]+ ): { skillName: string; label: string; count: number }[] => {const counts = new Map<string, number>()for (const row of rows) {counts.set(row.run.skill_name, (counts.get(row.run.skill_name) ?? 0) + 1)}+ for (const touched of touchedReports) {+ for (const skillName of touched.skillNames) {+ counts.set(skillName, (counts.get(skillName) ?? 0) + 1)+ }+ }return [...counts.entries()].map(([skillName, count]) => ({ skillName, label: prettifyScoutSkillName(skillName), count })).sort((a, b) => a.label.localeCompare(b.label))@@ -346,6 +743,16 @@ export const findingsLogic = kea<findingsLogicType>([],// Page header tallies, from the loaded set (not the cheap window sum the callout uses).totalCount: [(s) => [s.rows], (rows: ScoutEmissionRow[]): number => rows.length],+ authoredReportCount: [+ (s) => [s.touchedReports],+ (touchedReports: { id: string; action: ScoutReportAction; skillName: string }[]): number =>+ touchedReports.filter(({ action }) => action === 'authored').length,+ ],+ editedReportCount: [+ (s) => [s.touchedReports],+ (touchedReports: { id: string; action: ScoutReportAction; skillName: string }[]): number =>+ touchedReports.filter(({ action }) => action === 'edited').length,+ ],scoutCount: [(s) => [s.availableScouts],(@@ -356,9 +763,13 @@ export const findingsLogic = kea<findingsLogicType>([}[]): number => availableScouts.length,],+ // Most recent output across both channels: finding emission times, plus the completion (or+ // creation) time of report-touching runs — mirroring the backend summary's `latest_at`, so a+ // report-only fleet still gets a "latest" and a fresh report edit isn't outdated by an older+ // finding timestamp.latestEmittedAt: [- (s) => [s.rows],- (rows: ScoutEmissionRow[]): string | null => {+ (s) => [s.rows, s.emittedRuns],+ (rows: ScoutEmissionRow[], emittedRuns: SignalScoutRunSummary[]): string | null => {let latest: string | null = nullfor (const row of rows) {const at = row.emission.emitted_at@@ -366,21 +777,45 @@ export const findingsLogic = kea<findingsLogicType>([latest = at}}+ for (const run of emittedRuns) {+ if (!runTouchedReports(run)) {+ continue+ }+ const at = run.completed_at ?? run.created_at+ if (at && (!latest || at > latest)) {+ latest = at+ }+ }return latest},],// "Loaded once" — distinguishes "not loaded yet" from "loaded, empty" without a skeleton flash.// With no emitted runs there's nothing to fetch, so resolve immediately; otherwise the- // `!emissionsLoading` guard suppresses poll flicker once findings are in hand.+ // `!...Loading` guards suppress poll flicker once content is in hand. Waits on *both* channels:+ // a report-only fleet must not flash the "haven't surfaced anything" empty state in the gap+ // between the emissions load settling and the per-report fetches resolving.hasLoadedOnce: [- (s) => [s.runsWindowLoadedOnce, s.emittedRuns, s.emissionsLoading, s.emissions],+ (s) => [+ s.runsWindowLoadedOnce,+ s.emittedRuns,+ s.emissionsLoading,+ s.emissions,+ s.touchedReports,+ s.scoutReportsLoading,+ s.scoutReports,+ ],(runsWindowLoadedOnce: boolean,emittedRuns: SignalScoutRunSummary[],emissionsLoading: boolean,- emissions: SignalScoutEmission[]+ emissions: SignalScoutEmission[],+ touchedReports: { id: string; action: ScoutReportAction; skillName: string; latestRunId: string }[],+ scoutReportsLoading: boolean,+ scoutReports: SignalReport[]): boolean =>- runsWindowLoadedOnce && (emittedRuns.length === 0 || !emissionsLoading || emissions.length > 0),+ runsWindowLoadedOnce &&+ (emittedRuns.length === 0 || !emissionsLoading || emissions.length > 0) &&+ (touchedReports.length === 0 || !scoutReportsLoading || scoutReports.length > 0),],}),@@ -390,6 +825,11 @@ export const findingsLogic = kea<findingsLogicType>([actions.loadEmissions()actions.loadEmissionReports()},+ // Fires on mount and whenever the set of reports the fleet touched changes; the key holds+ // equal across no-op polls so we don't refetch.+ touchedReportsKey: () => {+ actions.loadScoutReports()+ },})),listeners(({ actions, values }) => ({@@ -403,6 +843,24 @@ export const findingsLogic = kea<findingsLogicType>([if (hasRecentUnlinked) {actions.loadEmissionReports()}+ // Same ride for touched reports: the `touchedReportsKey` subscription won't refire for an+ // unchanged set, so without this (a) a report whose fetch failed transiently stays missing+ // until remount, and (b) a live run editing the same report repeatedly (dedup keeps+ // `edited_report_ids` unchanged after the first edit) serves a stale card until the run+ // settles. Refresh is *targeted*: only the needy ids are refetched — a report touched by+ // ANY still-live run (self-bounding since runs settle), or unresolved (transient failure+ // or deleted; no recency gate — the page's window is 72h, so an age gate would strand an+ // older report's failed fetch while the header still counts it. A deleted report costs+ // one targeted GET per poll until its touch leaves the window — bounded and rare).+ if (!values.scoutReportsLoading && values.touchedReports.length > 0) {+ const resolvedIds = new Set(values.scoutReports.map((report) => report.id))+ const needyIds = values.touchedReports+ .filter(({ id, hasLiveTouch }) => hasLiveTouch || !resolvedIds.has(id))+ .map(({ id }) => id)+ if (needyIds.length > 0) {+ actions.loadScoutReports(needyIds)+ }+ }},})),diff --git a/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts b/frontend/src/scenes/inbox/logics/scoutFleetLogic.tsindex ca210d1924d9..3de9892b9ef9 100644--- a/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts+++ b/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts@@ -42,7 +42,9 @@ export interface scoutFleetLogicValues {customScoutCount: numberdeletingScoutIds: string[]emittedFindingsSummary: {+ authoredReportCount: numbercount: number+ editedReportCount: numberlatestAt: string | nullscoutCount: number}@@ -205,7 +207,9 @@ export interface scoutFleetLogicMeta {visibleConfigs: (scoutConfigs: SignalScoutConfig[] | null, hideDisabled: boolean) => SignalScoutConfig[]runsWindowComplete: (runsWindow: { complete: boolean; runs: SignalScoutRunSummary[] }) => booleanemittedFindingsSummary: (fleetFindingsSummary: FleetFindingsSummaryApi | null) => {+ authoredReportCount: numbercount: number+ editedReportCount: numberlatestAt: string | nullscoutCount: number}@@ -279,9 +283,10 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([},},],- // Cheap fleet-wide findings tally for the "Scout findings" callout — one backend query over- // emitted runs, so the callout no longer waits on the full paginated runs-window walk (which- // could take ~10s and was the reason the callout appeared long after the modal opened).+ // Cheap fleet-wide output tally for the "Scout findings" callout — one backend query over+ // runs that produced output (findings or report-channel activity), so the callout no longer+ // waits on the full paginated runs-window walk (which could take ~10s and was the reason the+ // callout appeared long after the modal opened).fleetFindingsSummary: [null as FleetFindingsSummaryApi | null,{@@ -463,17 +468,26 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([(s) => [s.runsWindow],(runsWindow: { complete: boolean; runs: SignalScoutRunSummary[] }): boolean => runsWindow.complete,],- // Fleet-wide findings tally for the "Scout findings" callout, read from the cheap backend- // summary rather than the paginated runs window. The backend counts the same capped set the- // findings page renders (most recent 120 emitted runs in the window), so the callout can't+ // Fleet-wide output tally for the "Scout findings" callout, read from the cheap backend+ // summary rather than the paginated runs window. Covers both emit channels — legacy findings+ // and reports authored/edited via the report channel — over the same capped set the findings+ // page renders (most recent 120 output runs in the window), so the callout can't// over-advertise. Zeroed until the summary loads.emittedFindingsSummary: [(s) => [s.fleetFindingsSummary],(fleetFindingsSummary: FleetFindingsSummaryApi | null- ): { count: number; scoutCount: number; latestAt: string | null } => ({+ ): {+ count: number+ scoutCount: number+ authoredReportCount: number+ editedReportCount: number+ latestAt: string | null+ } => ({count: fleetFindingsSummary?.count ?? 0,scoutCount: fleetFindingsSummary?.scout_count ?? 0,+ authoredReportCount: fleetFindingsSummary?.authored_report_count ?? 0,+ editedReportCount: fleetFindingsSummary?.edited_report_count ?? 0,latestAt: fleetFindingsSummary?.latest_at ?? null,}),],diff --git a/frontend/src/scenes/inbox/utils/scoutRunsWindow.test.ts b/frontend/src/scenes/inbox/utils/scoutRunsWindow.test.tsindex acade8011aa2..5d6b7bd1b3cd 100644--- a/frontend/src/scenes/inbox/utils/scoutRunsWindow.test.ts+++ b/frontend/src/scenes/inbox/utils/scoutRunsWindow.test.ts@@ -5,6 +5,7 @@ import {computeFleetSummary,computeScoutRollups,deriveRunOutcome,+ mostRecentEmittedRuns,reconcileById,runMatchesFilter,ScoutRunOutcome,@@ -96,6 +97,24 @@ describe('scoutRunsWindow report channel', () => {})})+ describe('mostRecentEmittedRuns', () => {+ it('includes report-channel-only runs alongside emitted runs, excluding quiet ones', () => {+ // The fleet findings page fetches this set — narrowing it back to `emitted_count > 0`+ // would silently drop report-authoring runs, so their reports never get listed.+ const runs = [+ makeRun({ run_id: 'run-findings', emitted_count: 1, emitted_finding_ids: ['f-1'] }),+ makeRun({ run_id: 'run-authored', emitted_report_ids: ['r-1'] }),+ makeRun({ run_id: 'run-edited', edited_report_ids: ['r-2'] }),+ makeRun({ run_id: 'run-quiet' }),+ ]+ expect(mostRecentEmittedRuns(runs).map((run) => run.run_id)).toEqual([+ 'run-findings',+ 'run-authored',+ 'run-edited',+ ])+ })+ })+describe('computeFleetSummary', () => {it('counts a report-only run toward emit rate, matching the Emitted filter', () => {// Guards the divergence where the fleet emit rate counted only `emitted_count > 0` while the@@ -103,6 +122,17 @@ describe('scoutRunsWindow report channel', () => {const rollups = computeScoutRollups([makeRun({ emitted_report_ids: ['r-1'] })])expect(computeFleetSummary([], rollups).emitRate).toEqual(1)})++ it('dedupes touched reports across scouts and channels', () => {+ // The pulse line counts distinct reports the fleet touched. Summing per-scout sets instead+ // would double-count a report authored by one scout and edited by another (r-1 below), and+ // the header would advertise more reports than the findings page lists.+ const rollups = computeScoutRollups([+ makeRun({ skill_name: 'scout-a', emitted_report_ids: ['r-1'] }),+ makeRun({ skill_name: 'scout-b', edited_report_ids: ['r-1', 'r-2'] }),+ ])+ expect(computeFleetSummary([], rollups).touchedReportCount).toEqual(2)+ })})describe('reconcileById', () => {diff --git a/frontend/src/scenes/inbox/utils/scoutRunsWindow.ts b/frontend/src/scenes/inbox/utils/scoutRunsWindow.tsindex 37225539a077..ea37def303fc 100644--- a/frontend/src/scenes/inbox/utils/scoutRunsWindow.ts+++ b/frontend/src/scenes/inbox/utils/scoutRunsWindow.ts@@ -37,11 +37,12 @@ export function scoutRunsWindowLabel(complete: boolean): string {// fan-out. Shared so the page (`findingsLogic`) and the callout summary count the exact same set.export const MAX_FLEET_EMITTED_RUNS = 120-/** The most recent emitted runs across the fleet, newest first, capped at `MAX_FLEET_EMITTED_RUNS`. */+/** The most recent output-producing runs across the fleet — runs that emitted a finding OR+ * authored/edited a report via the report channel — newest first, capped at `MAX_FLEET_EMITTED_RUNS`. */export function mostRecentEmittedRuns(runs: SignalScoutRunSummary[]): SignalScoutRunSummary[] {return (runs- .filter((run) => (run.emitted_count ?? 0) > 0)+ .filter((run) => runProducedOutput(run)).slice()// "Most recently emitted" — a run can complete (and emit) later than one created after it, so// order by completion, falling back to creation. Matches `emittedFindingsSummary`'s `latestAt`.@@ -387,6 +388,9 @@ export interface FleetSummary {enabledCount: numberrunningCount: numberemittedCount: number+ /** Distinct reports the fleet touched via the report channel (authored or edited) in the window,+ * deduped across runs, scouts, and channels — the report-side counterpart of `emittedCount`. */+ touchedReportCount: number/** Completed / (completed + failed) over the window, or null when no finished runs. */successRate: number | null/** Share of runs in the window that produced output — a signal OR report-channel activity — or null@@ -401,6 +405,7 @@ export function computeFleetSummary(configs: SignalScoutConfig[], rollups: Map<slet failedCount = 0let runCount = 0let emittedRunCount = 0+ const touchedReportIds = new Set<string>()for (const rollup of rollups.values()) {if (rollup.runningRun) {runningCount += 1@@ -409,6 +414,12 @@ export function computeFleetSummary(configs: SignalScoutConfig[], rollups: Map<scompletedCount += rollup.completedCountfailedCount += rollup.failedCountrunCount += rollup.runCount+ for (const reportId of rollup.authoredReportIds) {+ touchedReportIds.add(reportId)+ }+ for (const reportId of rollup.editedReportIds) {+ touchedReportIds.add(reportId)+ }for (const run of rollup.runs) {// Output = a weak finding OR report-channel activity, consistent with `runMatchesFilter('emitted')`// so the fleet emit rate and the per-scout "Emitted" chip never disagree about the same runs.@@ -423,6 +434,7 @@ export function computeFleetSummary(configs: SignalScoutConfig[], rollups: Map<senabledCount: configs.filter((config) => config.enabled).length,runningCount,emittedCount,+ touchedReportCount: touchedReportIds.size,successRate: finished > 0 ? completedCount / finished : null,emitRate: runCount > 0 ? emittedRunCount / runCount : null,}diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.tsindex bb0a0afa678d..401fe828567f 100644--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts@@ -203,6 +203,10 @@ export function buildObservationListParams(// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface replayScannerLogicValues {+ affectedCohort: {+ cohort_id: number+ } | null+ affectedCohortLoading: booleanavailableTags: string[]chartDateFrom: string | nullchartDateTo: string | null@@ -254,6 +258,7 @@ export interface replayScannerLogicValues {originalScanner: ReplayScanner | nullpollUntil: numberretryingObservationIds: string[]+ savingCohortTag: string | nullscanner: ReplayScannerscannerAllErrors: Record<string, any>scannerChanged: boolean@@ -262,6 +267,8 @@ export interface replayScannerLogicValues {scannerEstimateError: string | nullscannerEstimateLoading: booleanscannerHasErrors: boolean+ scannerImpact: ScannerImpactApi | null+ scannerImpactLoading: booleanscannerLoading: booleanscannerManualErrors: Record<string, any>scannerTouched: boolean@@ -342,6 +349,21 @@ export interface replayScannerLogicActions {loadScannerFailure: () => {value: true}+ loadScannerImpact: () => any+ loadScannerImpactFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadScannerImpactSuccess: (+ scannerImpact: ScannerImpactApi | null,+ payload?: any+ ) => {+ scannerImpact: ScannerImpactApi | null+ payload?: any+ }loadScannerSuccess: (scanner: ReplayScanner) => {scanner: ReplayScanner}@@ -395,6 +417,31 @@ export interface replayScannerLogicActions {retryObservationSuccess: (observationId: string) => {observationId: string}+ saveAffectedCohort: (tag?: string) => {+ tag: string | undefined+ }+ saveAffectedCohortFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ saveAffectedCohortSuccess: (+ affectedCohort: {+ cohort_id: number+ } | null,+ payload?: {+ tag: string | undefined+ }+ ) => {+ affectedCohort: {+ cohort_id: number+ } | null+ payload?: {+ tag: string | undefined+ }+ }scannerSaved: (scanner: ReplayScanner) => {scanner: ReplayScanner}diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.pyindex c350106fc3f2..69be3b1cbd8e 100644--- a/products/signals/backend/scout_harness/serializers.py+++ b/products/signals/backend/scout_harness/serializers.py@@ -278,23 +278,45 @@ class RecentEmissionsQuerySerializer(serializers.Serializer):class FleetFindingsSummarySerializer(serializers.Serializer):- """Fleet-wide tally of recently emitted findings — backs the "Scout findings" callout so it- renders from one cheap query instead of the client walking the whole paginated runs window."""+ """Fleet-wide tally of recent scout output — legacy `emit_signal` findings plus reports+ authored/edited via the report channel. Backs the "Scout findings" callout so it renders+ from one cheap query instead of the client walking the whole paginated runs window."""count = serializers.IntegerField(help_text=(- "Total findings the fleet emitted in the window — the sum of each emitted run's "- "`emitted_count`, over the most recent 120 emitted runs."+ "Total findings the fleet emitted in the window — the sum of each run's "+ "`emitted_count`, over the most recent 120 runs that produced output."))scout_count = serializers.IntegerField(- help_text="Number of distinct scouts (skills) that emitted at least one finding in the window."+ help_text=(+ "Number of distinct scouts (skills) that produced output in the window — emitted a "+ "finding, or authored/edited an inbox report that survives the 50-report cap (a "+ "report-only scout whose touched reports all fell outside the cap is not counted, "+ "matching the findings page's scout filter)."+ )+ )+ authored_report_count = serializers.IntegerField(+ help_text=(+ "Number of distinct inbox reports scouts authored via `emit_report`, deduped across runs, "+ "over the same most-recent-120-output-runs set as `count`, capped to the 50 most recently "+ "touched reports (the same slice the findings page lists)."+ )+ )+ edited_report_count = serializers.IntegerField(+ help_text=(+ "Number of distinct inbox reports scouts edited via `edit_report`, deduped across runs, "+ "over the same most-recent-120-output-runs set as `count`, capped to the 50 most recently "+ "touched reports (the same slice the findings page lists) and excluding reports also "+ "authored within that set (authoring supersedes an edit; a report whose authoring run "+ "falls outside the cap counts as edited)."+ ))latest_at = serializers.DateTimeField(allow_null=True,help_text=(- "ISO-8601 timestamp of the most recently emitted finding's run (TaskRun completion, "- "falling back to run creation), or null when nothing was emitted in the window."+ "ISO-8601 timestamp of the most recent output run (TaskRun completion, falling back "+ "to run creation), or null when nothing was produced in the window."),)diff --git a/products/signals/backend/scout_harness/tools/runs.py b/products/signals/backend/scout_harness/tools/runs.pyindex 678a88867254..bf95b0cb33c8 100644--- a/products/signals/backend/scout_harness/tools/runs.py+++ b/products/signals/backend/scout_harness/tools/runs.py@@ -35,12 +35,14 @@ DEFAULT_RUN_SEARCH_LIMIT = 20MAX_RUN_SEARCH_LIMIT = 100# The "Scout findings" callout summary tallies findings over a fixed lookback window. The default-# window and the run cap mirror the cloud/desktop frontend (`SCOUT_RUNS_WINDOW_HOURS = 72` /-# `MAX_FLEET_EMITTED_RUNS = 120`) so the callout count matches the set the findings page renders;-# the max window bounds a pathological lookback.+# window, the run cap, and the report cap mirror the cloud/desktop frontend+# (`SCOUT_RUNS_WINDOW_HOURS = 72` / `MAX_FLEET_EMITTED_RUNS = 120` / `MAX_FLEET_TOUCHED_REPORTS = 50`)+# so the callout counts match the set the findings page renders; the max window bounds a+# pathological lookback.DEFAULT_FINDINGS_WINDOW_HOURS = 72MAX_FINDINGS_WINDOW_HOURS = 168FLEET_FINDINGS_SUMMARY_RUN_CAP = 120+FLEET_FINDINGS_SUMMARY_REPORT_CAP = 50# `failure_reason` is the concise, list-safe derived signal; `error` carries the full# `TaskRun.error_message`. Bound the derived reason so it stays cheap to scan in bulk.@@ -176,10 +178,17 @@ def search_recent_runs(@dataclass(frozen=True)class FleetFindingsSummary:- """Cheap fleet-wide tally of recently emitted findings — what the "Scout findings" callout reads."""+ """Cheap fleet-wide tally of recent scout output — what the "Scout findings" callout reads.++ Covers both emit channels: weak `emit_signal` findings (`count`) and the report channel+ (`authored_report_count` / `edited_report_count`), so a fleet of report-channel scouts+ doesn't read as silent.+ """count: intscout_count: int+ authored_report_count: int+ edited_report_count: intlatest_at: str | Nonedef as_dict(self) -> dict[str, Any]:@@ -187,36 +196,74 @@ class FleetFindingsSummary:def fleet_findings_summary(*, team_id: int, window_hours: int = DEFAULT_FINDINGS_WINDOW_HOURS) -> FleetFindingsSummary:- """Summarise the findings the fleet emitted in the recent window, in a single query.+ """Summarise the output the fleet produced in the recent window, in a single query.Replaces the client-side tally that walked the whole paginated runs window just to count- findings for the callout. Counts only emitted runs (`emitted_count > 0`) whose `created_at`- falls in the last `window_hours`, capped to the most recent `FLEET_FINDINGS_SUMMARY_RUN_CAP`- runs by completion time (falling back to creation) — the same set the findings page renders,- so the callout can't over-advertise. Returns the finding total (sum of `emitted_count`), the- distinct scout count, and the most recent emission time.+ findings for the callout. Counts runs that produced output on either channel — emitted a+ finding (`emitted_count > 0`) or authored/edited an inbox report (non-empty+ `emitted_report_ids` / `edited_report_ids`) — whose `created_at` falls in the last+ `window_hours`, capped to the most recent `FLEET_FINDINGS_SUMMARY_RUN_CAP` runs by completion+ time (falling back to creation) — the same set the findings page renders, so the callout+ can't over-advertise. Returns the finding total (sum of `emitted_count`), the distinct scout+ count, the distinct reports authored and edited (edits of a report also authored *within the+ capped run set* fold into authored, matching the scout detail view — a report whose authoring+ run ages out of the cap while a later edit survives counts as edited, the same classification+ the findings page derives from its identically-capped window), and the most recent output time.+ The report tallies are additionally capped at the `FLEET_FINDINGS_SUMMARY_REPORT_CAP` most+ recently touched reports — the same 50 the findings page slices `touchedReports` to — so the+ callout never advertises reports the page won't list."""window_hours = max(1, min(window_hours, MAX_FINDINGS_WINDOW_HOURS))window_start = timezone.now() - timedelta(hours=window_hours)+ touched_a_report = (~Q(emitted_report_ids=[]) & ~Q(emitted_report_ids__isnull=True)) | (+ ~Q(edited_report_ids=[]) & ~Q(edited_report_ids__isnull=True)+ )# Order by completion (fall back to creation) so the cap keeps the *most recently emitted* runs,# matching the frontend's `completed_at ?? created_at` sort; `-id` tie-breaks on the time-ordered PK.rows = (- SignalScoutRun.objects.filter(team_id=team_id, created_at__gte=window_start, emitted_count__gt=0)+ SignalScoutRun.objects.filter(team_id=team_id, created_at__gte=window_start)+ .filter(Q(emitted_count__gt=0) | touched_a_report).annotate(_emitted_at=Coalesce("task_run__completed_at", "created_at")).order_by("-_emitted_at", "-id")- .values_list("emitted_count", "skill_name", "_emitted_at")[:FLEET_FINDINGS_SUMMARY_RUN_CAP]+ .values_list("emitted_count", "skill_name", "_emitted_at", "emitted_report_ids", "edited_report_ids")[+ :FLEET_FINDINGS_SUMMARY_RUN_CAP+ ])+ materialized = list(rows)count = 0scouts: set[str] = set()latest_at: datetime | None = None- for emitted_count, skill_name, emitted_at in rows:+ for emitted_count, skill_name, emitted_at, _emitted_report_ids, _edited_report_ids in materialized:count += emitted_count or 0- scouts.add(skill_name)+ # Finding-emitting scouts always count (findings aren't report-capped); report-only scouts+ # are added below only when a report they touched survives the report cap — the same rule+ # the findings page uses for its scout filter, so the callout can't advertise a scout the+ # page won't show.+ if emitted_count:+ scouts.add(skill_name)if emitted_at is not None and (latest_at is None or emitted_at > latest_at):latest_at = emitted_at+ # Distinct touched reports, most recently touched first (rows are newest-first), capped at the+ # same 50 the findings page keeps (`MAX_FLEET_TOUCHED_REPORTS`) — so the callout never+ # advertises reports the page has sliced away. Dict preserves insertion (recency) order.+ kept_report_ids: dict[str, None] = {}+ for _, _, _, emitted_report_ids, edited_report_ids in materialized:+ for report_id in [*(edited_report_ids or []), *(emitted_report_ids or [])]:+ if report_id not in kept_report_ids and len(kept_report_ids) < FLEET_FINDINGS_SUMMARY_REPORT_CAP:+ kept_report_ids[report_id] = None+ for _, skill_name, _, emitted_report_ids, edited_report_ids in materialized:+ if any(report_id in kept_report_ids for report_id in [*(emitted_report_ids or []), *(edited_report_ids or [])]):+ scouts.add(skill_name)+ # Authoring supersedes an edit of the same report — one report, one bucket.+ authored_reports: set[str] = set()+ for _, _, _, emitted_report_ids, _edited_report_ids in materialized:+ authored_reports.update(report_id for report_id in emitted_report_ids or [] if report_id in kept_report_ids)+ edited_reports = {report_id for report_id in kept_report_ids if report_id not in authored_reports}return FleetFindingsSummary(count=count,scout_count=len(scouts),+ authored_report_count=len(authored_reports),+ edited_report_count=len(edited_reports),latest_at=latest_at.isoformat() if latest_at is not None else None,)diff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.pyindex d3d5726ebb9b..ddd5a8ce905a 100644--- a/products/signals/backend/scout_harness/views.py+++ b/products/signals/backend/scout_harness/views.py@@ -427,17 +427,18 @@ class SignalScoutRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):responses={200: OpenApiResponse(response=FleetFindingsSummarySerializer,- description="Fleet-wide tally of recently emitted findings.",+ description="Fleet-wide tally of recent scout output — findings and report activity.",),},- summary="Summarise recently emitted findings across the fleet",+ summary="Summarise recent scout output across the fleet",description=(- "Return a cheap fleet-wide tally of the findings the scout troop emitted in the recent window — "- "the total count, the number of distinct scouts behind them, and the latest emission time. "- "Backs the 'Scout findings' callout so it renders from one query instead of the client paging "- "through the whole runs window. Counts only runs that emitted at least one finding "- "(`emitted_count > 0`) within the last `window_hours` (default 72), capped to the most recent "- "120 emitted runs so the count matches what the findings list renders. Strictly team-scoped."+ "Return a cheap fleet-wide tally of the output the scout troop produced in the recent window — "+ "the finding count, the distinct reports authored/edited via the report channel, the number of "+ "distinct scouts behind them, and the latest output time. Backs the 'Scout findings' callout so "+ "it renders from one query instead of the client paging through the whole runs window. Counts "+ "runs that emitted at least one finding (`emitted_count > 0`) or authored/edited an inbox report "+ "within the last `window_hours` (default 72), capped to the most recent 120 such runs so the "+ "count matches what the findings list renders. Strictly team-scoped."),operation_id="signals_scout_runs_findings_summary",)diff --git a/products/signals/backend/test/test_scout_harness_api.py b/products/signals/backend/test/test_scout_harness_api.pyindex bc3e110f37b5..21ada855810a 100644--- a/products/signals/backend/test/test_scout_harness_api.py+++ b/products/signals/backend/test/test_scout_harness_api.py@@ -551,6 +551,40 @@ class TestScoutHarnessFindingsSummaryAPI(APIBaseTest):assert body["scout_count"] == 2assert body["latest_at"] is not None+ def test_summary_counts_report_channel_activity(self) -> None:+ # Scouts now author/edit inbox reports directly instead of only emitting legacy findings.+ # Reverting the summary to `emitted_count > 0` alone would make a report-channel fleet read+ # as zero output and hide the callout entirely. Also guards the dedupe rules: report ids+ # dedupe across runs, and a report both authored and edited counts once, as authored.+ _make_run(self.team, skill_name="signals-scout-errors", emitted_report_ids=["r-1"])+ _make_run(self.team, skill_name="signals-scout-errors", emitted_report_ids=["r-1"])+ _make_run(self.team, skill_name="signals-scout-llm", edited_report_ids=["r-1", "r-2"])+ _make_run(self.team, skill_name="signals-scout-general") # quiet — no output on either channel+ response = self.client.get(self._url())+ assert response.status_code == status.HTTP_200_OK+ body = response.json()+ assert body["count"] == 0+ assert body["authored_report_count"] == 1+ assert body["edited_report_count"] == 1+ assert body["scout_count"] == 2+ assert body["latest_at"] is not None++ def test_summary_caps_report_tallies_to_most_recently_touched(self) -> None:+ # The report tallies share the findings page's 50-report slice (most recently touched first).+ # Uncapping them would let the callout advertise reports the page never lists — with the cap+ # patched to 1, only the newest-touched report may count.+ _make_run(self.team, skill_name="signals-scout-errors", edited_report_ids=["r-old"])+ _make_run(self.team, skill_name="signals-scout-llm", emitted_report_ids=["r-new"])+ with patch("products.signals.backend.scout_harness.tools.runs.FLEET_FINDINGS_SUMMARY_REPORT_CAP", 1):+ response = self.client.get(self._url())+ assert response.status_code == status.HTTP_200_OK+ body = response.json()+ assert body["authored_report_count"] == 1+ assert body["edited_report_count"] == 0+ # The errors scout's only touched report fell outside the cap — it must not count either,+ # or the callout advertises a scout the findings page's filter won't show.+ assert body["scout_count"] == 1+def test_summary_excludes_runs_outside_the_window(self) -> None:# Guards the `created_at` window filter: a finding emitted before the lookback must not count,# else the callout would advertise stale findings the findings page won't show.diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex 5dafb4e6a242..f77cac72b1c9 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -2293,16 +2293,21 @@ export interface ScoutRunIdsBatchRequestApi {}/**- * Fleet-wide tally of recently emitted findings — backs the "Scout findings" callout so it- * renders from one cheap query instead of the client walking the whole paginated runs window.+ * Fleet-wide tally of recent scout output — legacy `emit_signal` findings plus reports+ * authored/edited via the report channel. Backs the "Scout findings" callout so it renders+ * from one cheap query instead of the client walking the whole paginated runs window.*/export interface FleetFindingsSummaryApi {- /** Total findings the fleet emitted in the window — the sum of each emitted run's `emitted_count`, over the most recent 120 emitted runs. */+ /** Total findings the fleet emitted in the window — the sum of each run's `emitted_count`, over the most recent 120 runs that produced output. */count: number- /** Number of distinct scouts (skills) that emitted at least one finding in the window. */+ /** Number of distinct scouts (skills) that produced output in the window — emitted a finding, or authored/edited an inbox report that survives the 50-report cap (a report-only scout whose touched reports all fell outside the cap is not counted, matching the findings page's scout filter). */scout_count: number+ /** Number of distinct inbox reports scouts authored via `emit_report`, deduped across runs, over the same most-recent-120-output-runs set as `count`, capped to the 50 most recently touched reports (the same slice the findings page lists). */+ authored_report_count: number+ /** Number of distinct inbox reports scouts edited via `edit_report`, deduped across runs, over the same most-recent-120-output-runs set as `count`, capped to the 50 most recently touched reports (the same slice the findings page lists) and excluding reports also authored within that set (authoring supersedes an edit; a report whose authoring run falls outside the cap counts as edited). */+ edited_report_count: number/**- * ISO-8601 timestamp of the most recently emitted finding's run (TaskRun completion, falling back to run creation), or null when nothing was emitted in the window.+ * ISO-8601 timestamp of the most recent output run (TaskRun completion, falling back to run creation), or null when nothing was produced in the window.* @nullable*/latest_at: string | nulldiff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.tsindex 3509e5cd399a..f51697e95efa 100644--- a/products/signals/frontend/generated/api.ts+++ b/products/signals/frontend/generated/api.ts@@ -929,8 +929,8 @@ export const getSignalsScoutRunsFindingsSummaryUrl = (}/**- * Return a cheap fleet-wide tally of the findings the scout troop emitted in the recent window — the total count, the number of distinct scouts behind them, and the latest emission time. Backs the 'Scout findings' callout so it renders from one query instead of the client paging through the whole runs window. Counts only runs that emitted at least one finding (`emitted_count > 0`) within the last `window_hours` (default 72), capped to the most recent 120 emitted runs so the count matches what the findings list renders. Strictly team-scoped.- * @summary Summarise recently emitted findings across the fleet+ * Return a cheap fleet-wide tally of the output the scout troop produced in the recent window — the finding count, the distinct reports authored/edited via the report channel, the number of distinct scouts behind them, and the latest output time. Backs the 'Scout findings' callout so it renders from one query instead of the client paging through the whole runs window. Counts runs that emitted at least one finding (`emitted_count > 0`) or authored/edited an inbox report within the last `window_hours` (default 72), capped to the most recent 120 such runs so the count matches what the findings list renders. Strictly team-scoped.+ * @summary Summarise recent scout output across the fleet*/export const signalsScoutRunsFindingsSummary = async (projectId: string,diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex a5322b8dbd71..11febff91d3d 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -28536,16 +28536,21 @@ export namespace Schemas {}/**- * Fleet-wide tally of recently emitted findings — backs the "Scout findings" callout so it- * renders from one cheap query instead of the client walking the whole paginated runs window.+ * Fleet-wide tally of recent scout output — legacy `emit_signal` findings plus reports+ * authored/edited via the report channel. Backs the "Scout findings" callout so it renders+ * from one cheap query instead of the client walking the whole paginated runs window.*/export interface FleetFindingsSummary {- /** Total findings the fleet emitted in the window — the sum of each emitted run's `emitted_count`, over the most recent 120 emitted runs. */+ /** Total findings the fleet emitted in the window — the sum of each run's `emitted_count`, over the most recent 120 runs that produced output. */count: number;- /** Number of distinct scouts (skills) that emitted at least one finding in the window. */+ /** Number of distinct scouts (skills) that produced output in the window — emitted a finding, or authored/edited an inbox report that survives the 50-report cap (a report-only scout whose touched reports all fell outside the cap is not counted, matching the findings page's scout filter). */scout_count: number;+ /** Number of distinct inbox reports scouts authored via `emit_report`, deduped across runs, over the same most-recent-120-output-runs set as `count`, capped to the 50 most recently touched reports (the same slice the findings page lists). */+ authored_report_count: number;+ /** Number of distinct inbox reports scouts edited via `edit_report`, deduped across runs, over the same most-recent-120-output-runs set as `count`, capped to the 50 most recently touched reports (the same slice the findings page lists) and excluding reports also authored within that set (authoring supersedes an edit; a report whose authoring run falls outside the cap counts as edited). */+ edited_report_count: number;/**- * ISO-8601 timestamp of the most recently emitted finding's run (TaskRun completion, falling back to run creation), or null when nothing was emitted in the window.+ * ISO-8601 timestamp of the most recent output run (TaskRun completion, falling back to run creation), or null when nothing was produced in the window.* @nullable*/latest_at: string | null;