: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
fix(signals): make the scout told tab scout-specific and link the scratchpad (#125679)
posthog[bot]a3339ee572a8
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 29889385547d..37cb0b2da256 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -12479,9 +12479,9 @@ snapshots:scenes-app-inbox-scene--report-without-evidence--light:hash: v1.k794b7964.e6d12bd6f862ac226548a221d7e6c4655cd2455d24903d31122ddc5c691451d9.EGSzgF4ca3R8GPVWCpadnc-09_LgNoXebfytHYYZA9wscenes-app-inbox-scene--scouts--dark:- hash: v1.k794b7964.4c6c476bbe52a64bd89c81117a4a0bff8a4102920a03a8d722cff93177e5d209.DXZfqtUBd5_2Mg7tNceVoR_iiw-2yG655qhWQz2oWNc+ hash: v1.k794b7964.342b6ade0a3245d92d924e2e7d37484d96e28dcc699b3f565f87c8dfda96be96.T5RoSmtn2CUXtooHEFwovo4fJfyjBXJDwg9KGBQs-lsscenes-app-inbox-scene--scouts--light:- hash: v1.k794b7964.751f7acf90211fb843c29021e4c5c07199a016d3758a98aebd030a2459e7e727.-dob_PqMSyNGS0sWCDRL7239l7w9pUTs5Oil7XD97cM+ hash: v1.k794b7964.99b86171afccba43b9d785a00193c8bd77a2717c053fa13b964c75528aa64c68.Xq6z6ABYxz3U2XexihC6Cc9cbFqXD51rxysP6XxASCMscenes-app-inbox-scene--self-driving-onboarding--dark:hash: v1.k794b7964.46d59bd7778029f586a0e9eb50ebbfd731a040dcaf605844f9322cbfcef21018.9wzJ-Sog0L0eQcy-CXKD3y8b8qX5EL-xDKjL8G3Oxpcscenes-app-inbox-scene--self-driving-onboarding--light:@@ -12903,9 +12903,9 @@ snapshots:scenes-app-inbox-scoutsuggestionsstrip--low-activity--light:hash: v1.k794b7964.d3e9167ac6ce1fa16ab27175c2f62dec069c739efb213391b0c652a736d1920b.po2oo5Ii0tv7MLw6_SkVWHjGlmg7Nwvbua4MVcAkQ2oscenes-app-inbox-scoutsuggestionsstrip--narrow--dark:- hash: v1.k794b7964.b9ca13a41bed32023a43f006360e43b4b321b1e6cb31998e2eb3e860eac7a0f6.lDOXRuPYgisBlZOeEdJmKfyq2H55P3xVgiH_ZoqGFL8+ hash: v1.k794b7964.430290aad9653c513a0273ac785ea917107832eaabe6e294743f58c41261458e.LzfPwJISoPJNUhK4-Rimc4xlls8xNB-gc232GbYpAr0scenes-app-inbox-scoutsuggestionsstrip--narrow--light:- hash: v1.k794b7964.7ac141242ca1eff00382eabeb3a43499013fe0fd5348caa2fdb68358b546607f.hPLQzahnOp_1pNfmoDe6VzfxtpeAmbltAjv4ATkrFSk+ hash: v1.k794b7964.0a14d3ca2e43a6c6e419a9dc0e22eb95f7043d9678fc34aa51155d861e8ad403.NBAHyZx1vyyyqLAtaI-9XLeRqGzxu4utG7j3DEd9lg0scenes-app-inbox-scoutsuggestionsstrip--never-generated--dark:hash: v1.k794b7964.1fa499f9b82d53b5303ac9c1aad41ae71c3181773bfebff8484f9aac6a5d7ad5.ulg5fyOIsf7mnLJJRsP0QggXrvaVc8UBP43QUI6WGmoscenes-app-inbox-scoutsuggestionsstrip--never-generated--light:diff --git a/products/signals/frontend/inbox/components/config/scouts/OpenScratchpadButton.tsx b/products/signals/frontend/inbox/components/config/scouts/OpenScratchpadButton.tsxnew file mode 100644index 000000000000..accba28ae945--- /dev/null+++ b/products/signals/frontend/inbox/components/config/scouts/OpenScratchpadButton.tsx@@ -0,0 +1,32 @@+import { useActions } from 'kea'++import { LemonButton } from '@posthog/lemon-ui'++import { captureScratchpadLinkClicked, type ScratchpadEntryPoint } from '../../../inboxAnalytics'+import { inboxSceneLogic } from '../../../inboxSceneLogic'++/** Footer link from a scout's Told and Learned tabs to the scratchpad every scout writes to. */+export function OpenScratchpadButton({+ skillName,+ entryPoint,+}: {+ skillName: string+ entryPoint: ScratchpadEntryPoint+}): JSX.Element {+ const { setScratchpadOpen } = useActions(inboxSceneLogic)++ return (+ <LemonButton+ size="xsmall"+ type="tertiary"+ className="self-start"+ data-attr={`inbox-scout-open-scratchpad-${entryPoint}`}+ onClick={() => {+ captureScratchpadLinkClicked({ entryPoint, surface: 'scout_detail', skillName })+ setScratchpadOpen(true)+ }}+ >+ Open the scratchpad+ </LemonButton>+ )+}diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutLearnedPanel.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutLearnedPanel.tsxindex 7a4cf466bdbb..93a5a8e22246 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutLearnedPanel.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutLearnedPanel.tsx@@ -5,9 +5,9 @@ import { LemonButton, LemonSkeleton } from '@posthog/lemon-ui'import { pluralize } from 'lib/utils/strings'-import { inboxSceneLogic } from '../../../inboxSceneLogic'import { entriesForSkill, scratchpadLogic } from '../../../logics/scratchpadLogic'import { ScratchpadEntryCard } from '../../scratchpad/ScratchpadEntryCard'+import { OpenScratchpadButton } from './OpenScratchpadButton'const INITIAL_VISIBLE = 3@@ -19,7 +19,6 @@ const INITIAL_VISIBLE = 3export function ScoutLearnedPanel({ skillName }: { skillName: string }): JSX.Element {const { scoutEntries, scoutEntriesLoadFailed } = useValues(scratchpadLogic)const { loadScoutEntries } = useActions(scratchpadLogic)- const { setScratchpadOpen } = useActions(inboxSceneLogic)const [showAll, setShowAll] = useState(false)const entries = entriesForSkill(scoutEntries, skillName)@@ -62,9 +61,7 @@ export function ScoutLearnedPanel({ skillName }: { skillName: string }): JSX.Ele)}</div>)}- <LemonButton size="xsmall" type="tertiary" className="self-start" onClick={() => setScratchpadOpen(true)}>- All scouts- </LemonButton>+ <OpenScratchpadButton skillName={skillName} entryPoint="learned_tab" /></div>)}diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutNotesPanel.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutNotesPanel.test.tsxindex 78afe33860ef..535a53af9c3e 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutNotesPanel.test.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutNotesPanel.test.tsx@@ -49,7 +49,7 @@ describe('ScoutNotesPanel', () => {expect(getByText(new RegExp(TAIL))).toBeTruthy()})- it('lists a fleet-wide note under its own label', async () => {+ it('folds fleet-wide notes away below the notes for this scout', async () => {useMocks({get: {'/api/projects/:team/signals/scout/notes/': [@@ -66,10 +66,15 @@ describe('ScoutNotesPanel', () => {},})- const { findByText, getByText } = render(<ScoutNotesPanel skillName={SKILL_NAME} />)+ const { findByText, getByText, queryByText } = render(<ScoutNotesPanel skillName={SKILL_NAME} />)++ expect(await findByText('It also reads 1 note left for every scout')).toBeTruthy()+ expect(getByText(/Nothing has been told to this scout yet/)).toBeTruthy()+ expect(queryByText('Ignore traffic from the staging domain.')).toBeNull()++ fireEvent.click(getByText('It also reads 1 note left for every scout'))- expect(await findByText('Ignore traffic from the staging domain.')).toBeTruthy()- expect(getByText('For every scout')).toBeTruthy()+ expect(getByText('Ignore traffic from the staging domain.')).toBeTruthy()})it('offers a retry once a load that never settles times out', async () => {diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutNotesPanel.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutNotesPanel.tsxindex 77f1a61e4fe0..fb9f46ee27f8 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutNotesPanel.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutNotesPanel.tsx@@ -1,7 +1,7 @@import { useActions, useValues } from 'kea'import { useState } from 'react'-import { IconPencil, IconTrash } from '@posthog/icons'+import { IconChevronDown, IconChevronRight, IconPencil, IconTrash } from '@posthog/icons'import { LemonButton, LemonDialog, LemonTag, LemonTextArea, Tooltip } from '@posthog/lemon-ui'import { TZLabel } from 'lib/components/TZLabel'@@ -20,6 +20,7 @@ import {scoutNotesLogic,} from '../../../logics/scoutNotesLogic'import { linkReportIdsInNote } from '../../../utils/scoutMemoryPresentation'+import { OpenScratchpadButton } from './OpenScratchpadButton'import { ScoutNoteContent } from './ScoutNoteContent'/** Bounded by the create serializer; mirrored here so the dialog can say so before a failed request. */@@ -142,33 +143,35 @@ export function ScoutNotesPanel({ skillName }: { skillName: string }): JSX.Elemeconst { scoutNotes, fleetWideNotes, toldCount, notesLoading, notesLoadFailed, notesCapped } = useValues(logic)const { deleteNote, loadNotes } = useActions(logic)const { reportRows } = useValues(scoutDetailLogic({ skillName }))+ const [showFleetNotes, setShowFleetNotes] = useState(false)// On the fleet view every note is already in `scoutNotes`.const otherFleetNotes = skillName ? fleetWideNotes : []+ const nothingLoaded = toldCount === 0 && otherFleetNotes.length === 0// Reports this scout touched in the window, so a note naming one by id can name it by title.const reportsById = new Map(reportRows.map(({ report }) => [report.id.toLowerCase(), report]))return (<div className="flex flex-col gap-2">- {notesLoading && toldCount === 0 ? (+ {notesLoading && nothingLoaded ? (<div className="rounded border border-primary bg-surface-primary px-4 py-6 text-center text-sm text-muted">Loading notes…</div>- ) : notesLoadFailed && toldCount === 0 ? (+ ) : notesLoadFailed && nothingLoaded ? (<div className="flex flex-col items-center gap-2 rounded border border-danger bg-danger-highlight px-4 py-6 text-center text-sm text-danger"><span>Couldn't load the notes.</span><LemonButton size="xsmall" type="secondary" onClick={() => loadNotes()}>Try again</LemonButton></div>- ) : toldCount === 0 ? (- <div className="rounded border border-dashed border-primary bg-surface-primary px-4 py-6 text-center text-sm text-muted">- Nothing yet. Leave a note to steer what this scout looks at, or dismiss one of its reports with a- reason, and that reaches it too.- </div>) : (<>- {scoutNotes.length > 0 && (+ {toldCount === 0 ? (+ <div className="rounded border border-dashed border-primary bg-surface-primary px-4 py-6 text-center text-sm text-muted">+ Nothing has been told to this scout yet. Leave a note to steer what it looks at, or dismiss+ one of its reports with a reason, and that reaches it too.+ </div>+ ) : (<ScoutNoteListnotes={scoutNotes}reportsById={reportsById}@@ -177,16 +180,28 @@ export function ScoutNotesPanel({ skillName }: { skillName: string }): JSX.Eleme/>)}{/* A note addressed to every scout reaches this one too, but it is not about this- scout, so it sits under its own label rather than in the list above. */}+ scout. Most come from inbox activity on reports no scout wrote, so they stay+ folded away rather than burying the notes above. */}{otherFleetNotes.length > 0 && (<div className="flex flex-col gap-1">- <span className="text-xs font-semibold text-secondary">For every scout</span>- <ScoutNoteList- notes={otherFleetNotes}- reportsById={reportsById}- capped={notesCapped}- onDelete={deleteNote}- />+ <LemonButton+ size="xsmall"+ type="tertiary"+ className="self-start"+ icon={showFleetNotes ? <IconChevronDown /> : <IconChevronRight />}+ onClick={() => setShowFleetNotes(!showFleetNotes)}+ data-attr="inbox-scout-toggle-fleet-notes"+ >+ It also reads {pluralize(otherFleetNotes.length, 'note')} left for every scout+ </LemonButton>+ {showFleetNotes && (+ <ScoutNoteList+ notes={otherFleetNotes}+ reportsById={reportsById}+ capped={notesCapped}+ onDelete={deleteNote}+ />+ )}</div>)}</>@@ -196,6 +211,7 @@ export function ScoutNotesPanel({ skillName }: { skillName: string }): JSX.ElemeNew notes are picked up on the next run and folded into what it has learned. Delete a note once it hasdone its job.</span>+ <OpenScratchpadButton skillName={skillName} entryPoint="told_tab" /></div>)}diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.tsxindex b9ecd1d9f6f2..08604f6f8a8e 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRoster.tsx@@ -5,7 +5,7 @@ import { LemonButton, Link } from '@posthog/lemon-ui'import { urls } from 'scenes/urls'-import { captureScoutFleetViewed } from '../../../inboxAnalytics'+import { captureScoutFleetViewed, captureScratchpadLinkClicked } from '../../../inboxAnalytics'import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'import { SCOUT_ROSTER_WINDOW_LABEL, SCOUT_RUNS_PER_SCOUT_LABEL } from '../../../utils/scoutRunsWindow'import { CardSkeleton } from '../../cards/CardSkeleton'@@ -119,7 +119,18 @@ export function ScoutsRoster(): JSX.Element {created as skills in your PostHog project, under the name you give them.{' '}<Link to={urls.inboxRuns()} data-attr="inbox-open-runs">See every recent run+ </Link>{' '}+ or{' '}+ <Link+ to={urls.inboxScratchpad()}+ onClick={() =>+ captureScratchpadLinkClicked({ entryPoint: 'roster_footer', surface: 'fleet_list' })+ }+ data-attr="inbox-open-scratchpad"+ >+ see what your scouts have learned</Link>+ .</span><ScoutHelperSkillLinks /></div>diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterStats.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterStats.tsxindex dacbdfc832d2..c844f9823446 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterStats.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutsRosterStats.tsx@@ -1,9 +1,11 @@import { useValues } from 'kea'-import { Tooltip } from '@posthog/lemon-ui'+import { Link, Tooltip } from '@posthog/lemon-ui'import { cn } from 'lib/utils/css-classes'+import { urls } from 'scenes/urls'+import { captureScratchpadLinkClicked } from '../../../inboxAnalytics'import { scoutFleetLogic } from '../../../logics/scoutFleetLogic'import { SCRATCHPAD_WINDOW_PAGE_SIZE, scratchpadLogic } from '../../../logics/scratchpadLogic'import { SCOUT_ROSTER_WINDOW_LABEL } from '../../../utils/scoutRunsWindow'@@ -27,18 +29,41 @@ function Stat({label,tooltip,tone = 'muted',+ to,+ onClick,+ dataAttr,}: {value: stringlabel: stringtooltip: stringtone?: StatTone+ /** Makes the stat a link to the page behind the number. */+ to?: string+ onClick?: () => void+ dataAttr?: string}): JSX.Element {+ const className = cn('flex items-baseline gap-1 whitespace-nowrap text-xs', LABEL_CLASS[tone])+ const content = (+ <>+ <span className={cn('font-semibold tabular-nums', VALUE_CLASS[tone])}>{value}</span>+ <span>{label}</span>+ </>+ )return (<Tooltip title={tooltip}>- <span className={cn('flex items-baseline gap-1 whitespace-nowrap text-xs', LABEL_CLASS[tone])}>- <span className={cn('font-semibold tabular-nums', VALUE_CLASS[tone])}>{value}</span>- <span>{label}</span>- </span>+ {to ? (+ <Link+ to={to}+ subtle+ onClick={onClick}+ className={cn(className, 'hover:underline')}+ data-attr={dataAttr}+ >+ {content}+ </Link>+ ) : (+ <span className={className}>{content}</span>+ )}</Tooltip>)}@@ -86,7 +111,9 @@ export function ScoutsRosterStats(): JSX.Element {<Statvalue={summaryValue(emittedFindingsSummary.runCount)}label="runs"- tooltip={`Runs your scouts made in the ${SCOUT_ROSTER_WINDOW_LABEL}, quiet ones included.`}+ tooltip={`Runs your scouts made in the ${SCOUT_ROSTER_WINDOW_LABEL}, quiet ones included. Click to see every recent run.`}+ to={urls.inboxRuns()}+ dataAttr="inbox-scout-stats-open-runs"/><Statvalue={summaryValue(emittedFindingsSummary.authoredReportCount)}@@ -103,9 +130,12 @@ export function ScoutsRosterStats(): JSX.Element {label="learned"tooltip={recentlyLearnedCountCapped- ? `Scratchpad entries your scouts wrote or refreshed in the ${SCOUT_ROSTER_WINDOW_LABEL}. Only the newest ${SCRATCHPAD_WINDOW_PAGE_SIZE} entries are counted, and all of them fall in this window.`- : `Scratchpad entries your scouts wrote or refreshed in the ${SCOUT_ROSTER_WINDOW_LABEL}.`+ ? `Scratchpad entries your scouts wrote or refreshed in the ${SCOUT_ROSTER_WINDOW_LABEL}. Only the newest ${SCRATCHPAD_WINDOW_PAGE_SIZE} entries are counted, and all of them fall in this window. Click to open the scratchpad.`+ : `Scratchpad entries your scouts wrote or refreshed in the ${SCOUT_ROSTER_WINDOW_LABEL}. Click to open the scratchpad.`}+ to={urls.inboxScratchpad()}+ onClick={() => captureScratchpadLinkClicked({ entryPoint: 'roster_stats', surface: 'fleet_list' })}+ dataAttr="inbox-scout-stats-open-scratchpad"/></div>)diff --git a/products/signals/frontend/inbox/inboxAnalytics.ts b/products/signals/frontend/inbox/inboxAnalytics.tsindex c78553b1c04e..a226c0bac0ec 100644--- a/products/signals/frontend/inbox/inboxAnalytics.ts+++ b/products/signals/frontend/inbox/inboxAnalytics.ts@@ -1259,6 +1259,23 @@ export function captureScoutCreatePathSwitched(params: {})}+/** Which link opened the scratchpad, so each entry point's pull reads separately. */+export type ScratchpadEntryPoint = 'told_tab' | 'learned_tab' | 'roster_stats' | 'roster_footer'++/** A person followed a link to the scratchpad. The panel view itself is captured on open. */+export function captureScratchpadLinkClicked(params: {+ entryPoint: ScratchpadEntryPoint+ surface: ScoutSurface+ skillName?: string | null+}): void {+ captureScoutAction({+ actionType: 'open_memory',+ surface: params.surface,+ skillName: params.skillName,+ extra: { entry_point: params.entryPoint },+ })+}+/** Where a suggestion card was rendered: the strip above the roster, or the empty state's body. */export type ScoutSuggestionSurface = 'strip' | 'empty_state' | 'onboarding'diff --git a/products/signals/frontend/inbox/logics/scoutNotesLogic.test.ts b/products/signals/frontend/inbox/logics/scoutNotesLogic.test.tsindex 3cd9064ecd6a..59ebdb32288e 100644--- a/products/signals/frontend/inbox/logics/scoutNotesLogic.test.ts+++ b/products/signals/frontend/inbox/logics/scoutNotesLogic.test.ts@@ -48,4 +48,27 @@ describe('scoutNotesLogic', () => {expect(logic.values.notesLoadFailed).toBe(false)expect(logic.values.notesLoading).toBe(true)})++ it('counts only the notes addressed to this scout as told', async () => {+ const note = (id: string, skill_name: string): Record<string, unknown> => ({+ id,+ content: 'A note',+ origin: 'report_discussion',+ skill_name,+ created_by_name: null,+ created_at: '2026-08-20T10:00:00Z',+ expires_at: null,+ })+ useMocks({+ get: {+ [NOTES_URL]: [note('own', SKILL_NAME), note('fleet-1', ''), note('fleet-2', '')],+ },+ })++ logic.mount()+ await jest.advanceTimersByTimeAsync(0)++ expect(logic.values.fleetWideNotes).toHaveLength(2)+ expect(logic.values.toldCount).toEqual(1)+ })})diff --git a/products/signals/frontend/inbox/logics/scoutNotesLogic.ts b/products/signals/frontend/inbox/logics/scoutNotesLogic.tsindex 93cf418cf11d..73bc1f6b2310 100644--- a/products/signals/frontend/inbox/logics/scoutNotesLogic.ts+++ b/products/signals/frontend/inbox/logics/scoutNotesLogic.ts@@ -109,7 +109,7 @@ export interface scoutNotesLogicMeta {scoutNotes: (activeNotes: ScoutNoteApi[], arg: any) => ScoutNoteApi[]fleetWideNotes: (activeNotes: ScoutNoteApi[]) => ScoutNoteApi[]directNotes: (activeNotes: ScoutNoteApi[]) => ScoutNoteApi[]- toldCount: (scoutNotes: ScoutNoteApi[], fleetWideNotes: ScoutNoteApi[], arg: any) => number+ toldCount: (scoutNotes: ScoutNoteApi[]) => number}}@@ -232,13 +232,10 @@ export const scoutNotesLogic = kea<scoutNotesLogicType>([(s) => [s.activeNotes],(activeNotes: ScoutNoteApi[]): ScoutNoteApi[] => activeNotes.filter(isDirectScoutNote),],- // Every note this scout reads on its next run: its own plus the fleet-wide ones. The Told- // tab and the health strip both show this number, so it matches what the panel lists.- toldCount: [- (s) => [s.scoutNotes, s.fleetWideNotes, (_, props) => props],- (scoutNotes: ScoutNoteApi[], fleetWideNotes: ScoutNoteApi[], props: ScoutNotesLogicProps): number =>- props.skillName ? scoutNotes.length + fleetWideNotes.length : scoutNotes.length,- ],+ // Only the notes addressed to this scout. Inbox activity on a report no scout wrote leaves a+ // note for every scout, so counting those would give every scout the same large number.+ // The Told tab and the health strip both show this count.+ toldCount: [(s) => [s.scoutNotes], (scoutNotes: ScoutNoteApi[]): number => scoutNotes.length],}),listeners(({ actions, props }) => ({