Skip to content

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

feat(signals): scout detail page skeleton in the web inbox (#64642)

Andrew Maguire8ab8ffd58fc6
diff --git a/frontend/src/scenes/inbox/InboxScene.tsx b/frontend/src/scenes/inbox/InboxScene.tsx
index 5a8b8c8ec429..024ff74a8269 100644
--- a/frontend/src/scenes/inbox/InboxScene.tsx
+++ b/frontend/src/scenes/inbox/InboxScene.tsx
@@ -10,6 +10,7 @@ import { SceneExport } from 'scenes/sceneTypes'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
+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'
@@ -120,16 +121,21 @@ function InboxDetailView({ report }: { report: SignalReport }): JSX.Element {
}
export function InboxScene(): JSX.Element {
- const { isRunningSessionAnalysis, selectedReportId, selectedReport, selectedReportLoading } =
- useValues(inboxSceneLogic)
+ const {
+ isRunningSessionAnalysis,
+ selectedReportId,
+ selectedReport,
+ selectedReportLoading,
+ selectedScoutSkillName,
+ } = useValues(inboxSceneLogic)
const { runSessionAnalysis } = useActions(inboxSceneLogic)
const { isDev } = useValues(preflightLogic)
- // Detail route renders full-width over the list (desktop parity), but the list view 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
+ // Detail routes (report or scout) render full-width over the list (desktop parity), but the list view
+ // 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
return (
<SceneContent className="gap-y-0 border-b-0 flex-1 min-h-0">
@@ -164,7 +170,9 @@ export function InboxScene(): JSX.Element {
{showDetail && (
<div className="flex flex-col -mx-4 flex-1 min-h-0">
- {selectedReport ? (
+ {selectedScoutSkillName ? (
+ <ScoutDetailView skillName={selectedScoutSkillName} />
+ ) : selectedReport ? (
<InboxDetailView report={selectedReport} />
) : selectedReportLoading ? (
<div className="flex flex-col min-h-0 flex-1 overflow-auto">
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutDetailView.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutDetailView.tsx
new file mode 100644
index 000000000000..dac8ffc1c8b5
--- /dev/null
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutDetailView.tsx
@@ -0,0 +1,84 @@
+import { useActions, useValues } from 'kea'
+import { useEffect } from 'react'
+
+import { IconArrowLeft } from '@posthog/icons'
+import { LemonButton, LemonSkeleton } from '@posthog/lemon-ui'
+
+import { pluralize } from 'lib/utils/strings'
+
+import { inboxSceneLogic } from '../../../inboxSceneLogic'
+import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'
+import { SCOUT_RUNS_WINDOW_SPAN, scoutRunsWindowLabel } from '../../../utils/scoutRunsWindow'
+import { ScoutRowCard } from './ScoutRowCard'
+
+/**
+ * Full-width scout detail surface, rendered over the inbox list at `/inbox/scouts/:skillName`.
+ * Skeleton (W1): back link, the shared `ScoutRowCard` as the header, and the recent-window
+ * rollup line. The Signals section (emission cards) and per-scout run history land next (W2/W3).
+ */
+export function ScoutDetailView({ skillName }: { skillName: string }): JSX.Element {
+ const { scoutConfigs, rollups, runsWindowComplete } = useValues(scoutFleetLogic)
+ const { updateScoutConfig, startRunsPolling, stopRunsPolling } = useActions(scoutFleetLogic)
+ const { setSelectedScoutSkillName } = useActions(inboxSceneLogic)
+
+ // Deep-linking straight to a scout (or a narrow viewport where the fleet list isn't mounted)
+ // means nobody else is polling the runs window, so the header + rollup would read empty
+ // defaults. Drive the same start/stop lifecycle the fleet section uses.
+ useEffect(() => {
+ startRunsPolling()
+ return () => stopRunsPolling()
+ }, [startRunsPolling, stopRunsPolling])
+
+ const config = scoutConfigs?.find((c) => c.skill_name === skillName) ?? null
+ const rollup = rollups.get(skillName)
+
+ return (
+ <div className="flex flex-col min-h-0 flex-1 overflow-auto gap-4 px-4 py-3">
+ <LemonButton
+ type="tertiary"
+ size="small"
+ icon={<IconArrowLeft />}
+ onClick={() => setSelectedScoutSkillName(null)}
+ className="self-start"
+ >
+ Scouts
+ </LemonButton>
+
+ {scoutConfigs === null ? (
+ // Configs unresolved (loading, not-yet-fetched on a fresh deep-link mount, or a failed
+ // load — never an empty fleet, which is `[]`). Hold the skeleton so "Scout not found"
+ // can't flash before we actually have the fleet to look in.
+ <LemonSkeleton className="h-16 w-full rounded" />
+ ) : config === null ? (
+ <div className="flex flex-1 items-center justify-center text-sm text-tertiary">Scout not found.</div>
+ ) : (
+ <>
+ <ScoutRowCard config={config} rollup={rollup} onUpdate={updateScoutConfig} asHeader />
+
+ <div className="flex flex-col gap-1">
+ <span className="text-xs font-medium text-default uppercase tracking-wide">
+ Last {SCOUT_RUNS_WINDOW_SPAN}
+ </span>
+ <span className="text-sm text-secondary">
+ {rollup && rollup.runCount > 0 ? (
+ <>
+ {pluralize(rollup.runCount, 'run')} · {rollup.completedCount} completed ·{' '}
+ {rollup.failedCount} failed · {pluralize(rollup.emittedCount, 'signal')} emitted
+ </>
+ ) : (
+ 'No runs in this window.'
+ )}
+ {!runsWindowComplete && (
+ <span className="text-muted"> · {scoutRunsWindowLabel(runsWindowComplete)}</span>
+ )}
+ </span>
+ </div>
+
+ <div className="rounded border border-dashed border-primary bg-bg-light px-4 py-6 text-center text-sm text-muted">
+ Signals and run history are coming to this view soon.
+ </div>
+ </>
+ )}
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx
index d9b806592b30..d8df4632e975 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx
@@ -2,7 +2,7 @@ import clsx from 'clsx'
import { useActions, useValues } from 'kea'
import { useState } from 'react'
-import { IconGear, IconSparkles } from '@posthog/icons'
+import { IconArrowUpRight, IconGear, IconSparkles } from '@posthog/icons'
import { LemonButton, Link, Tooltip } from '@posthog/lemon-ui'
import { pluralize } from 'lib/utils/strings'
@@ -16,6 +16,7 @@ import {
prettifyScoutSkillName,
ScoutRollup,
} from '../../../utils/scoutRunsWindow'
+import { agentSetupModalLogic } from '../../shell/agentSetupModalLogic'
import { DryRunBadge, ScoutOriginBadge } from './ScoutBadges'
import { ScoutConfigForm, ScoutEnabledSwitch } from './ScoutConfigControls'
import { ScoutRunBoxes } from './ScoutRunBoxes'
@@ -28,31 +29,54 @@ export function ScoutRowCard({
config,
rollup,
onUpdate,
+ asHeader = false,
}: {
config: SignalScoutConfig
rollup: ScoutRollup | undefined
onUpdate: (configId: string, updates: SignalScoutConfigUpdate) => void
+ /** When rendered as the scout detail header the name is plain text (the row IS the page). */
+ asHeader?: boolean
}): JSX.Element {
const [settingsOpen, setSettingsOpen] = useState(false)
+ const { closeSetupModal } = useActions(agentSetupModalLogic)
+ const displayName = prettifyScoutSkillName(config.skill_name)
return (
<div
className={clsx(
- 'group flex flex-col rounded border border-primary bg-bg-light px-4 py-3 transition-colors hover:border-primary-3000 hover:bg-bg-3000',
+ 'flex flex-col rounded border border-primary bg-bg-light px-4 py-3',
+ !asHeader && 'group transition-colors hover:border-primary-3000 hover:bg-bg-3000',
!config.enabled && 'opacity-65'
)}
>
<div className="flex items-center gap-4">
<div className="flex items-center gap-2 min-w-0 flex-1">
+ {asHeader ? (
+ <span className="truncate font-medium text-sm">{displayName}</span>
+ ) : (
+ <Tooltip title={`${config.skill_name} · view scout`}>
+ <Link
+ to={urls.inboxScout(config.skill_name)}
+ // The fleet list lives in the setup modal, which portals outside the
+ // (hidden) list subtree — close it so it doesn't cover the detail page.
+ onClick={() => closeSetupModal()}
+ subtle
+ className="truncate font-medium text-sm"
+ >
+ {displayName}
+ </Link>
+ </Tooltip>
+ )}
<Tooltip title={`${config.skill_name} · open skill`}>
<Link
to={urls.skill(config.skill_name)}
target="_blank"
targetBlankIcon={false}
subtle
- className="truncate font-medium text-sm"
+ className="shrink-0 text-muted"
+ aria-label={`Open the ${config.skill_name} skill`}
>
- {prettifyScoutSkillName(config.skill_name)}
+ <IconArrowUpRight className="size-3.5" />
</Link>
</Tooltip>
<ScoutOriginBadge skillName={config.skill_name} />
diff --git a/frontend/src/scenes/inbox/inboxSceneLogic.ts b/frontend/src/scenes/inbox/inboxSceneLogic.ts
index b9aaf6e1b77b..c8bf7692b6d8 100644
--- a/frontend/src/scenes/inbox/inboxSceneLogic.ts
+++ b/frontend/src/scenes/inbox/inboxSceneLogic.ts
@@ -71,6 +71,8 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
// detail renders without a spinner while the authoritative fetch runs in the background.
seedSelectedReport: (report: SignalReport | null) => ({ report }),
setActiveTab: (tab: InboxTabKey) => ({ tab }),
+ // Scout detail surface: selecting a scout opens its full-width detail over the list.
+ setSelectedScoutSkillName: (skillName: string | null) => ({ skillName }),
runSessionAnalysis: true,
runSessionAnalysisSuccess: true,
runSessionAnalysisFailure: (error: string) => ({ error }),
@@ -122,6 +124,12 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
setActiveTab: (_, { tab }) => tab,
},
],
+ selectedScoutSkillName: [
+ null as string | null,
+ {
+ setSelectedScoutSkillName: (_, { skillName }) => skillName,
+ },
+ ],
isRunningSessionAnalysis: [
false,
{
@@ -172,10 +180,19 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
actions.seedSelectedReport(null)
return
}
+ // A report and a scout detail are mutually exclusive full-width views.
+ if (values.selectedScoutSkillName !== null) {
+ actions.setSelectedScoutSkillName(null)
+ }
// Reuse the list row if we already have it (instant render), then refresh from the server.
actions.seedSelectedReport(findLoadedReport(id, values.runsTabReports))
actions.loadSelectedReport({ id })
},
+ setSelectedScoutSkillName: ({ skillName }) => {
+ if (skillName !== null && values.selectedReportId !== null) {
+ actions.setSelectedReportId(null)
+ }
+ },
loadSourceConfigsSuccess: () => {
clearInterval(cache.sessionAnalysisPollInterval)
if (values.isSessionAnalysisRunning) {
@@ -218,9 +235,23 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
{ replace: false },
],
setSelectedReportId: () => [
+ // When a report is cleared because a scout was just selected (mutually exclusive views),
+ // honor the scout's URL rather than bouncing to the list and clobbering the scout route.
values.selectedReportId
? urls.inboxReport(values.activeTab, values.selectedReportId)
- : urls.inbox(values.activeTab),
+ : values.selectedScoutSkillName
+ ? urls.inboxScout(values.selectedScoutSkillName)
+ : urls.inbox(values.activeTab),
+ router.values.searchParams,
+ router.values.hashParams,
+ { replace: false },
+ ],
+ setSelectedScoutSkillName: () => [
+ values.selectedScoutSkillName
+ ? urls.inboxScout(values.selectedScoutSkillName)
+ : values.selectedReportId
+ ? urls.inboxReport(values.activeTab, values.selectedReportId)
+ : urls.inbox(values.activeTab),
router.values.searchParams,
router.values.hashParams,
{ replace: false },
@@ -232,6 +263,9 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
if (values.selectedReportId !== null) {
actions.setSelectedReportId(null)
}
+ if (values.selectedScoutSkillName !== null) {
+ actions.setSelectedScoutSkillName(null)
+ }
},
[urls.inbox(':tab')]: ({ tab }: { tab?: string }) => {
// Staff-only tabs (Runs, Not actionable): bounce non-staff to the default tab.
@@ -245,8 +279,21 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
if (values.selectedReportId !== null) {
actions.setSelectedReportId(null)
}
+ if (values.selectedScoutSkillName !== null) {
+ actions.setSelectedScoutSkillName(null)
+ }
+ },
+ [urls.inboxScout(':skillName')]: ({ skillName }: { skillName?: string }) => {
+ const name = skillName ?? null
+ if (values.selectedScoutSkillName !== name) {
+ actions.setSelectedScoutSkillName(name)
+ }
},
[urls.inboxReport(':tab', ':reportId')]: ({ tab, reportId }: { tab?: string; reportId?: string }) => {
+ // This pattern also matches `/inbox/scouts/<skillName>`; the scout handler owns that path.
+ if (tab === 'scouts') {
+ return
+ }
if (isStaffOnlyTab(tab) && userLogic.values.user != null && !values.isStaff) {
actions.setActiveTab('pulls')
return
diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.ts
index 2a059d88f711..6004c3b06d67 100644
--- a/frontend/src/scenes/scenes.ts
+++ b/frontend/src/scenes/scenes.ts
@@ -930,6 +930,8 @@ export const routes: Record<string, [Scene | string, string]> = {
[urls.health()]: [Scene.Health, 'health'],
[urls.inbox()]: [Scene.Inbox, 'inbox'],
[urls.inbox(':tab')]: [Scene.Inbox, 'inbox'],
+ // Registered before the generic report route: both are two-segment `/inbox/x/y` shapes.
+ [urls.inboxScout(':skillName')]: [Scene.Inbox, 'inbox'],
[urls.inboxReport(':tab', ':reportId')]: [Scene.Inbox, 'inbox'],
[urls.pipelineStatus()]: [Scene.PipelineStatus, 'pipelineStatus'],
[urls.sdkHealth()]: [Scene.SdkHealth, 'sdkHealth'],
diff --git a/frontend/src/scenes/urls.ts b/frontend/src/scenes/urls.ts
index d2ff134494c6..9fa7e13943df 100644
--- a/frontend/src/scenes/urls.ts
+++ b/frontend/src/scenes/urls.ts
@@ -299,6 +299,8 @@ export const urls = {
// Inbox 2.0 tab-first routing: /inbox, /inbox/<tab>, /inbox/<tab>/<reportId>.
inbox: (tab?: InboxTabKey | ':tab'): string => `/inbox${tab ? `/${tab}` : ''}`,
inboxReport: (tab: InboxTabKey | ':tab', reportId: string | ':reportId'): string => `/inbox/${tab}/${reportId}`,
+ // Scout detail surface, full-width over the inbox list (the fleet section lives in the Configuration tab).
+ inboxScout: (skillName: string | ':skillName'): string => `/inbox/scouts/${skillName}`,
webAnalyticsBotAnalytics: (): string => '/web/bots',
webAnalyticsHealth: (): string => '/web/health',
pipelineStatus: (): string => '/health/pipeline-status',