: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(inbox): add focused inbox onboarding ui (#116987)
Georgiy Tarasov01ac061cde52
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 6934d5ce7ea6..7380c583f10c 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -11458,6 +11458,54 @@ snapshots:hash: v1.k794b7964.cf12f69004301572be1c6bc0c8927205b33d7e91052ee14c140ca28c6ca1737d.U2NxyypdkDl1-ZAX8zpHYqNKck9H6kp78eEmS8k2clMscenes-app-inbox-discussreportbutton--without-suggestions--light:hash: v1.k794b7964.9108dd99dd7c78fc3f18d4326d19f4ae6db81b0a925c742130145b315bfefce8.SDY7Xb9wigNSFb_k-94O75WyV7EloF11LgkDK9YH0Wo+ scenes-app-inbox-focused-setup--built-in-scouts--dark:+ hash: v1.k794b7964.9c362d9b9c26bb883910cfbdd1836a4527c166f4c96a2f5360e69023c79d5f0e.DuYijIxQuSoZCwSuCLHfE5vpQ9S7-wEi7vbYSPvUoQY+ scenes-app-inbox-focused-setup--built-in-scouts--light:+ hash: v1.k794b7964.5218eb7e49c96084e51040039f1a1d65e8146a1c71fc41101537b3d743a9323c.BIPRFRy76xqqc4q0D41zmRuDqMJy4dpNwDZ-TU24b4Y+ scenes-app-inbox-focused-setup--github--dark:+ hash: v1.k794b7964.2f22b978f644c1c0b4673abc1417da42588fb907d7839fcf0bf7a35980b2e8dc.yEa2Mh7klA-11G--wkqe5uconS0kX2dDS_rH0gxJRXM+ scenes-app-inbox-focused-setup--github--light:+ hash: v1.k794b7964.8a339557c1ca11053380c4996f86fb9bc30971b601cb20327f808acf348a90f6.HXwJQKUmddwj9iSDWBGjx8X7gsrj4MnOHmMa_rEGCLE+ scenes-app-inbox-focused-setup--github-access-required--dark:+ hash: v1.k794b7964.da39166a14544a95756ec01524bd7a2b2029ba0178df800dd7185c8f5b595f0d.DpTqPSqIoDbXO8F3l4U9FPVJsbNKCgTceZVR_EEmwS8+ scenes-app-inbox-focused-setup--github-access-required--light:+ hash: v1.k794b7964.b8516f7ca2a4d55fc30b553c71686b0a70131d1148450d1e1c8a7712fb1c1398.mWEk-UsYBOzzXBumxPo129pYGY0EruKgw2-uXYH4uT0+ scenes-app-inbox-focused-setup--github-already-connected--dark:+ hash: v1.k794b7964.7cbc08f42385a0c5e3724905cd168889ea285773047dec630d44f44ae3214ff3.87cUu_WLwNEGkXed2dbxjbzN3Qnnq1ooUzoNQjCGRF4+ scenes-app-inbox-focused-setup--github-already-connected--light:+ hash: v1.k794b7964.0c4e46e52d6fd87cfda72f60455771998ed40646fd21942f80380322da453354.3sHKex8XGnDIU5-Q1CC-G9FaHEtRtR_vTBBQK3RfwsY+ scenes-app-inbox-focused-setup--manual-entry--dark:+ hash: v1.k794b7964.ffef931600e70b99b707e8e5153406ed2489a138311b2373e5154d32952e3bc2.0nf9GadNMHxdAJLVVgXa5xYpJO0iy3OPG2E5a9s9JTU+ scenes-app-inbox-focused-setup--manual-entry--light:+ hash: v1.k794b7964.9e8e10b45c5efcea55776381ec88184984060e6e8bb8996d3bda9e759353c6a4.FMN8bqvId-nhT5Jol9Rj7S94agjW1Je-jaeu6Vmhggg+ scenes-app-inbox-focused-setup--narrow-signals--dark:+ hash: v1.k794b7964.f2687f1eeaf64c59623cc67601507d3602f74d6b691458f6f0b658445c19685f.gujM9C1Fm0DOLvHc36o1R7NhRLrqiUcz8aOSOCa8b8o+ scenes-app-inbox-focused-setup--narrow-signals--light:+ hash: v1.k794b7964.5bf7db12cc74d13fb7c4d54340713b27cbbed447a418130ca9c6b0c420640062.Pp6_ViU79ZscAecpcpkBPT0Alq_X3_4eRr2odBPpqfc+ scenes-app-inbox-focused-setup--narrow-treatment-entry--dark:+ hash: v1.k794b7964.5ab62e98e2aa1f5e31365f50562f25773d809d7408fd4041df314bbb86106d82.GBtIqzkgeX7m-MJGL9lcOH5lnyJMFe0gap66WkR48aI+ scenes-app-inbox-focused-setup--narrow-treatment-entry--light:+ hash: v1.k794b7964.cbd7b915414dec14f348e234143de567cf9ac097cb7f263f4d973b4f231ad485.tA2iuF30kliNInVONq5u0FHnn8vf-LFGyL182EEsy2M+ scenes-app-inbox-focused-setup--no-products-enabled--dark:+ hash: v1.k794b7964.764ef45e781be980c6bc60eab99aaef22e011afcccafb78586a7507c9313c345.HjJi0LKC8d2x9Qr76jCkCfYHxucQrnEH3jkQ9ro_mkQ+ scenes-app-inbox-focused-setup--no-products-enabled--light:+ hash: v1.k794b7964.20b18f5ab4b378c6b06c45b3de05dd4ba1783f7995d842ac40c3555a1dd450c5.Tw6tZ6X7sU3V4qVx9jmSBj4rS04FnKis1tqfTQuAhgY+ scenes-app-inbox-focused-setup--scouts--dark:+ hash: v1.k794b7964.6fd8aa35755ed0ad8bfdee5e82fd3ae4bb2b66b185c5ad8ce8762291e9242c81.EseOEIZLSBk_G1Dlr44lR9ulG4RFO6cCcKKY8bCOLH4+ scenes-app-inbox-focused-setup--scouts--light:+ hash: v1.k794b7964.0b9a7f6b88e2d506846d9e448afe4193993d608419675a5c93d32d756a296514.WiyeUhxL4BXRswoGAtJ8VZiDJq6nfUm0bpDCprNMH90+ scenes-app-inbox-focused-setup--signals--dark:+ hash: v1.k794b7964.2fd61d81d1c3300e8270a3ffa4c3d3121f997051b91d9987426daf7dc9d3a2ad.L1egsU2zlebfWNXC0b6d6ubCZNtlsBUpPTJStyvipBs+ scenes-app-inbox-focused-setup--signals--light:+ hash: v1.k794b7964.6509c25bb6925e6c47261dec8cf7098cda679b92312bf31a062142fc3e77bb12.xGsSNmODSL8UdPd4hiJhAhMHAMwhoh5SfDHNuulisOA+ scenes-app-inbox-focused-setup--treatment-entry--dark:+ hash: v1.k794b7964.7994febd8948a1a7efc82e5b9c295f26541b35031c38ac4684281bee29b3041f.buzQOjSEXhdDveeZT0biMuWSs9OFKBN6jzwRsnfig14+ scenes-app-inbox-focused-setup--treatment-entry--light:+ hash: v1.k794b7964.b3abf739a3d8935a5daa7653f17fbb65a6d57b7e85c23348f2c7f306264dbf70.muEj10uHcel9GGp-qDSRa2j1mFYjLK5LyAqzF_C2tDE+ scenes-app-inbox-focused-setup--treatment-reminder--dark:+ hash: v1.k794b7964.80667d13f6fd3903f1e1d602332472fb82b04068c9740f2c71bd768b625c6233.F80fM8smMQBS2gdsx4T5hqd7h-Vn5hZkZh3zJRvMuBo+ scenes-app-inbox-focused-setup--treatment-reminder--light:+ hash: v1.k794b7964.41b6bcc6d2de7d68b9bf72f1a3a248c326c44dea7905d7bcc1161ad09526d7e9.4E0B-L1wRoXtjDuhdRe2-x8CwfacDBMUa4hrUNBQbigscenes-app-inbox-hotkeyradio--with-selection--dark:hash: v1.k794b7964.ee23fd931ed2324fdc42cbb44bb06176f40e1e47d5c03f9118ccc0f5f013201b.BmJiKZm5EO6qY8tSt5oSll_wmMMWh7IJ0dqN_bSQwa8scenes-app-inbox-hotkeyradio--with-selection--light:@@ -11558,6 +11606,14 @@ snapshots:hash: v1.k794b7964.f317ce431f7683d0d3f243cce6a7431ccaace370e74c3d25c93339c00c9bad63.yDLBiHj337vJez3JG8kG__Fg6XNWkVyA8tGu9nPtn-Iscenes-app-inbox-scene--empty-with-many-scouts--light:hash: v1.k794b7964.facecddc48f471398f32d48fed8287b91573105ddd2d2ce2adc18eaf649900e7.QVbf6XPS8aj7-Jrj-3T_o1fu7tZNl8ZCJqGw3yRl8Qw+ scenes-app-inbox-scene--focused-onboarding--dark:+ hash: v1.k794b7964.4fcfaa0984e34489b28669ed5eb0edb6e97fc264d23ff773d1186ff3c34f57fd.GiD0odqQbMhT21w3-gYboiZG8Qq-It2y0yHpPdIA-zc+ scenes-app-inbox-scene--focused-onboarding--light:+ hash: v1.k794b7964.3fd7edfc3a61559d26da40b6486b4d2f712db05fd5072cbc8332f57a74849aa8.9j0sGbHDpLsWr_Bt34mOIe_lp-l9PXoUsKbK8nZRWyE+ scenes-app-inbox-scene--focused-onboarding-complete--dark:+ hash: v1.k794b7964.23f6d8d2bde65b867977db568e3dfeedc4019d90979698c8e6d454a202b3e96d.8RH2ZuOFoZM7RcXAtTaGKgavGkH7Xp2s3Wca5jmvSIE+ scenes-app-inbox-scene--focused-onboarding-complete--light:+ hash: v1.k794b7964.fc4381e7801f964ec92fc2efb170204180dfb80b678d39fe50e8bfc14df9705c.xy73qgq6MnEB8n_mC70uv6kWchMnAebI0Oua0N7NSCkscenes-app-inbox-scene--inbox--dark:hash: v1.k794b7964.9e408067ea1f3714dcf8d9e812dde013bd58ce007872c1edadbabca46f30dae9.rsVWshwBIWY3KXFqChFMc0qts9C78Rkju8Cmq5Nofvoscenes-app-inbox-scene--inbox--light:@@ -11599,9 +11655,9 @@ snapshots:scenes-app-inbox-scene--scouts--light:hash: v1.k794b7964.751f7acf90211fb843c29021e4c5c07199a016d3758a98aebd030a2459e7e727.-dob_PqMSyNGS0sWCDRL7239l7w9pUTs5Oil7XD97cMscenes-app-inbox-scene--self-driving-onboarding--dark:- hash: v1.k794b7964.e0a23cc49efed91ac01907f5197329613afd261d56817d389d26e42aad8602e2.Wb2-6F1bTbXLv66f02qDi8yAgRSIGhUkXu_wIeCxkFs+ hash: v1.k794b7964.7c138b7c3b04457d678483199e387c9a6797ca50900ed05eba270099ffe0f49e.cAslMYO6RM6u1zEhNY5k-QZMghw16mfbi7qaJiyRepcscenes-app-inbox-scene--self-driving-onboarding--light:- hash: v1.k794b7964.87b9241bd7aadc4910ea54b999c3ce8ff1771db2af89a861f53b118a55f4dab8.f9dpoa9HTkP2rgnZ7LIHJrFW5s2WhpMl4fpKVZIO55Y+ hash: v1.k794b7964.c275d6da929a341c281ac17ff3acd47f4b1fa16f30bdeae50e0ca028f1bdbacc.0ToliYIOVkbsvNIsw0HSIY2i-8iFr4TkpJ5KVtranr0scenes-app-inbox-scene--self-driving-paused--dark:hash: v1.k794b7964.d93230f18f04b762f3ae875c5a326911b98476668fa8cfd8e37894fe43ba1f1f._zlmaBrFV16p8GGadEQ1GL7s0r_HfNZZypbmh0fGYd4scenes-app-inbox-scene--self-driving-paused--light:@@ -14055,13 +14111,13 @@ snapshots:scenes-app-replay-vision--scanner-editor-budget-free-only-nearly-used--light:hash: v1.k794b7964.421b9aeab0f131863e1544212b4dda065807a298d7250d30831e539e229a8e9f.1Y87Xtwt38CC7aZR3FNNC4HhmAqDZj4LBaQLfhz_hxQscenes-app-replay-vision--scanner-editor-configure--dark:- hash: v1.k794b7964.07148958cd17ddb6f5e92153e6020b88a5c0faadd1d30453af7dcd3842efe1be.mbfalsNTUY56lRXxDljiT-ZQ19WP2LSF7Ngnn21lRsw+ hash: v1.k794b7964.c2aa6b7e7b725d9d65b99c394f046af6f6799c9d741a0c4e4004f66ab1266ad6.aUkVDXPlYgn7MVY7XC6CPY12HD4-lQGkIimc4RBwm1Mscenes-app-replay-vision--scanner-editor-configure--light:- hash: v1.k794b7964.441d1f2092c34a7b98fc0cca4ce039b03fa223acfa0955672a8200e9c4f1df69.iNQCuJrorTIeH3ontcAYe7EQOqQk76GpO_vVgGVzT0s+ hash: v1.k794b7964.45cebb612c92bf5f49922fae9fb7a4c3b5e8f8c2deb8a588275083f64daf1921.BuCZosKkWmVQYWe2-2DjQwrm8ceYWGEBUi-aigZfIcQscenes-app-replay-vision--scanner-editor-details--dark:- hash: v1.k794b7964.b432270f77e7780bf7c0d1a0cbabfe3a6dcc4fcebbf2311f64a92f113f5ec8c2.N1ufgn3U8jNJTWVtd9YsSvOK6qxo8Kb-7Jkux2YeVdk+ hash: v1.k794b7964.f20170d6a2a10e0c4815eace87e1c62261794036057ac9dd6013646eaef6b7e7.kQyA4HNtoo3ZQSOkihq2KbgXALQhSWcYdy1XsqSRu44scenes-app-replay-vision--scanner-editor-details--light:- hash: v1.k794b7964.6a0bec1cca5a2d30c5ae7ad47d071406b55c337c4b6574d0c601d97ef5f56749.ebPyjAyNgVrgCHUvj3sL2nLQm23sw5Pe28YYdK94Gtw+ hash: v1.k794b7964.fa1ec40aad71beaa1dbcf4424c7acf48507577adedefb6c851e4429577ca2aec.6so_6wy4AxMd-JsTAqslfNBt9wsB1aXrP_7iblwvDq8scenes-app-replay-vision--scanner-editor-goal-flow--dark:hash: v1.k794b7964.54704e12a4eb28c568f1d7341371eb85b8626b88258f316cf635286ebb4e0eb8.JtMuT9-1OV64NzYC-PcNEqIErarlvklO9kSY4o3N37gscenes-app-replay-vision--scanner-editor-goal-flow--light:diff --git a/frontend/src/lib/components/GuidedWizard/GuidedWizardStepper.tsx b/frontend/src/lib/components/GuidedWizard/GuidedWizardStepper.tsxindex 43d1ec76eff6..fccbf1b05bda 100644--- a/frontend/src/lib/components/GuidedWizard/GuidedWizardStepper.tsx+++ b/frontend/src/lib/components/GuidedWizard/GuidedWizardStepper.tsx@@ -88,14 +88,14 @@ export function GuidedWizardStepper<Step extends string>({<div key={error}>{error}</div>))}>- <IconWarning className="size-5 text-warning" />+ <IconWarning className="size-5 shrink-0 text-warning" /></Tooltip>) : isCompleted ? (- <IconCheckCircle className="size-5 text-success" />+ <IconCheckCircle className="size-5 shrink-0 text-success" />) : (<spanclassName={cn(- 'flex items-center justify-center size-5 rounded-full text-xs font-semibold',+ 'flex items-center justify-center size-5 shrink-0 rounded-full text-xs font-semibold','transition-all duration-150',isCurrent && 'bg-accent text-primary-inverse ring-2 ring-accent/25',!isCurrent && 'bg-surface-secondary text-secondary border border-primary'@@ -105,16 +105,21 @@ export function GuidedWizardStepper<Step extends string>({</span>)}- {/* Label */}+ {/* Reserve the bold label width so changing steps cannot move neighboring buttons. */}<span- className={cn(- 'text-sm transition-colors duration-150',- isCurrent && 'font-semibold text-primary',- isCompleted && 'font-medium text-primary',- !isCompleted && !isCurrent && 'text-secondary'- )}+ className="grid text-sm after:invisible after:font-semibold after:content-[attr(data-label)] after:[grid-area:1/1]"+ data-label={step.label}>- {step.label}+ <span+ className={cn(+ '[grid-area:1/1] transition-colors duration-150',+ isCurrent && 'font-semibold text-primary',+ isCompleted && 'font-medium text-primary',+ !isCompleted && !isCurrent && 'text-secondary'+ )}+ >+ {step.label}+ </span></span>{step.optional && <span className="text-xs text-tertiary">optional</span>}diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 9ac692a313d2..dc94fb3090de 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -380,6 +380,7 @@ export const FEATURE_FLAGS = {INBOX_SELF_DRIVING_EMPTY_STATE: 'inbox-self-driving-empty-state',INBOX_SLACK_NOTIFICATIONS: 'inbox-slack-notifications', // owner: #team-self-driving, gates the Slack notifications config card in the inboxINBOX_TIME_WINDOW: 'inbox-time-window', // owner: #team-self-driving, gates the created-in window filter on the inbox report list+ INBOX_UI_ONBOARDING: 'inbox-ui-onboarding', // owner: #team-self-driving, multivariate control/testINSIGHT_ALERTS_EMPTY_STATE_EXPERIMENT: 'insight-alerts-empty-state',INSIGHT_DATA_CHECKS: 'insight-data-checks', // owner: @sampennington #team-product-analytics, checks the events behind an insight and shows the result on the insight pageINSIGHT_DRAG_TO_ZOOM: 'insight-drag-to-zoom', // owner: @sampennington #team-product-analytics, gates x-axis drag-to-zoom on insight charts (trends today, SQL to follow)diff --git a/frontend/src/lib/integrations/GitHubInstallRequestsBanner.tsx b/frontend/src/lib/integrations/GitHubInstallRequestsBanner.tsxindex 7bbeb69b0550..ed7cd11e7abb 100644--- a/frontend/src/lib/integrations/GitHubInstallRequestsBanner.tsx+++ b/frontend/src/lib/integrations/GitHubInstallRequestsBanner.tsx@@ -20,12 +20,14 @@ export function GitHubInstallRequestsBanner({onFinishConnecting,finishConnectingUrl,variant = 'default',+ connecting = false,}: {/** Runs the surface's own connect flow once an owner has approved the install. */onFinishConnecting?: () => void/** Alternative to `onFinishConnecting` for surfaces whose connect is a plain link. */finishConnectingUrl?: stringvariant?: 'default' | 'onboarding'+ connecting?: boolean}): JSX.Element | null {const { pendingInstallRequests, approvedInstallRequests, installUrl, dismissingRequestIds } =useValues(githubInstallRequestsLogic)@@ -57,6 +59,7 @@ export function GitHubInstallRequestsBanner({to={finishConnectingUrl}disableClientSideRouting={!!finishConnectingUrl}onClick={onFinishConnecting}+ loading={connecting}>Finish connecting</LemonButton>diff --git a/frontend/src/lib/integrations/integrationsLogic.test.ts b/frontend/src/lib/integrations/integrationsLogic.test.tsindex ceb0ddf6808a..950155d0c034 100644--- a/frontend/src/lib/integrations/integrationsLogic.test.ts+++ b/frontend/src/lib/integrations/integrationsLogic.test.ts@@ -138,6 +138,7 @@ describe('integrationsLogic', () => {logic.actions.loadGithubAvailableInstallations()await waitFor(() => expect(logic.values.githubAvailableInstallations).toHaveLength(1))request.mockRejectedValueOnce(new Error('synthetic failure'))+ logic.actions.invalidateGithubSuggestions()logic.actions.loadGithubAvailableInstallations()expect(logic.values.githubAvailableInstallations).toBeNull()await waitFor(() => expect(logic.values.githubDiscoveryFailed).toBe(true))diff --git a/frontend/src/lib/integrations/integrationsLogic.ts b/frontend/src/lib/integrations/integrationsLogic.tsindex ebe5672e5bab..015ad0dd30aa 100644--- a/frontend/src/lib/integrations/integrationsLogic.ts+++ b/frontend/src/lib/integrations/integrationsLogic.ts@@ -839,7 +839,6 @@ export const integrationsLogic = kea<integrationsLogicType>([null as GitHubAvailableInstallationsResponseApi | null,{invalidateGithubSuggestions: () => null,- loadGithubAvailableInstallations: () => null,setGithubDiscovery: (_, { response }) => response,},],diff --git a/frontend/src/scenes/integrations/IntegrationFullPage.tsx b/frontend/src/scenes/integrations/IntegrationFullPage.tsxindex 8318d93cee41..a5e28864107b 100644--- a/frontend/src/scenes/integrations/IntegrationFullPage.tsx+++ b/frontend/src/scenes/integrations/IntegrationFullPage.tsx@@ -2,7 +2,7 @@ import { useActions, useValues } from 'kea'import { router } from 'kea-router'import { IconArrowLeft, IconCheckCircle, IconWarning } from '@posthog/icons'-import { LemonBanner, LemonButton, LemonTextArea, Link, Spinner } from '@posthog/lemon-ui'+import { LemonBanner, LemonButton, Link, Spinner } from '@posthog/lemon-ui'import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'import { TeamMembershipLevel } from 'lib/constants'@@ -14,6 +14,7 @@ import { urls } from 'scenes/urls'import { IntegrationType } from '~/types'+import { IntegrationAccessRequest } from './components/IntegrationAccessRequest'import { IntegrationDefinition, IntegrationStatus, SettingsSectionComponent } from './integrationTypes'export function IntegrationFullPage({@@ -123,7 +124,7 @@ function ConnectView({<div className="text-center text-sm">{definition.description}</div>{restrictionReason ? (- <RequestAccessSection definition={definition} />+ <IntegrationAccessRequest kind={definition.kind} name={definition.name} />) : (// onClickCapture fires before the connect button triggers its OAuth redirect<div onClickCapture={onConnectClick}>@@ -140,45 +141,6 @@ function ConnectView({)}-function RequestAccessSection({ definition }: { definition: IntegrationDefinition }): JSX.Element {- const { accessRequestReason, accessRequestLoading, requestedAccessKinds } = useValues(integrationsLogic)- const { setAccessRequestReason, requestIntegrationAccess } = useActions(integrationsLogic)-- if (requestedAccessKinds.includes(definition.kind)) {- return (- <LemonBanner type="success" className="w-full">- Request sent. Your project admins have been notified and can connect {definition.name}.- </LemonBanner>- )- }-- return (- <div className="flex flex-col gap-3 w-full">- <LemonBanner type="info" className="w-full">- Connecting {definition.name} requires admin access. Tell your project admins why you need it and we'll- email them.- </LemonBanner>- <LemonTextArea- value={accessRequestReason}- onChange={setAccessRequestReason}- placeholder={`Why does your team need ${definition.name}?`}- minRows={3}- maxLength={2000}- />- <LemonButton- type="primary"- fullWidth- center- loading={accessRequestLoading}- disabledReason={!accessRequestReason.trim() ? 'Add a short note for your admins' : undefined}- onClick={() => requestIntegrationAccess({ kind: definition.kind })}- >- Request {definition.name}- </LemonButton>- </div>- )-}-function ConnectedView({definition,integrations,diff --git a/frontend/src/scenes/integrations/components/GithubIntegration.test.tsx b/frontend/src/scenes/integrations/components/GithubIntegration.test.tsxindex e9d9b55c9620..8de285cc339a 100644--- a/frontend/src/scenes/integrations/components/GithubIntegration.test.tsx+++ b/frontend/src/scenes/integrations/components/GithubIntegration.test.tsx@@ -1,10 +1,11 @@import '@testing-library/jest-dom'-import { cleanup, render, screen, waitFor } from '@testing-library/react'+import { act, cleanup, render, screen, waitFor } from '@testing-library/react'import userEvent from '@testing-library/user-event'import { Provider } from 'kea'import posthog from 'posthog-js'+import { integrationsLogic } from 'lib/integrations/integrationsLogic'import type { IntegrationConnectSurface } from 'lib/integrations/utils'import { useMocks } from '~/mocks/jest'@@ -61,6 +62,71 @@ describe('GithubIntegration', () => {const connectClicks = (): Record<string, unknown>[] =>captureSpy.mock.calls.filter((call) => call[0] === 'integration_connect_clicked').map((call) => call[1])+ it.each([false, true])(+ 'keeps a known discovery result visible during refresh (has installations: %s)',+ async (hasInstallations) => {+ let finishDiscovery!: () => void+ let pendingDiscovery = new Promise<void>((resolve) => {+ finishDiscovery = resolve+ })+ useMocks({+ get: {+ '/api/projects/:team_id/integrations/github/available_installations/': async () => {+ await pendingDiscovery+ return [+ 200,+ {+ installations: hasInstallations+ ? [+ {+ installation_id: '12345',+ account_name: 'example-org',+ account_type: 'Organization',+ source_team_id: 7,+ source_team_name: 'Example project',+ },+ ]+ : [],+ personal_github_connected: false,+ personal_discovery_status: 'ok',+ personal_github_login: null,+ discovery_id: '11111111-1111-4111-8111-111111111111',+ discovered_at: new Date().toISOString(),+ },+ ]+ },+ },+ })+ render(+ <Provider>+ <GithubIntegration connectSurface="inbox_welcome" />+ </Provider>+ )+ expect(await screen.findByText('Looking for existing GitHub installations…')).toBeInTheDocument()+ act(() => finishDiscovery())+ await waitFor(() =>+ expect(screen.queryByText('Looking for existing GitHub installations…')).not.toBeInTheDocument()+ )+ if (hasInstallations) {+ expect(screen.getByText(/^Connect to /)).toBeVisible()+ }++ pendingDiscovery = new Promise<void>((resolve) => {+ finishDiscovery = resolve+ })+ act(() => integrationsLogic.actions.loadGithubAvailableInstallations())+ expect(integrationsLogic.values.githubAvailableInstallationsResponseLoading).toBe(true)+ expect(screen.queryByText('Looking for existing GitHub installations…')).not.toBeInTheDocument()+ if (hasInstallations) {+ expect(screen.getByText(/^Connect to /)).toBeVisible()+ }+ act(() => finishDiscovery())+ await waitFor(() =>+ expect(integrationsLogic.values.githubAvailableInstallationsResponseLoading).toBe(false)+ )+ }+ )+it('reports the surface it was rendered on', async () => {await clickConnect(<GithubIntegration connectSurface="settings" />)diff --git a/frontend/src/scenes/integrations/components/GithubIntegration.tsx b/frontend/src/scenes/integrations/components/GithubIntegration.tsxindex 555bf279697d..2592bbca3c9d 100644--- a/frontend/src/scenes/integrations/components/GithubIntegration.tsx+++ b/frontend/src/scenes/integrations/components/GithubIntegration.tsx@@ -27,12 +27,22 @@ export function GithubIntegration({connectText = 'Connect account',emphasizeConnect = false,showPersonalConnectionHelp = true,+ showManageButton = true,+ connectDescription,+ integrationSuffix,+ onAuthorize,+ authorizing = false,}: {next?: string+ onAuthorize?: (url: string) => void+ authorizing?: booleancentered?: booleanconnectText?: stringemphasizeConnect?: booleanshowPersonalConnectionHelp?: boolean+ showManageButton?: boolean+ connectDescription?: React.ReactNode+ integrationSuffix?: JSX.Element/*** Where this card is rendered, reported as the `surface` on `integration_connect_clicked`.* Omit it only on the OAuth landing page, which reports every kind's connect click itself —@@ -83,7 +93,7 @@ export function GithubIntegration({const installations = githubAvailableInstallations ?? []const isConnected = githubIntegrations.length > 0- const canLinkExisting = !isConnected && !githubAvailableInstallationsResponseLoading && installations.length > 0+ const canLinkExisting = !isConnected && installations.length > 0const multipleInstallations = installations.length > 1const pickerOpen =visibleDiscoveryId !== null && visibleDiscoveryId === githubAvailableInstallationsResponse?.discovery_id@@ -117,13 +127,17 @@ export function GithubIntegration({}return (- <Integration kind="github" centered={centered}>+ <Integration kind="github" centered={centered} integrationSuffix={integrationSuffix}>{/* w-full because Integration drops its children into a bare flex row, which wouldotherwise size the banner to its longest word. */}<div className="flex flex-col gap-y-4 w-full"><GitHubInstallRequestsBanner- finishConnectingUrl={authorizationUrl}- onFinishConnecting={() => reportConnect('install_approved_banner')}+ finishConnectingUrl={onAuthorize ? undefined : authorizationUrl}+ connecting={authorizing}+ onFinishConnecting={() => {+ reportConnect('install_approved_banner')+ onAuthorize?.(authorizationUrl)+ }}variant={emphasizeConnect ? 'onboarding' : 'default'}/>{/* An install GitHub already has is the exception, not a second way to connect, so it@@ -204,9 +218,11 @@ export function GithubIntegration({)}</LemonBanner>)}- {!isConnected && githubAvailableInstallationsResponseLoading && (- <p className="text-secondary mb-0">Looking for existing GitHub installations…</p>- )}+ {!isConnected &&+ !githubAvailableInstallationsResponse &&+ githubAvailableInstallationsResponseLoading && (+ <p className="text-secondary mb-0">Looking for existing GitHub installations…</p>+ )}{!isConnected &&!githubAvailableInstallationsResponseLoading &&(githubDiscoveryFailed ||@@ -220,22 +236,31 @@ export function GithubIntegration({</div></LemonBanner>)}- {installRequestInProgress ? null : emphasizeConnect && !isConnected ? (+ {installRequestInProgress || (isConnected && !showManageButton) ? null : emphasizeConnect &&+ !isConnected ? (<div className="flex w-full flex-col items-center gap-4"><div className="flex flex-wrap justify-center gap-2"><LemonButtontype={canLinkExisting ? 'secondary' : 'primary'}icon={<IconGithub />}disableClientSideRouting- to={authorizationUrl}- onClick={() => reportConnect()}+ to={onAuthorize ? undefined : authorizationUrl}+ loading={authorizing}+ onClick={() => {+ reportConnect()+ onAuthorize?.(authorizationUrl)+ }}>{canLinkExisting ? 'Connect a different organization or repository' : connectText}</LemonButton></div><p className="m-0 max-w-[520px] text-center text-[13px] text-tertiary">- PostHog uses GitHub to create reports and pull requests based on your code. After connecting- GitHub, you can run Wizard in the background to complete setup.+ {connectDescription ?? (+ <>+ PostHog uses GitHub to create reports and pull requests based on your code. After+ connecting GitHub, you can run Wizard in the background to complete setup.+ </>+ )}</p></div>) : (@@ -247,14 +272,18 @@ export function GithubIntegration({<LemonButtontype="secondary"disableClientSideRouting- to={authorizationUrl}- onClick={() => reportConnect(isConnected ? 'settings_manage' : undefined)}+ to={onAuthorize ? undefined : authorizationUrl}+ loading={authorizing}+ onClick={() => {+ reportConnect(isConnected ? 'settings_manage' : undefined)+ onAuthorize?.(authorizationUrl)+ }}>{isConnected ? 'Manage on GitHub' : connectText}</LemonButton></div>)}- {isConnected && (+ {isConnected && showManageButton && (<p className={cn('text-secondary text-xs mb-0', centered && 'text-center')}>Add the PostHog app to another GitHub account, or change which repositories it can see.</p>diff --git a/frontend/src/scenes/integrations/components/Integration.tsx b/frontend/src/scenes/integrations/components/Integration.tsxindex 38ae95cc29d3..5ea281ea7c96 100644--- a/frontend/src/scenes/integrations/components/Integration.tsx+++ b/frontend/src/scenes/integrations/components/Integration.tsx@@ -11,14 +11,15 @@ export function Integration({kind,centered,children,-}: PropsWithChildren<{ kind: IntegrationKind; centered?: boolean }>): JSX.Element {+ integrationSuffix,+}: PropsWithChildren<{ kind: IntegrationKind; centered?: boolean; integrationSuffix?: JSX.Element }>): JSX.Element {const integrations = useIntegrations(kind)return (<div className="flex flex-col"><div className="flex flex-col gap-y-2">{integrations.map((integration) => (- <IntegrationView key={integration.id} integration={integration} />+ <IntegrationView key={integration.id} integration={integration} suffix={integrationSuffix} />))}<div className={cn('flex', centered && 'justify-center')}>{children}</div></div>diff --git a/frontend/src/scenes/integrations/components/IntegrationAccessRequest.tsx b/frontend/src/scenes/integrations/components/IntegrationAccessRequest.tsxnew file mode 100644index 000000000000..e2e71b97bdde--- /dev/null+++ b/frontend/src/scenes/integrations/components/IntegrationAccessRequest.tsx@@ -0,0 +1,50 @@+import { useActions, useValues } from 'kea'++import { LemonBanner, LemonButton, LemonTextArea } from '@posthog/lemon-ui'++import { integrationsLogic } from 'lib/integrations/integrationsLogic'++import type { IntegrationKind } from '~/types'++interface IntegrationAccessRequestProps {+ kind: IntegrationKind+ name: string+}++export function IntegrationAccessRequest({ kind, name }: IntegrationAccessRequestProps): JSX.Element {+ const { accessRequestReason, accessRequestLoading, requestedAccessKinds } = useValues(integrationsLogic)+ const { setAccessRequestReason, requestIntegrationAccess } = useActions(integrationsLogic)++ if (requestedAccessKinds.includes(kind)) {+ return (+ <LemonBanner type="success" className="w-full">+ Request sent. Your project admins have been notified and can connect {name}.+ </LemonBanner>+ )+ }++ return (+ <div className="flex flex-col gap-3 w-full">+ <LemonBanner type="info" className="w-full">+ You don’t have access to connect {name}. Tell your project admins why you need it and we'll email them.+ </LemonBanner>+ <LemonTextArea+ value={accessRequestReason}+ onChange={setAccessRequestReason}+ placeholder={`Why does your team need ${name}?`}+ minRows={3}+ maxLength={2000}+ />+ <LemonButton+ type="primary"+ fullWidth+ center+ loading={accessRequestLoading}+ disabledReason={!accessRequestReason.trim() ? 'Add a short note for your admins' : undefined}+ onClick={() => requestIntegrationAccess({ kind: kind })}+ >+ Request {name}+ </LemonButton>+ </div>+ )+}diff --git a/frontend/src/styles/base.scss b/frontend/src/styles/base.scssindex 476ec19776ba..245b42c7910c 100644--- a/frontend/src/styles/base.scss+++ b/frontend/src/styles/base.scss@@ -426,6 +426,8 @@--color-product-web-scripts-dark: rgb(246 124 194);--color-product-wizard-light: rgb(217 40 160);--color-product-wizard-dark: rgb(244 114 208);+ --color-product-self-driving-light: rgb(245 78 0);+ --color-product-self-driving-dark: rgb(255 122 69);--color-product-business-knowledge-light: rgb(202 138 4);--color-product-business-knowledge-dark: rgb(250 204 21);--color-product-models-light: rgb(79 70 229);diff --git a/products/signals/frontend/inbox/InboxScene.stories.tsx b/products/signals/frontend/inbox/InboxScene.stories.tsxindex fbfc37e4628f..5f3fab28ea3c 100644--- a/products/signals/frontend/inbox/InboxScene.stories.tsx+++ b/products/signals/frontend/inbox/InboxScene.stories.tsx@@ -310,6 +310,45 @@ export const SelfDrivingOnboarding: Story = {],}+export const FocusedOnboarding: Story = {+ parameters: { featureFlags: { [FEATURE_FLAGS.INBOX_UI_ONBOARDING]: 'test' } },+ decorators: [+ ...(Array.isArray(SelfDrivingOnboarding.decorators) ? SelfDrivingOnboarding.decorators : []),+ mswDecorator({+ get: {+ '/api/projects/:id/signals/onboarding/': { draft: null, completed_at: null, variant: 'test' },+ },+ post: {+ '/api/projects/:id/signals/onboarding/expose/': { draft: null, completed_at: null, variant: 'test' },+ },+ }),+ ],+}++export const FocusedOnboardingComplete: Story = {+ parameters: { featureFlags: { [FEATURE_FLAGS.INBOX_UI_ONBOARDING]: 'test' } },+ decorators: [+ ...(Array.isArray(Empty.decorators) ? Empty.decorators : []),+ mswDecorator({+ get: {+ '/api/projects/:id/signals/onboarding/': {+ draft: {+ step: 'github',+ sources: [],+ scanner_ids: [],+ suggestions: [],++ automatic_implementation: false,+ implementation_priority: 'P1',+ },+ completed_at: '2026-06-11T10:00:00Z',+ variant: 'test',+ },+ },+ }),+ ],+}+// First-ever visit while the set-up verdict is still loading (config + count requests hang, no// cached verdict) → the neutral skeleton, with no tab bar and no welcome page. Guards the// regression where the normal tabbed inbox rendered first and was then swapped for the takeover.diff --git a/products/signals/frontend/inbox/InboxScene.tsx b/products/signals/frontend/inbox/InboxScene.tsxindex e47ff4f14538..0c3f50e53d16 100644--- a/products/signals/frontend/inbox/InboxScene.tsx+++ b/products/signals/frontend/inbox/InboxScene.tsx@@ -20,7 +20,7 @@ import { ReportDetail, ReportDetailSkeleton } from './components/detail/ReportDeimport { ReportDetailLegacy, ReportDetailSkeletonLegacy } from './components/detail/ReportDetailLegacy'import { FindingsPanel } from './components/findings/FindingsPanel'import { InboxOnboardingBanner } from './components/onboarding/InboxOnboardingBanner'-import { InboxWelcome } from './components/onboarding/InboxWelcome'+import { InboxOnboardingEntry } from './components/onboarding/InboxOnboardingEntry'import { ScratchpadPanel } from './components/scratchpad/ScratchpadPanel'import { InboxListViewLegacy } from './components/shell/InboxListViewLegacy'import { InboxTabBar } from './components/shell/InboxTabBar'@@ -126,7 +126,7 @@ function InboxListView(): JSX.Element {<CardSkeleton count={4} variant="cards" /></div>) : onboarding ? (- <InboxWelcome />+ <InboxOnboardingEntry />) : (<ActiveTabBody tab={activeTab} />)}diff --git a/products/signals/frontend/inbox/components/config/DataSourceSetup.tsx b/products/signals/frontend/inbox/components/config/DataSourceSetup.tsxindex 663f2391533a..ff1d160ecf8a 100644--- a/products/signals/frontend/inbox/components/config/DataSourceSetup.tsx+++ b/products/signals/frontend/inbox/components/config/DataSourceSetup.tsx@@ -1,7 +1,8 @@import { BindLogic, useActions, useValues } from 'kea'import { useEffect } from 'react'-import { LemonButton, LemonSkeleton } from '@posthog/lemon-ui'+import { IconArrowLeft } from '@posthog/icons'+import { LemonBanner, LemonButton, LemonSkeleton } from '@posthog/lemon-ui'import { availableSourcesLogic } from 'products/data_warehouse/frontend/scenes/NewSourceScene/availableSourcesLogic'import { sourceWizardLogic } from 'products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic'@@ -15,20 +16,41 @@ import { WAREHOUSE_SOURCE_SETUP, WarehouseBackedSource } from '../../signalSourcexport function DataSourceSetup({source,onComplete,+ onCancel,+ completing = false,}: {source: WarehouseBackedSourceonComplete: () => void+ onCancel?: () => void+ completing?: boolean}): JSX.Element {const { availableSources, availableSourcesLoading } = useValues(availableSourcesLogic)+ const { load } = useActions(availableSourcesLogic)const { dwSourceType, requiredTables } = WAREHOUSE_SOURCE_SETUP[source]- if (availableSourcesLoading || availableSources === null) {- return <LemonSkeleton />- }-- const sourceConfig = Object.values(availableSources).find((s: SourceConfigResponseApi) => s.name === dwSourceType)+ const sourceConfig = availableSources+ ? Object.values(availableSources).find((s: SourceConfigResponseApi) => s.name === dwSourceType)+ : undefinedif (!sourceConfig) {- return <div>Source not found</div>+ return (+ <div className="space-y-4">+ {onCancel && (+ <LemonButton type="tertiary" size="small" icon={<IconArrowLeft />} onClick={onCancel}>+ Back to signals+ </LemonButton>+ )}+ {availableSourcesLoading ? (+ <LemonSkeleton />+ ) : (+ <LemonBanner type="error">+ <p>Could not load this connection form. Check your access to data sources and try again.</p>+ <LemonButton size="small" onClick={load}>+ Retry+ </LemonButton>+ </LemonBanner>+ )}+ </div>+ )}return (@@ -40,12 +62,20 @@ export function DataSourceSetup({onComplete,}}>- <DataSourceSetupForm sourceConfig={sourceConfig} />+ <DataSourceSetupForm sourceConfig={sourceConfig} onCancel={onCancel} completing={completing} /></BindLogic>)}-function DataSourceSetupForm({ sourceConfig }: { sourceConfig: SourceConfigResponseApi }): JSX.Element {+function DataSourceSetupForm({+ sourceConfig,+ onCancel,+ completing,+}: {+ sourceConfig: SourceConfigResponseApi+ onCancel?: () => void+ completing: boolean+}): JSX.Element {const { isLoading, canGoNext } = useValues(sourceWizardLogic)const { setInitialConnector, onSubmit } = useActions(sourceWizardLogic)@@ -55,6 +85,17 @@ function DataSourceSetupForm({ sourceConfig }: { sourceConfig: SourceConfigResporeturn (<div className="space-y-4">+ {onCancel && (+ <LemonButton+ type="tertiary"+ size="small"+ icon={<IconArrowLeft />}+ onClick={onCancel}+ disabled={isLoading || completing}+ >+ Back to signals+ </LemonButton>+ )}<div className="flex items-center gap-3"><SourceIcon type={sourceConfig.name} size="small" disableTooltip /><p className="text-sm text-muted-alt mb-0">@@ -67,7 +108,7 @@ function DataSourceSetupForm({ sourceConfig }: { sourceConfig: SourceConfigRespo<div className="flex justify-end"><LemonButtontype="primary"- loading={isLoading}+ loading={isLoading || completing}disabledReason={!canGoNext ? 'Fill in the required fields' : undefined}onClick={() => onSubmit()}>diff --git a/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx b/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsxindex b9f2f6d13cbe..1141e901ca97 100644--- a/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx+++ b/products/signals/frontend/inbox/components/config/SelfDrivingSection.tsx@@ -23,31 +23,13 @@ import { IntegrationType } from '~/types'import { signalTeamConfigLogic } from '../../logics/signalTeamConfigLogic'import { userAutonomyLogic } from '../../logics/userAutonomyLogic'-import {- DEFAULT_PULL_REQUEST_LABEL,- GITHUB_LABEL_NAME_MAX_LENGTH,- PRIORITY_THRESHOLD_OPTIONS,- SignalReportPriority,-} from '../../types'+import { DEFAULT_PULL_REQUEST_LABEL, GITHUB_LABEL_NAME_MAX_LENGTH, SignalReportPriority } from '../../types'+import { AUTONOMY_PRIORITY_OPTIONS } from '../../utils/autonomyPriorityOptions'import { AutonomySettingGroup } from './AutonomySettingGroup'import { AutonomySettingRow } from './AutonomySettingRow'-/** Compact segmented-control label per priority. P4 (the lowest bar) reads as "All". */-const THRESHOLD_SEGMENT_LABELS: Record<SignalReportPriority, string> = {- P0: 'P0',- P1: 'P1+',- P2: 'P2+',- P3: 'P3+',- P4: 'All',-}-/** Segments derived from the shared priority list, so the value set and order stay single-sourced. */-const THRESHOLD_SEGMENTS = PRIORITY_THRESHOLD_OPTIONS.map(({ value }) => ({- value,- label: THRESHOLD_SEGMENT_LABELS[value],-}))-const MY_THRESHOLD_DEFAULT_VALUE = '__default__'-const MY_THRESHOLD_SEGMENTS = [{ value: MY_THRESHOLD_DEFAULT_VALUE, label: 'Default' }, ...THRESHOLD_SEGMENTS]+const MY_THRESHOLD_SEGMENTS = [{ value: MY_THRESHOLD_DEFAULT_VALUE, label: 'Default' }, ...AUTONOMY_PRIORITY_OPTIONS]const PR_STATE_SEGMENTS = [{ value: 'draft', label: 'Draft' },@@ -721,7 +703,7 @@ function ProjectThresholdRow(): JSX.Element {size="small"fullWidthvalue={defaultAutostartPriority}- options={THRESHOLD_SEGMENTS}+ options={AUTONOMY_PRIORITY_OPTIONS}disabledReason={teamConfigUpdating ? 'Saving changes' : undefined}onChange={(next) => patchTeamConfig({ default_autostart_priority: next })}/>diff --git a/products/signals/frontend/inbox/components/emptyState/InboxWaitingForWork.tsx b/products/signals/frontend/inbox/components/emptyState/InboxWaitingForWork.tsxindex 866dd510892a..86481195ca68 100644--- a/products/signals/frontend/inbox/components/emptyState/InboxWaitingForWork.tsx+++ b/products/signals/frontend/inbox/components/emptyState/InboxWaitingForWork.tsx@@ -6,6 +6,7 @@ import { Link } from '@posthog/lemon-ui'import { urls } from 'scenes/urls'import { inboxOnboardingLogic } from '../../logics/inboxOnboardingLogic'+import { inboxSetupLogic } from '../../logics/inboxSetupLogic'import { scoutFleetLogic } from '../../logics/scoutFleetLogic'import { signalSourcesLogic } from '../../signalSourcesLogic'import { SignalSourceConfig, SignalSourceProduct, SignalSourceType } from '../../types'@@ -38,10 +39,22 @@ export function InboxWaitingForWork(): JSX.Element {useMountedLogic(signalSourcesLogic)useMountedLogic(scoutFleetLogic)- const { sourceConfigs, sourceConfigsLoading } = useValues(signalSourcesLogic)+ const { sourceConfigs, sourceConfigsLoading, hasEmittingScanner } = useValues(signalSourcesLogic)const { scoutConfigs, scoutConfigsLoading } = useValues(scoutFleetLogic)const { isWizardRunning } = useValues(inboxOnboardingLogic)- const enabledSources = uniqueEnabledSources(sourceConfigs)+ const { completed } = useValues(inboxSetupLogic)+ const enabledSources = [+ ...uniqueEnabledSources(sourceConfigs),+ ...(completed && hasEmittingScanner+ ? [+ {+ id: 'replay-vision',+ source_product: SignalSourceProduct.ReplayVision,+ source_type: SignalSourceType.ScannerFinding,+ },+ ]+ : []),+ ]const enabledScouts = (scoutConfigs ?? []).filter((scout) => scout.enabled && scout.emit)const visibleSources = enabledSources.slice(0, MAX_VISIBLE_ITEMS)const visibleScouts = enabledScouts.slice(0, MAX_VISIBLE_ITEMS)@@ -49,16 +62,17 @@ export function InboxWaitingForWork(): JSX.Element {const scoutsLoading = scoutConfigs === null || scoutConfigsLoadingreturn (- <div className="mx-auto flex w-full max-w-5xl flex-col gap-7 py-6">+ <div className="@container mx-auto flex w-full max-w-5xl flex-col gap-7 py-6"><div className="flex flex-col items-center gap-2 text-center"><h2 className="m-0 text-lg font-semibold">Your agents are working in the background</h2><p className="m-0 max-w-xl text-sm text-tertiary">- Your signal sources and scouts are running in the background. When they find something actionable, a- pull request will appear here.+ {completed+ ? 'Your sources are listening and your scouts will run on their schedules. Reports appear here when they find something worth investigating.'+ : 'Your signal sources and scouts are running in the background. When they find something actionable, a pull request will appear here.'}</p></div>- <div className="grid items-start gap-8 md:grid-cols-2">+ <div className="grid items-start gap-8 @min-[40rem]:grid-cols-2"><section className="flex flex-col"><div className="flex items-center justify-between gap-2 border-b border-primary px-1 pb-3"><div>@@ -75,14 +89,18 @@ export function InboxWaitingForWork(): JSX.Element {) : (<><IconCheckCircle className="size-3.5" />- {enabledSources.length} active+ <span>{enabledSources.length} active</span></>)}</span></div><div className="flex flex-col gap-2">{visibleSources.map((source) => (- <SignalSourceFlowRow key={source.id} source={source} />+ <SignalSourceFlowRow+ key={source.id}+ source={source}+ outcome={completed ? 'Investigate and create a report.' : undefined}+ />))}{isWizardRunning ? <InstallingFlowRow type="source" /> : null}{!sourcesLoading && !isWizardRunning && visibleSources.length === 0 ? (@@ -144,8 +162,12 @@ export function InboxWaitingForWork(): JSX.Element {</div><div className="flex items-center justify-center gap-2 text-sm text-secondary">- <IconPullRequest className="text-lg" />- Pull requests will appear here when a finding is ready to ship.+ {completed ? <IconCheckCircle className="text-lg" /> : <IconPullRequest className="text-lg" />}+ <span>+ {completed+ ? 'Your reports will appear here when they’re ready.'+ : 'Pull requests will appear here when a finding is ready to ship.'}+ </span></div></div>)diff --git a/products/signals/frontend/inbox/components/emptyState/SignalSourceFlowRow.tsx b/products/signals/frontend/inbox/components/emptyState/SignalSourceFlowRow.tsxindex 6fbdd68cb378..9726f3505bf2 100644--- a/products/signals/frontend/inbox/components/emptyState/SignalSourceFlowRow.tsx+++ b/products/signals/frontend/inbox/components/emptyState/SignalSourceFlowRow.tsx@@ -4,7 +4,13 @@ import { SignalSourceConfig } from '../../types'import { getSourceProductMeta } from '../badges/sourceProductIcons'import { sourceTriggerCopy } from './emptyStateCopy'-export function SignalSourceFlowRow({ source }: { source: SignalSourceConfig }): JSX.Element {+export function SignalSourceFlowRow({+ source,+ outcome = 'Investigate and open a pull request when fixable.',+}: {+ source: Pick<SignalSourceConfig, 'source_product' | 'source_type'>+ outcome?: string+}): JSX.Element {const sourceMeta = getSourceProductMeta(source.source_product)const SourceIcon = sourceMeta?.Icon ?? IconBolt@@ -32,7 +38,7 @@ export function SignalSourceFlowRow({ source }: { source: SignalSourceConfig }):</div><div className="min-w-0"><div className="mb-0.5 text-[10px] font-medium text-secondary">Then</div>- <div className="text-tertiary">Investigate and open a pull request when fixable.</div>+ <div className="text-tertiary">{outcome}</div></div></div></div>diff --git a/products/signals/frontend/inbox/components/emptyState/emptyStateCopy.ts b/products/signals/frontend/inbox/components/emptyState/emptyStateCopy.tsindex f9c82726d637..8561cf58bb73 100644--- a/products/signals/frontend/inbox/components/emptyState/emptyStateCopy.ts+++ b/products/signals/frontend/inbox/components/emptyState/emptyStateCopy.ts@@ -1,6 +1,7 @@import { SignalSourceType } from '../../types'const SOURCE_TRIGGER_COPY: Partial<Record<SignalSourceType, string>> = {+ [SignalSourceType.ScannerFinding]: 'a scanner finds a usability problem',[SignalSourceType.SessionProblem]: 'a session shows a product problem',[SignalSourceType.Evaluation]: 'an AI evaluation fails',[SignalSourceType.EvaluationReport]: 'AI evaluation results need attention',diff --git a/products/signals/frontend/inbox/components/onboarding/InboxOnboardingBanner.tsx b/products/signals/frontend/inbox/components/onboarding/InboxOnboardingBanner.tsxindex 7705d61633ce..b314f194723f 100644--- a/products/signals/frontend/inbox/components/onboarding/InboxOnboardingBanner.tsx+++ b/products/signals/frontend/inbox/components/onboarding/InboxOnboardingBanner.tsx@@ -1,4 +1,4 @@-import { useActions } from 'kea'+import { useActions, useValues } from 'kea'import { IconPause, IconX } from '@posthog/icons'import { LemonButton } from '@posthog/lemon-ui'@@ -7,15 +7,12 @@ import { CommandBlock } from 'lib/components/CommandBlock/CommandBlock'import { captureInboxWelcomeCommandCopied } from '../../inboxAnalytics'import { inboxOnboardingLogic } from '../../logics/inboxOnboardingLogic'+import { inboxSetupLogic } from '../../logics/inboxSetupLogic'import { SELF_DRIVING_WIZARD_COMMAND } from './InboxWelcome'-/**- * Sleek, non-blocking nudge shown above the inbox when self-driving isn't set up but reports or- * PRs already exist (they had sources/scouts before). Keeps full access to existing work while- * enticing a re-enable via the same one command. Styled as an "enable a capability" card (à la the- * MCP use-case hint) rather than a system banner; session-dismissable via the close button.- */export function InboxOnboardingBanner(): JSX.Element {+ const { isTreatment } = useValues(inboxSetupLogic)+ const { openSetup } = useActions(inboxSetupLogic)const { dismissBanner } = useActions(inboxOnboardingLogic)return (@@ -31,23 +28,32 @@ export function InboxOnboardingBanner(): JSX.Element {onClick={dismissBanner}/></div>- <p className="mb-0.5 text-sm text-tertiary">- No scouts or sources are enabled right now.{' '}- <strong>Switch self-driving back on with one command in your product's repo:</strong>- </p>- {/* The wizard command as a click-to-copy pill. Reuses the shared `CommandBlock` (same one- MCP install uses) with the `rainbow` AI gradient, so it reads as "enable a capability"- rather than a code dump. */}- <CommandBlock- command={SELF_DRIVING_WIZARD_COMMAND}- copyLabel="self-driving setup command"- ariaLabel="Copy self-driving setup command"- decoration="rainbow"- size="sm"- onCopy={() => captureInboxWelcomeCommandCopied({ surface: 'banner' })}- // rounded-md sits one step inside the rounded-lg banner it nests in.- className="!m-0 rounded-md border border-primary bg-surface-secondary hover:border-accent"- />+ {isTreatment ? (+ <>+ <p className="mb-0.5 text-sm text-tertiary">+ Choose signals and scouts to start receiving reports again.+ </p>+ <LemonButton type="primary" className="w-fit" onClick={openSetup}>+ Set up Self-Driving+ </LemonButton>+ </>+ ) : (+ <>+ <p className="mb-0.5 text-sm text-tertiary">+ No scouts or sources are enabled right now.{' '}+ <strong>Switch self-driving back on with one command in your product's repo:</strong>+ </p>+ <CommandBlock+ command={SELF_DRIVING_WIZARD_COMMAND}+ copyLabel="self-driving setup command"+ ariaLabel="Copy self-driving setup command"+ decoration="rainbow"+ size="sm"+ onCopy={() => captureInboxWelcomeCommandCopied({ surface: 'banner' })}+ className="!m-0 rounded-md border border-primary bg-surface-secondary hover:border-accent"+ />+ </>+ )}</div>)}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxOnboardingEntry.tsx b/products/signals/frontend/inbox/components/onboarding/InboxOnboardingEntry.tsxnew file mode 100644index 000000000000..6647ae8abab6--- /dev/null+++ b/products/signals/frontend/inbox/components/onboarding/InboxOnboardingEntry.tsx@@ -0,0 +1,53 @@+import { useActions, useValues } from 'kea'+import { useEffect } from 'react'++import { LemonBanner, LemonButton, LemonSkeleton } from '@posthog/lemon-ui'++import { teamLogic } from 'scenes/teamLogic'++import { captureInboxWelcomeViewed } from '../../inboxAnalytics'+import { inboxSetupLogic } from '../../logics/inboxSetupLogic'+import { InboxSetupEmptyState } from './InboxSetupEmptyState'+import { InboxSetupFlow } from './InboxSetupFlow'+import { InboxWelcome } from './InboxWelcome'++export function InboxOnboardingEntry(): JSX.Element {+ const { currentTeamId } = useValues(teamLogic)+ const { expose, loadSetup } = useActions(inboxSetupLogic)+ const {+ experimentVariant: variant,+ usesFocusedSetup,+ inProgress,+ savedState,+ savedStateLoading,+ error,+ } = useValues(inboxSetupLogic)+ useEffect(() => {+ if (variant === 'control' || variant === 'test') {+ expose(variant)+ }+ if (variant === 'test') {+ captureInboxWelcomeViewed()+ }+ }, [variant, currentTeamId, expose])+ if (!usesFocusedSetup) {+ return <InboxWelcome />+ }+ if (!savedState && !inProgress) {+ return (+ <div className="mx-auto w-full max-w-2xl px-6 py-8">+ {error ? (+ <LemonBanner type="error">+ <span>{error}</span>+ <LemonButton size="small" onClick={loadSetup} loading={savedStateLoading}>+ Retry+ </LemonButton>+ </LemonBanner>+ ) : (+ <LemonSkeleton className="h-80" />+ )}+ </div>+ )+ }+ return inProgress ? <InboxSetupFlow /> : <InboxSetupEmptyState />+}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxReportPreview.scss b/products/signals/frontend/inbox/components/onboarding/InboxReportPreview.scssnew file mode 100644index 000000000000..aa2c9e011420--- /dev/null+++ b/products/signals/frontend/inbox/components/onboarding/InboxReportPreview.scss@@ -0,0 +1,877 @@+@import '../../../../../../frontend/src/lib/components/ProductEmptyState/previewMixins';++.InboxReportPreview {+ --inbox-preview-accent: var(--empty-state-accent, var(--color-primary-500));+ --purple: var(--color-purple-700);+ --preview-cycle-duration: 20s;+ --preview-stage-duration: 250ms;+ --preview-report-delay: 350ms;+ --preview-patch-delay: 600ms;+ --preview-pr-delay: 1200ms;++ position: relative;++ [theme='dark'] & {+ --purple: var(--color-purple-300);+ }++ &__checkbox,+ &__impact-checkbox {+ position: absolute;+ width: 0;+ height: 0;+ pointer-events: none;+ opacity: 0;+ }++ &__impact-checkbox {+ visibility: hidden;+ }++ &__card {+ display: flex;+ flex-direction: column;+ gap: 0.625rem;+ padding: 0.875rem 1rem;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ &__title {+ min-width: 0;+ font-size: 0.9375rem;+ font-weight: 600;+ line-height: 1.3;+ }++ &__section {+ padding-top: 0.625rem;+ border-top: 1px solid var(--color-border-primary);+ }++ &__heading {+ margin: 0 0 0.25rem;+ font-size: 0.6875rem;+ font-weight: 600;+ color: var(--color-text-secondary);+ text-transform: uppercase;+ letter-spacing: 0.04em;+ }++ &__text {+ margin: 0;+ font-size: 0.75rem;+ line-height: 1.45;+ }++ &__metrics {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: 0.75rem;+ }++ &__metric {+ display: flex;+ flex-direction: column;+ gap: 0.125rem;+ min-width: 0;+ }++ &__metric-value {+ font-size: 1.125rem;+ font-weight: 700;+ font-variant-numeric: tabular-nums;+ line-height: 1.1;+ }++ &__metric-label {+ font-size: 0.6875rem;+ line-height: 1.3;+ color: var(--color-text-secondary);+ }++ &__tags {+ display: flex;++ // Five tags are more than the narrowest scene fits on one line, and the preview+ // must not scroll, so the row wraps.+ flex-wrap: wrap;+ gap: 0.375rem;+ }++ &__tag {+ @for $i from 1 through 4 {+ &:nth-child(#{$i}) {+ animation: InboxReportPreview__tag-#{$i} var(--preview-cycle-duration) ease-in-out infinite;+ }+ }+ }++ &__stages,+ &__actions,+ &__impact-values,+ &__outcome-status,+ &__pr-state {+ display: grid;++ > * {+ grid-area: 1 / 1;+ min-width: 0;+ }+ }++ &__pr-state {+ justify-items: start;+ }++ &__stages {+ position: relative;+ }++ &__monitoring {+ position: absolute;+ inset: 0;+ }++ &__pr-merged {+ @include preview-swap-hidden(0ms);+ }++ &__report,+ &__fix,+ &__monitoring {+ display: flex;+ flex-direction: column;+ gap: 0.625rem;+ }++ &__report {+ @include preview-swap-visible(var(--preview-stage-duration));+ }++ &__fix,+ &__patch,+ &__pull-request,+ &__manual-actions,+ &__monitoring,+ &__monitoring-details,+ &__impact-chart,+ &__chart-zero,+ &__impact-frame--baseline,+ &__watching,+ &__impact-frame--resolved,+ &__resolved {+ @include preview-swap-hidden(var(--preview-stage-duration));+ }++ &__context {+ transition: opacity var(--preview-stage-duration) ease;+ }++ &__solution {+ transition: border-color var(--preview-stage-duration) ease;+ }++ &__patch {+ overflow: hidden;+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ transform: translateY(0.375rem);+ }++ &__patch-header {+ padding: 0.5rem 0.625rem;+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ background: var(--color-bg-fill-primary);+ border-bottom: 1px solid var(--color-border-primary);+ }++ &__diff {+ padding: 0.375rem 0;+ margin: 0;+ font-size: 0.6875rem;+ line-height: 1.65;+ overflow-wrap: anywhere;+ white-space: pre-wrap;++ code {+ display: block;+ font: inherit;+ }++ span,+ del,+ ins {+ display: block;+ padding: 0 0.5rem;+ text-decoration: none;+ }++ del {+ color: var(--color-text-error);+ background: color-mix(in oklab, var(--color-text-error) 8%, transparent);+ }++ ins {+ color: var(--color-text-success);+ background: color-mix(in oklab, var(--color-text-success) 8%, transparent);+ }+ }++ &__pull-request {+ padding: 0.625rem;+ background: var(--color-bg-fill-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ transform: translateY(0.375rem);+ }++ &__pr-title {+ margin: 0.5rem 0 0.25rem;+ font-size: 0.8125rem;+ font-weight: 600;+ line-height: 1.4;+ overflow-wrap: anywhere;+ }++ &__implement,+ &__back,+ &__see-impact {+ display: inline-flex;+ gap: 0.375rem;+ align-items: center;+ justify-self: start;+ padding: 0.25rem 0.625rem;+ font-size: 0.75rem;+ font-weight: 600;+ color: var(--color-text-primary);+ cursor: pointer;+ user-select: none;+ background: var(--color-bg-fill-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);++ &:hover {+ background: var(--color-bg-fill-highlight-100);+ }+ }++ &__monitoring-details,+ &__impact-chart {+ transform: translateY(0.375rem);+ }++ &__impact-chart {+ margin: 0;++ svg {+ display: block;+ width: 100%;+ height: auto;+ max-height: 7rem;+ overflow: visible;+ }++ text {+ font-size: 10px;+ fill: var(--color-text-secondary);+ }++ .InboxReportPreview__merge-label {+ font-weight: 600;+ fill: var(--purple);+ }+ }++ &__chart-caption {+ margin-bottom: 0.25rem;+ font-size: 0.6875rem;+ color: var(--color-text-secondary);+ }++ &__chart-grid {+ stroke: var(--color-border-primary);+ stroke-width: 1;+ }++ &__merge-marker {+ stroke: var(--purple);+ stroke-dasharray: 3 3;+ stroke-width: 1;+ }++ &__chart-before,+ &__chart-after {+ fill: none;+ stroke-linecap: round;+ stroke-linejoin: round;+ stroke-width: 2.5;+ }++ &__chart-before {+ stroke: var(--color-text-error);+ }++ &__chart-after {+ stroke: var(--color-text-success);+ stroke-dasharray: 1;+ stroke-dashoffset: 1;+ }++ &__chart-zero {+ fill: var(--color-text-success);+ }++ &__manual-actions {+ display: flex;+ flex-wrap: wrap;+ gap: 0.5rem;+ justify-content: space-between;+ }++ &__see-impact {+ display: grid;++ > span {+ grid-area: 1 / 1;+ }+ }++ &__back-to-fix-label {+ visibility: hidden;+ }++ &__impact-values {+ margin-top: 1rem;+ }++ &__watching,+ &__resolved {+ display: flex;+ gap: 0.375rem;+ align-items: center;+ margin: 0;+ font-size: 0.75rem;+ }++ &__implement {+ animation: InboxReportPreview__nudge 2.4s ease-in-out infinite;++ @include preview-swap-visible(var(--preview-stage-duration));+ }+}++.InboxReportPreview__checkbox:checked ~ .InboxReportPreview__card {+ .InboxReportPreview__context {+ opacity: 0.5;+ }++ .InboxReportPreview__solution {+ border-color: var(--inbox-preview-accent);+ }++ .InboxReportPreview__report,+ .InboxReportPreview__implement {+ transition-delay:+ var(--preview-report-delay), calc(var(--preview-report-delay) + var(--preview-stage-duration));+ animation: none;++ @include preview-swap-hidden(var(--preview-stage-duration));+ }++ .InboxReportPreview__fix,+ .InboxReportPreview__manual-actions {+ transition-delay: var(--preview-report-delay);++ @include preview-swap-visible(var(--preview-stage-duration));+ }++ .InboxReportPreview__patch,+ .InboxReportPreview__pull-request {+ transition:+ opacity var(--preview-stage-duration) ease var(--preview-patch-delay),+ transform var(--preview-stage-duration) ease var(--preview-patch-delay),+ visibility 0s linear var(--preview-patch-delay);+ transform: translateY(0);++ @include preview-swap-visible(var(--preview-stage-duration));+ }++ .InboxReportPreview__pull-request {+ transition-delay: var(--preview-pr-delay);+ }+}++.InboxReportPreview__checkbox:checked ~ .InboxReportPreview__impact-checkbox {+ visibility: visible;+}++.InboxReportPreview__checkbox:checked ~ .InboxReportPreview__impact-checkbox:checked ~ .InboxReportPreview__card {+ .InboxReportPreview__fix,+ .InboxReportPreview__patch,+ .InboxReportPreview__pull-request,+ .InboxReportPreview__impact-frame--baseline,+ .InboxReportPreview__watching,+ .InboxReportPreview__see-impact-label {+ @include preview-swap-hidden(0ms);+ }++ .InboxReportPreview__monitoring,+ .InboxReportPreview__monitoring-details,+ .InboxReportPreview__impact-chart,+ .InboxReportPreview__chart-zero,+ .InboxReportPreview__impact-frame--resolved,+ .InboxReportPreview__resolved,+ .InboxReportPreview__back-to-fix-label {+ transform: translateY(0);++ @include preview-swap-visible(0ms);+ }++ .InboxReportPreview__chart-after {+ stroke-dashoffset: 0;+ }+}++.InboxReportPreview__impact-checkbox:focus-visible ~ .InboxReportPreview__card .InboxReportPreview__see-impact {+ outline: 2px solid var(--inbox-preview-accent);+ outline-offset: 1px;+}++.InboxReportPreview__checkbox:focus-visible ~ .InboxReportPreview__card {+ .InboxReportPreview__implement,+ .InboxReportPreview__back {+ outline: 2px solid var(--inbox-preview-accent);+ outline-offset: 1px;+ }+}++@media (prefers-reduced-motion: no-preference) {+ .InboxReportPreview__checkbox:not(:checked) ~ .InboxReportPreview__card {+ .InboxReportPreview__report {+ animation: InboxReportPreview__report-cycle var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__implement {+ animation:+ InboxReportPreview__report-cycle var(--preview-cycle-duration) ease infinite,+ InboxReportPreview__press var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__context {+ animation: InboxReportPreview__context-cycle var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__solution {+ animation: InboxReportPreview__solution-cycle var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__fix {+ animation: InboxReportPreview__fix-cycle var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__patch {+ animation: InboxReportPreview__patch-cycle var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__pull-request {+ animation: InboxReportPreview__pr-cycle var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__monitoring {+ animation: InboxReportPreview__monitoring-cycle var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__pr-open {+ animation: InboxReportPreview__pr-open-cycle var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__pr-merged {+ animation: InboxReportPreview__pr-merged-cycle var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__monitoring-details {+ animation: InboxReportPreview__details-entry var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__impact-chart {+ animation: InboxReportPreview__chart-entry var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__merge-event {+ animation: InboxReportPreview__merge-entry var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__chart-after {+ animation: InboxReportPreview__chart-drop var(--preview-cycle-duration) linear infinite;+ }++ .InboxReportPreview__chart-zero {+ animation: InboxReportPreview__chart-zero-entry var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__impact-frame--baseline {+ animation: InboxReportPreview__baseline-cycle var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__watching {+ animation: InboxReportPreview__watching-cycle var(--preview-cycle-duration) ease infinite;+ }++ .InboxReportPreview__impact-frame--resolved,+ .InboxReportPreview__resolved {+ animation: InboxReportPreview__resolved-cycle var(--preview-cycle-duration) ease infinite;+ }+ }+}++// Keyboard navigation switches to the manual controls instead of focusing a moving target.+.InboxReportPreview__checkbox:focus-visible ~ .InboxReportPreview__card * {+ animation: none !important;+}++.InboxReportPreview--static {+ --preview-stage-duration: 0ms;+ --preview-report-delay: 0ms;+ --preview-patch-delay: 0ms;+ --preview-pr-delay: 0ms;+}++@media (prefers-reduced-motion: reduce) {+ .InboxReportPreview {+ --preview-stage-duration: 0ms;+ --preview-report-delay: 0ms;+ --preview-patch-delay: 0ms;+ --preview-pr-delay: 0ms;+ }+}++@keyframes InboxReportPreview__report-cycle {+ 0%,+ 27%,+ 98%,+ 100% {+ visibility: visible;+ opacity: 1;+ }++ 29%,+ 95% {+ visibility: hidden;+ opacity: 0;+ }+}++@keyframes InboxReportPreview__fix-cycle {+ 0%,+ 27%,+ 61%,+ 100% {+ visibility: hidden;+ opacity: 0;+ }++ 29%,+ 59% {+ visibility: visible;+ opacity: 1;+ }+}++@keyframes InboxReportPreview__patch-cycle {+ 0%,+ 29%,+ 61%,+ 100% {+ visibility: hidden;+ opacity: 0;+ transform: translateY(0.375rem);+ }++ 32%,+ 59% {+ visibility: visible;+ opacity: 1;+ transform: translateY(0);+ }+}++@keyframes InboxReportPreview__pr-cycle {+ 0%,+ 35%,+ 61%,+ 100% {+ visibility: hidden;+ opacity: 0;+ transform: translateY(0.375rem);+ }++ 38%,+ 59% {+ visibility: visible;+ opacity: 1;+ transform: translateY(0);+ }+}++@keyframes InboxReportPreview__monitoring-cycle {+ 0%,+ 59%,+ 98%,+ 100% {+ visibility: hidden;+ opacity: 0;+ }++ 61%,+ 95% {+ visibility: visible;+ opacity: 1;+ }+}++@keyframes InboxReportPreview__pr-open-cycle {+ 0%,+ 35%,+ 47%,+ 100% {+ visibility: hidden;+ opacity: 0;+ }++ 38%,+ 45% {+ visibility: visible;+ opacity: 1;+ }+}++@keyframes InboxReportPreview__pr-merged-cycle {+ 0%,+ 45%,+ 61%,+ 100% {+ visibility: hidden;+ opacity: 0;+ }++ 47%,+ 59% {+ visibility: visible;+ opacity: 1;+ }+}++@keyframes InboxReportPreview__details-entry {+ 0%,+ 59%,+ 98%,+ 100% {+ visibility: hidden;+ opacity: 0;+ transform: translateY(0.375rem);+ }++ 61%,+ 95% {+ visibility: visible;+ opacity: 1;+ transform: translateY(0);+ }+}++@keyframes InboxReportPreview__chart-entry {+ 0%,+ 59%,+ 98%,+ 100% {+ visibility: hidden;+ opacity: 0;+ transform: translateY(0.375rem);+ }++ 61%,+ 95% {+ visibility: visible;+ opacity: 1;+ transform: translateY(0);+ }+}++@keyframes InboxReportPreview__merge-entry {+ 0%,+ 61%,+ 99%,+ 100% {+ clip-path: inset(0 0 100% 0);+ opacity: 0;+ }++ 64%,+ 98% {+ clip-path: inset(0);+ opacity: 1;+ }+}++@keyframes InboxReportPreview__chart-drop {+ 0%,+ 65%,+ 100% {+ stroke-dashoffset: 1;+ }++ 66% {+ stroke-dashoffset: 0.915;+ }++ 67.5% {+ stroke-dashoffset: 0.658;+ }++ 70%,+ 99% {+ stroke-dashoffset: 0;+ }+}++@keyframes InboxReportPreview__chart-zero-entry {+ 0%,+ 69%,+ 99%,+ 100% {+ visibility: hidden;+ opacity: 0;+ }++ 70%,+ 98% {+ visibility: visible;+ opacity: 1;+ }+}++@keyframes InboxReportPreview__baseline-cycle {+ 0%,+ 58%,+ 67.5%,+ 100% {+ visibility: hidden;+ opacity: 0;+ }++ 59%,+ 66.5% {+ visibility: visible;+ opacity: 1;+ }+}++@keyframes InboxReportPreview__resolved-cycle {+ 0%,+ 66.5%,+ 99%,+ 100% {+ visibility: hidden;+ opacity: 0;+ }++ 67.5%,+ 98% {+ visibility: visible;+ opacity: 1;+ }+}++@keyframes InboxReportPreview__watching-cycle {+ 0%,+ 58%,+ 67.5%,+ 100% {+ visibility: hidden;+ opacity: 0;+ }++ 59%,+ 66.5% {+ visibility: visible;+ opacity: 1;+ }+}++@keyframes InboxReportPreview__press {+ 0%,+ 24.5%,+ 26.5%,+ 100% {+ background: var(--color-bg-fill-primary);+ transform: scale(1);+ }++ 26% {+ background: color-mix(in oklab, var(--inbox-preview-accent) 20%, var(--color-bg-fill-primary));+ transform: scale(0.96);+ }+}++@keyframes InboxReportPreview__context-cycle {+ 0%,+ 17%,+ 98%,+ 100% {+ opacity: 1;+ }++ 18%,+ 95% {+ opacity: 0.5;+ }+}++@keyframes InboxReportPreview__solution-cycle {+ 0%,+ 17%,+ 98%,+ 100% {+ border-color: var(--color-border-primary);+ }++ 18%,+ 95% {+ border-color: var(--inbox-preview-accent);+ }+}++@for $i from 1 through 4 {+ $start: 0.5% + ($i - 1) * 4.25%;++ @keyframes InboxReportPreview__tag-#{$i} {+ 0%,+ #{$start},+ #{$start + 4%},+ 100% {+ background-color: transparent;+ border-color: var(--color-border-primary);+ }+ #{$start + 0.75%},+ #{$start + 3.25%} {+ background-color: color-mix(in oklab, var(--inbox-preview-accent) 15%, transparent);+ border-color: var(--inbox-preview-accent);+ }+ }+}++@keyframes InboxReportPreview__nudge {+ 0%,+ 100% {+ box-shadow: 0 0 0 0 color-mix(in oklab, var(--inbox-preview-accent) 35%, transparent);+ }++ 50% {+ box-shadow: 0 0 0 4px color-mix(in oklab, var(--inbox-preview-accent) 0%, transparent);+ }+}++@include preview-motion-guards('InboxReportPreview');diff --git a/products/signals/frontend/inbox/components/onboarding/InboxReportPreview.tsx b/products/signals/frontend/inbox/components/onboarding/InboxReportPreview.tsxnew file mode 100644index 000000000000..501983ea7164--- /dev/null+++ b/products/signals/frontend/inbox/components/onboarding/InboxReportPreview.tsx@@ -0,0 +1,331 @@+import './InboxReportPreview.scss'++import { useId, useRef } from 'react'++import {+ IconArrowLeft,+ IconCheckCircle,+ IconGraph,+ IconPullRequest,+ IconPulse,+ IconRefresh,+ IconRewindPlay,+ IconSupport,+ IconWarning,+} from '@posthog/icons'+import { LemonButton, Link } from '@posthog/lemon-ui'++import type { ProductEmptyStateMode } from 'lib/components/ProductEmptyState/types'+import { LemonTag } from 'lib/lemon-ui/LemonTag'+import { cn } from 'lib/utils/css-classes'+import { inStorybook, inStorybookTestRunner } from 'lib/utils/dom'++import { SignalReportPriorityBadge } from '../badges/SignalReportPriorityBadge'++// The sources a report draws on, in the order the setup flow offers them next.+const EVIDENCE: { label: string; icon: JSX.Element }[] = [+ { label: 'Session replay', icon: <IconRewindPlay /> },+ { label: 'Error tracking', icon: <IconWarning /> },+ { label: 'Product analytics', icon: <IconGraph /> },+ { label: 'Support', icon: <IconSupport /> },+]++const IMPACT_STAGES = [+ { stage: 'baseline', customers: '128', revenue: '-18%' },+ { stage: 'resolved', customers: '0', revenue: '0%' },+]++/** CSS stages keep this example local: playing the preview never starts an implementation. */+export function InboxReportPreview(_: { mode: ProductEmptyStateMode }): JSX.Element {+ const isStatic = inStorybook() || inStorybookTestRunner()+ const implementId = useId()+ const impactId = `${implementId}-impact`+ const inputRef = useRef<HTMLInputElement>(null)+ const impactRef = useRef<HTMLInputElement>(null)+ const cardRef = useRef<HTMLDivElement>(null)++ const resetImpact = (): void => {+ if (impactRef.current) {+ impactRef.current.checked = false+ }+ }++ const restartPreview = (): void => {+ resetImpact()+ if (inputRef.current) {+ inputRef.current.checked = false+ }+ for (const animation of cardRef.current?.getAnimations({ subtree: true }) ?? []) {+ if (animation instanceof CSSTransition) {+ animation.finish()+ } else {+ animation.currentTime = 0+ animation.play()+ }+ }+ }++ return (+ <div className={cn('InboxReportPreview', isStatic && 'InboxReportPreview--static')}>+ {/* A direct child of the root so `:checked ~` reaches the card. */}+ <input+ type="checkbox"+ id={implementId}+ ref={inputRef}+ aria-label="Show example fix"+ aria-controls={`${implementId}-card`}+ className="InboxReportPreview__checkbox"+ onChange={(event) => {+ if (!event.target.checked) {+ resetImpact()+ }+ }}+ />++ <input+ type="checkbox"+ id={impactId}+ ref={impactRef}+ aria-label="Show example impact"+ aria-controls={`${implementId}-card`}+ className="InboxReportPreview__impact-checkbox"+ />++ <div className="absolute right-2 top-2 z-10">+ <LemonButton+ type="tertiary"+ size="xsmall"+ icon={<IconRefresh />}+ tooltip="Restart preview"+ aria-label="Restart preview"+ data-attr="inbox-report-preview-restart"+ onClick={restartPreview}+ />+ </div>++ <div className="InboxReportPreview__card" id={`${implementId}-card`} ref={cardRef}>+ <div className="flex items-start gap-2 pr-8">+ <SignalReportPriorityBadge priority="P0" />+ <span className="InboxReportPreview__title">Trial users cannot upgrade to Pro</span>+ </div>++ {/* All stages occupy the same grid cell to reserve space without changing the card's height. */}+ <div className="InboxReportPreview__stages">+ <div className="InboxReportPreview__report">+ <section className="InboxReportPreview__section InboxReportPreview__context">+ <h4 className="InboxReportPreview__heading">Problem</h4>+ <p className="InboxReportPreview__text">+ The billing page does not keep the selected plan. Trial users go back to the pricing+ page and do not pay.+ </p>+ </section>++ <section className="InboxReportPreview__section InboxReportPreview__context">+ <h4 className="InboxReportPreview__heading">Impact</h4>+ <div className="InboxReportPreview__metrics">+ <div className="InboxReportPreview__metric">+ <span className="InboxReportPreview__metric-value">128</span>+ <span className="InboxReportPreview__metric-label">+ affected customers, last 7 days+ </span>+ </div>+ <div className="InboxReportPreview__metric">+ <span className="InboxReportPreview__metric-value text-danger">-18%</span>+ <span className="InboxReportPreview__metric-label">+ new subscription revenue, 7 days+ </span>+ </div>+ </div>+ </section>++ <section className="InboxReportPreview__section InboxReportPreview__context">+ <h4 className="InboxReportPreview__heading">Evidence</h4>+ <div className="InboxReportPreview__tags">+ {EVIDENCE.map(({ label, icon }) => (+ <LemonTag key={label} size="small" icon={icon} className="InboxReportPreview__tag">+ {label}+ </LemonTag>+ ))}+ </div>+ </section>++ <section className="InboxReportPreview__section InboxReportPreview__solution">+ <h4 className="InboxReportPreview__heading">Solution</h4>+ <p className="InboxReportPreview__text">+ Keep the selected plan when the billing page redirects.+ </p>+ </section>+ </div>+ <div className="InboxReportPreview__fix">+ <section className="InboxReportPreview__section">+ <h4 className="InboxReportPreview__heading">Proposed fix</h4>+ <p className="InboxReportPreview__text">+ Keep the selected plan when the billing page redirects.+ </p>+ </section>+ <div className="InboxReportPreview__patch">+ <div className="InboxReportPreview__patch-header">Example patch · billing.ts</div>+ <pre className="InboxReportPreview__diff" aria-label="Example code change">+ <code>+ <span>{' function resumeUpgrade(plan) {'}</span>+ <del>- redirect('/pricing')</del>+ <ins>+ redirect(checkoutUrl(plan))</ins>+ <span>{' }'}</span>+ </code>+ </pre>+ </div>+ <div className="InboxReportPreview__pull-request">+ <div className="flex items-center gap-2">+ <span className="InboxReportPreview__pr-state shrink-0">+ <IconPullRequest className="InboxReportPreview__pr-open text-success" />+ <IconCheckCircle className="InboxReportPreview__pr-merged text-purple" />+ </span>+ <h4 className="InboxReportPreview__heading mb-0">Pull request</h4>+ <div className="InboxReportPreview__pr-state">+ <LemonTag type="success" size="small" className="InboxReportPreview__pr-open">+ Open+ </LemonTag>+ <LemonTag type="completion" size="small" className="InboxReportPreview__pr-merged">+ PR merged+ </LemonTag>+ </div>+ </div>+ <p className="InboxReportPreview__pr-title">fix(billing): preserve the selected plan</p>+ <div className="InboxReportPreview__pr-state">+ <p className="InboxReportPreview__text text-secondary InboxReportPreview__pr-open">+ Ready for your review.+ </p>+ <p className="InboxReportPreview__text text-secondary InboxReportPreview__pr-merged">+ Merged and deployed.+ </p>+ </div>+ </div>+ </div>+ <div className="InboxReportPreview__monitoring">+ <section className="InboxReportPreview__section InboxReportPreview__monitoring-details">+ <h4 className="InboxReportPreview__heading">Monitoring impact</h4>+ <div className="InboxReportPreview__impact-values">+ {IMPACT_STAGES.map(({ stage, customers, revenue }) => (+ <div+ key={stage}+ className={`InboxReportPreview__impact-frame InboxReportPreview__impact-frame--${stage}`}+ >+ <div className="InboxReportPreview__metrics">+ <div className="InboxReportPreview__metric">+ <span+ className={cn(+ 'InboxReportPreview__metric-value',+ stage === 'resolved' && 'text-success'+ )}+ >+ {customers}+ </span>+ <span className="InboxReportPreview__metric-label">+ affected customers+ </span>+ </div>+ <div className="InboxReportPreview__metric">+ <span+ className={cn(+ 'InboxReportPreview__metric-value',+ stage === 'resolved' ? 'text-success' : 'text-danger'+ )}+ >+ {revenue}+ </span>+ <span className="InboxReportPreview__metric-label">revenue impact</span>+ </div>+ </div>+ </div>+ ))}+ </div>+ </section>+ <figure className="InboxReportPreview__impact-chart">+ <figcaption className="InboxReportPreview__chart-caption">+ Affected customers per day · example+ </figcaption>+ <svg+ viewBox="0 0 320 116"+ role="img"+ aria-label="Example affected customers stay near 128 before the PR merges, then drop to zero shortly after merge when the fix is deployed and remain there."+ >+ <line x1="34" y1="32" x2="304" y2="32" className="InboxReportPreview__chart-grid" />+ <line x1="34" y1="92" x2="304" y2="92" className="InboxReportPreview__chart-grid" />+ <text x="25" y="35" textAnchor="end">+ 128+ </text>+ <text x="25" y="95" textAnchor="end">+ 0+ </text>+ <g className="InboxReportPreview__merge-event">+ <line+ x1="130"+ y1="20"+ x2="130"+ y2="96"+ className="InboxReportPreview__merge-marker"+ />+ <text+ x="130"+ y="12"+ textAnchor="middle"+ className="InboxReportPreview__merge-label"+ >+ PR merged+ </text>+ </g>+ <path+ d="M34 32 L58 29 L82 34 L106 31 L130 32"+ className="InboxReportPreview__chart-before"+ />+ <path+ d="M130 32 H150 V92 H304"+ pathLength="1"+ className="InboxReportPreview__chart-after"+ />+ <circle cx="304" cy="92" r="3" className="InboxReportPreview__chart-zero" />+ <text x="34" y="112">+ Before merge+ </text>+ <text x="304" y="112" textAnchor="end">+ After merge+ </text>+ </svg>+ </figure>+ <div className="InboxReportPreview__outcome-status">+ <p className="InboxReportPreview__watching">+ <IconPulse className="shrink-0" />+ Monitoring for recurring failures+ </p>+ <p className="InboxReportPreview__resolved text-success">+ <IconCheckCircle className="shrink-0" />+ No new failed upgrades observed+ </p>+ </div>+ </div>+ </div>+ <div className="InboxReportPreview__actions">+ <label htmlFor={implementId} className="InboxReportPreview__implement">+ <IconPullRequest />+ Implement+ </label>+ <div className="InboxReportPreview__manual-actions">+ <label htmlFor={implementId} className="InboxReportPreview__back">+ <IconArrowLeft />+ Back to report+ </label>+ <label htmlFor={impactId} className="InboxReportPreview__see-impact">+ <span className="InboxReportPreview__see-impact-label">See impact</span>+ <span className="InboxReportPreview__back-to-fix-label">Back to fix</span>+ </label>+ </div>+ </div>+ </div>+ <p className="mt-3 mb-0 text-xs">+ <Link to="https://posthog.com/docs/self-driving/from-our-inbox" target="_blank">+ See reports generated for PostHog+ </Link>+ </p>+ </div>+ )+}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxSetupEmptyState.tsx b/products/signals/frontend/inbox/components/onboarding/InboxSetupEmptyState.tsxnew file mode 100644index 000000000000..ea34f2503ecd--- /dev/null+++ b/products/signals/frontend/inbox/components/onboarding/InboxSetupEmptyState.tsx@@ -0,0 +1,65 @@+import { useActions } from 'kea'++import * as selfDrivingPng from '@posthog/brand/hoggies/png/self-driving'+import { IconArrowRight } from '@posthog/icons'+import { LemonButton } from '@posthog/lemon-ui'++import { pngHoggie } from 'lib/brand/hoggies'+import { ProductEmptyState } from 'lib/components/ProductEmptyState/ProductEmptyState'+import type { ProductEmptyStateConfig } from 'lib/components/ProductEmptyState/types'+import { IconSelfDriving } from 'lib/lemon-ui/icons'++import { ProductKey } from '~/queries/schema/schema-general'++import { inboxSetupLogic } from '../../logics/inboxSetupLogic'+import { InboxReportPreview } from './InboxReportPreview'++const HedgehogSelfDriving = pngHoggie(selfDrivingPng)++function SetUpSelfDrivingAction(): JSX.Element {+ const { continueFromWelcome } = useActions(inboxSetupLogic)++ return (+ <LemonButton+ type="primary"+ status="alt"+ sideIcon={<IconArrowRight />}+ className="self-start"+ onClick={continueFromWelcome}+ // pinned: data-attr - the welcome funnel and test selectors match on this string+ data-attr="inbox-setup-welcome-continue"+ >+ Set up Self-Driving+ </LemonButton>+ )+}++const INBOX_SETUP_EMPTY_STATE: ProductEmptyStateConfig = {+ productKey: ProductKey.SELF_DRIVING,+ productName: 'Self-Driving',+ icon: <IconSelfDriving />,+ accentColor: 'var(--color-product-self-driving-light)',+ accentColorDark: 'var(--color-product-self-driving-dark)',+ hedgehog: HedgehogSelfDriving,+ hedgehogPlacement: 'beside',+ text: {+ 'needs-setup': {+ headline: 'Let PostHog find what needs your attention',+ lead: 'AI does the research for you. Get reports with evidence and next steps. Ship fixes with your agent of choice, or let PostHog do it for you.',+ },+ },+ PrimaryAction: SetUpSelfDrivingAction,+ docsUrl: 'https://posthog.com/docs/self-driving',+ previewLabel: 'Example report',+ Preview: InboxReportPreview,+ // An inbox that isn't set up is an empty list, so skipping would reveal nothing.+ skippable: false,+}++/**+ * Rendered by the inbox's own takeover gate rather than the scene-level one: the setup flow it opens+ * lives inside the same scene, and the control variant still shows the wizard takeover.+ */+export function InboxSetupEmptyState(): JSX.Element {+ return <ProductEmptyState config={INBOX_SETUP_EMPTY_STATE} mode="needs-setup" />+}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxSetupFlow.stories.tsx b/products/signals/frontend/inbox/components/onboarding/InboxSetupFlow.stories.tsxnew file mode 100644index 000000000000..3caf09d0ebc4--- /dev/null+++ b/products/signals/frontend/inbox/components/onboarding/InboxSetupFlow.stories.tsx@@ -0,0 +1,345 @@+import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'++import type { Meta, StoryObj } from '@storybook/react'++import { FEATURE_FLAGS, TeamMembershipLevel } from 'lib/constants'++import { mswDecorator } from '~/mocks/browser'++import type { InboxOnboardingDraftApi } from '../../../generated/api.schemas'+import { mockScoutSuggestionSet, mockScoutConfigs } from '../../__mocks__/scoutConfigs'+import { InboxOnboardingBanner } from './InboxOnboardingBanner'+import { InboxOnboardingEntry } from './InboxOnboardingEntry'+import { InboxSetupFlow } from './InboxSetupFlow'++const draft: InboxOnboardingDraftApi = {+ step: 'signals',+ sources: [+ { source_product: 'error_tracking', source_type: 'issue_created', enabled: true },+ { source_product: 'error_tracking', source_type: 'issue_reopened', enabled: true },+ { source_product: 'error_tracking', source_type: 'issue_spiking', enabled: true },+ { source_product: 'health_checks', source_type: 'health_issue', enabled: true },+ ],+ scanner_ids: ['11111111-1111-4111-8111-111111111111'],+ suggestions: [],++ automatic_implementation: false,+ implementation_priority: 'P1',+}++function projectMocks(+ hasData: boolean,+ membershipLevel: TeamMembershipLevel | null = TeamMembershipLevel.Admin+): ReturnType<typeof mswDecorator> {+ let team = {+ ...MOCK_DEFAULT_TEAM,+ ingested_event: hasData,+ session_recording_opt_in: hasData,+ autocapture_exceptions_opt_in: hasData,+ conversations_enabled: false,+ effective_membership_level: membershipLevel,+ }+ return mswDecorator({+ get: {+ '/api/projects/@current': () => [200, team],+ '/api/projects/:id/error_tracking/issues/exists/': { exists: hasData },+ },+ post: {+ '/api/projects/:id/product_enablement/': async ({ request }) => {+ const { products } = (await request.json()) as { products: string[] }+ team = {+ ...team,+ session_recording_opt_in: team.session_recording_opt_in || products.includes('session_replay'),+ autocapture_exceptions_opt_in:+ team.autocapture_exceptions_opt_in || products.includes('error_tracking'),+ conversations_enabled: team.conversations_enabled || products.includes('conversations'),+ }+ return [200, {}]+ },+ },+ })+}++const meta: Meta<typeof InboxSetupFlow> = {+ title: 'Scenes-App/Inbox/Focused setup',+ component: InboxSetupFlow,+ parameters: {+ layout: 'fullscreen',+ mockDate: '2026-10-14',+ featureFlags: { [FEATURE_FLAGS.INBOX_UI_ONBOARDING]: 'test', [FEATURE_FLAGS.INBOX_REDESIGN]: true },+ },+ decorators: [+ (Story) => (+ <div className="h-dvh p-4">+ <Story />+ </div>+ ),+ projectMocks(true),+ mswDecorator({+ get: {+ '/api/projects/:id/signals/reports/available_reviewers/': {},+ '/api/environments/:id/external_data_sources/': { results: [], next: null, count: 0 },+ '/api/environments/:id/external_data_sources/wizard/': {+ Zendesk: {+ name: 'Zendesk',+ label: 'Zendesk',+ iconPath: '/static/services/zendesk.png',+ fields: [+ { name: 'subdomain', label: 'Subdomain', type: 'text', required: true },+ { name: 'api_key', label: 'API token', type: 'password', required: true },+ { name: 'email_address', label: 'Email address', type: 'text', required: true },+ ],+ supportsColumnSelection: false,+ versions: [],+ defaultVersion: '',+ deprecatedVersions: [],+ },+ },+ '/api/projects/:id/signals/onboarding/': { draft, completed_at: null, variant: 'test' },+ '/api/projects/:id/signals/source_configs/': { results: [], next: null, count: 0 },+ '/api/projects/:id/event_definitions/': {+ results: [{ name: '$exception', last_seen_at: '2026-01-01T00:00:00Z' }],+ next: null,+ count: 1,+ },+ '/api/projects/:id/vision/scanners/': {+ results: [+ {+ id: '11111111-1111-4111-8111-111111111111',+ name: 'Checkout scanner',+ enabled: true,+ emits_signals: false,+ },+ ],+ next: null,+ count: 1,+ },+ '/api/projects/:id/signals/scout/suggestions/': mockScoutSuggestionSet(),+ '/api/projects/:id/signals/scout/configs/': [],+ '/api/projects/:id/integrations/': { results: [], next: null, count: 0 },+ '/api/projects/:id/integrations/github/available_installations/': {+ discovery_id: 'example',+ discovered_at: '2026-01-01T00:00:00Z',+ installations: [],+ personal_github_connected: false,+ personal_github_login: null,+ personal_discovery_status: 'not_connected',+ },+ '/api/projects/:id/integrations/github/install_requests/': [],+ },+ post: {+ '/api/projects/:id/signals/scout/configs/sync/': [],+ '/api/projects/:id/signals/onboarding/': async ({ request }) => [+ 200,+ { draft: await request.json(), completed_at: null, variant: 'test' },+ ],+ },+ }),+ ],+}++export default meta+type Story = StoryObj<typeof meta>++export const Signals: Story = {}+export const NarrowSignals: Story = {+ decorators: [+ (Story) => (+ <div className="h-full w-130">+ <Story />+ </div>+ ),+ ],+}+export const Scouts: Story = {+ render: () => <InboxOnboardingEntry />,+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:id/signals/onboarding/': {+ draft: { ...draft, step: 'scouts' },+ completed_at: null,+ variant: 'test',+ },+ },+ post: {+ '/api/projects/:id/signals/onboarding/expose/': {+ draft: { ...draft, step: 'scouts' },+ completed_at: null,+ variant: 'test',+ },+ },+ }),+ ],+}+export const Github: Story = {+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:id/signals/onboarding/': {+ draft: { ...draft, step: 'github' },+ completed_at: null,+ variant: 'test',+ },+ },+ }),+ ],+}++export const NoProductsEnabled: Story = {+ decorators: [+ projectMocks(false),+ mswDecorator({+ get: {+ '/api/projects/:id/signals/onboarding/': { draft: null, completed_at: null, variant: 'test' },+ '/api/projects/:id/event_definitions/': { results: [], next: null, count: 0 },+ '/api/projects/:id/vision/scanners/': { results: [], next: null, count: 0 },+ '/api/projects/:id/signals/scout/configs/': [+ { ...mockScoutConfigs[0], id: 'general', skill_name: 'signals-scout-general', enabled: false },+ ],+ '/api/projects/:id/signals/scout/suggestions/': mockScoutSuggestionSet({+ status: 'low_activity',+ items: [],+ }),+ },+ post: {+ '/api/projects/:id/signals/scout/configs/sync/': [+ { ...mockScoutConfigs[0], id: 'general', skill_name: 'signals-scout-general', enabled: false },+ ],+ },+ }),+ ],+}++export const BuiltInScouts: Story = {+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:id/signals/onboarding/': {+ draft: { ...draft, step: 'scouts' },+ completed_at: null,+ variant: 'test',+ },+ '/api/projects/:id/signals/scout/suggestions/': mockScoutSuggestionSet({+ status: 'low_activity',+ items: [],+ }),+ '/api/projects/:id/signals/scout/configs/': [],+ },+ post: {+ '/api/projects/:id/signals/scout/configs/sync/': [+ 'general',+ 'product-analytics',+ 'error-tracking',+ 'session-replay',+ 'replay-vision',+ 'ai-observability',+ 'conversations',+ 'data-warehouse',+ 'health-checks',+ ].map((name) => ({+ ...mockScoutConfigs[0],+ id: `builtin-${name}`,+ skill_name: `signals-scout-${name}`,+ enabled: false,+ })),+ },+ }),+ ],+}++export const GithubAlreadyConnected: Story = {+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:id/signals/onboarding/': {+ draft: { ...draft, step: 'github' },+ completed_at: null,+ variant: 'test',+ },+ '/api/projects/:id/integrations/': {+ results: [+ {+ id: 1,+ kind: 'github',+ config: {},+ display_name: 'example',+ created_at: '2026-10-14',+ icon_url: '',+ },+ ],+ next: null,+ count: 1,+ },+ '/api/projects/:id/integrations/1/github_repos/': {+ repositories: [{ id: 1, name: 'app', full_name: 'example/app', can_push: true }],+ has_more: false,+ total: 1,+ },+ },+ }),+ ],+}++export const GithubAccessRequired: Story = {+ decorators: [+ projectMocks(true, null),+ mswDecorator({+ get: {+ '/api/projects/:id/signals/onboarding/': {+ draft: { ...draft, step: 'github' },+ completed_at: null,+ variant: 'test',+ },+ },+ post: { '/api/projects/:id/integrations/request_access/': {} },+ }),+ ],+}++export const TreatmentEntry = {+ render: () => <InboxOnboardingEntry />,+ decorators: [+ mswDecorator({+ get: { '/api/projects/:id/signals/onboarding/': { draft: null, completed_at: null, variant: 'test' } },+ post: {+ '/api/projects/:id/signals/onboarding/expose/': { draft: null, completed_at: null, variant: 'test' },+ },+ }),+ ],+} satisfies Story++export const NarrowTreatmentEntry: Story = {+ ...TreatmentEntry,+ decorators: [+ ...(TreatmentEntry.decorators ?? []),+ (Story) => (+ <div className="h-full w-130">+ <Story />+ </div>+ ),+ ],+}++export const ManualEntry: Story = {+ parameters: {+ featureFlags: { [FEATURE_FLAGS.INBOX_UI_ONBOARDING]: 'control', [FEATURE_FLAGS.INBOX_REDESIGN]: true },+ },+ render: () => <InboxOnboardingEntry />,+ decorators: [+ mswDecorator({+ get: { '/api/projects/:id/signals/onboarding/': { draft: null, completed_at: null, variant: 'control' } },+ post: {+ '/api/projects/:id/signals/onboarding/expose/': { draft: null, completed_at: null, variant: 'control' },+ '/api/projects/:id/signals/onboarding/': async ({ request }) => [+ 200,+ { draft: await request.json(), completed_at: null, variant: 'control' },+ ],+ },+ }),+ ],+}++export const TreatmentReminder: Story = {+ render: () => <InboxOnboardingBanner />,+}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxSetupFlow.tsx b/products/signals/frontend/inbox/components/onboarding/InboxSetupFlow.tsxnew file mode 100644index 000000000000..41ff07f081f9--- /dev/null+++ b/products/signals/frontend/inbox/components/onboarding/InboxSetupFlow.tsx@@ -0,0 +1,105 @@+import { useActions, useMountedLogic, useValues } from 'kea'+import { useEffect } from 'react'++import { IconArrowLeft, IconArrowRight } from '@posthog/icons'+import { LemonBanner, LemonButton } from '@posthog/lemon-ui'++import { GuidedWizardPanel } from 'lib/components/GuidedWizard/GuidedWizardPanel'+import { GuidedWizardStepper } from 'lib/components/GuidedWizard/GuidedWizardStepper'+import { cn } from 'lib/utils/css-classes'++import { inboxSetupLogic } from '../../logics/inboxSetupLogic'+import { scoutSuggestionsLogic } from '../../logics/scoutSuggestionsLogic'+import { InboxSetupGithubStep } from './InboxSetupGithubStep'+import { InboxSetupScoutsStep } from './InboxSetupScoutsStep'+import { InboxSetupSourcesStep } from './InboxSetupSourcesStep'++export function InboxSetupFlow(): JSX.Element {+ const { draft, ready, saving, error, activationDisabledReason, isFinalStep, sourceSetupSource } =+ useValues(inboxSetupLogic)+ const { startSetup, goToStep, activate, retry } = useActions(inboxSetupLogic)+ useMountedLogic(scoutSuggestionsLogic)+ useEffect(() => {+ startSetup()+ }, [startSetup])+ const isScoutsStep = draft.step === 'scouts'+ return (+ <div className={cn('@container w-full', isScoutsStep && 'h-full')}>+ <div+ className={cn(+ 'mx-auto flex w-full max-w-2xl flex-col gap-6 px-6 py-8',+ isScoutsStep && 'h-full min-h-0'+ )}+ >+ <div className="shrink-0">+ <h1 className="text-2xl font-semibold m-0">Set up Self-Driving</h1>+ <p className="mt-2 mb-0 max-w-2xl text-secondary">+ Choose your sources and scouts, then review and activate.+ </p>+ </div>+ <GuidedWizardStepper+ steps={[+ { step: 'signals', label: 'Sources' },+ { step: 'scouts', label: 'Background agents' },+ { step: 'github', label: 'Review and activate' },+ ]}+ currentStep={draft.step}+ onStepClick={saving || !ready || sourceSetupSource ? undefined : goToStep}+ className="shrink-0 flex-nowrap overflow-x-auto whitespace-nowrap py-1 [&>div]:shrink-0"+ aria-label="Self-Driving setup progress"+ />+ <GuidedWizardPanel className={cn('p-5 @lg:p-6 space-y-6', isScoutsStep && 'flex min-h-0 flex-col')}>+ {draft.step === 'signals' ? (+ <InboxSetupSourcesStep />+ ) : draft.step === 'scouts' ? (+ <InboxSetupScoutsStep />+ ) : (+ <InboxSetupGithubStep />+ )}+ {error && (+ <LemonBanner type="error">+ <span>{error}</span>+ <LemonButton size="small" onClick={retry} loading={saving}>+ Retry+ </LemonButton>+ </LemonBanner>+ )}+ {!sourceSetupSource && (+ <div className="flex shrink-0 flex-wrap justify-between items-center gap-3 border-t border-primary pt-4">+ {draft.step !== 'signals' && (+ <LemonButton+ type="secondary"+ icon={<IconArrowLeft />}+ disabled={saving}+ onClick={() => goToStep(draft.step === 'github' ? 'scouts' : 'signals')}+ >+ Back+ </LemonButton>+ )}+ <LemonButton+ type="primary"+ className="ml-auto"+ status="alt"+ loading={saving}+ disabledReason={+ !ready ? 'Loading your setup' : isFinalStep ? activationDisabledReason : undefined+ }+ sideIcon={isFinalStep ? undefined : <IconArrowRight />}+ onClick={() =>+ isFinalStep ? activate() : goToStep(draft.step === 'signals' ? 'scouts' : 'github')+ }+ data-attr="inbox-setup-continue"+ >+ {isFinalStep+ ? 'Activate Self-Driving'+ : draft.step === 'signals'+ ? 'Continue to scouts'+ : 'Continue'}+ </LemonButton>+ </div>+ )}+ </GuidedWizardPanel>+ </div>+ </div>+ )+}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxSetupGithubStep.tsx b/products/signals/frontend/inbox/components/onboarding/InboxSetupGithubStep.tsxnew file mode 100644index 000000000000..4e972f08b3c8--- /dev/null+++ b/products/signals/frontend/inbox/components/onboarding/InboxSetupGithubStep.tsx@@ -0,0 +1,47 @@+import { useActions, useValues } from 'kea'+import { combineUrl } from 'kea-router'++import { GuidedWizardSection } from 'lib/components/GuidedWizard/GuidedWizardSection'+import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'+import { TeamMembershipLevel } from 'lib/constants'+import { GithubIntegration } from 'scenes/integrations/components/GithubIntegration'+import { IntegrationAccessRequest } from 'scenes/integrations/components/IntegrationAccessRequest'+import { urls } from 'scenes/urls'++import { inboxSetupLogic } from '../../logics/inboxSetupLogic'+import { InboxSetupImplementation } from './InboxSetupImplementation'++export function InboxSetupGithubStep(): JSX.Element {+ const { hasGithubIntegration, saving } = useValues(inboxSetupLogic)+ const { connectGithub } = useActions(inboxSetupLogic)+ const restrictionReason = useRestrictedArea({+ scope: RestrictionScope.Project,+ minimumAccessLevel: TeamMembershipLevel.Member,+ })+ return (+ <>+ <GuidedWizardSection+ title={hasGithubIntegration ? 'GitHub is connected' : 'Connect GitHub for code context'}+ description="Self-Driving uses your code to explain what's happening in your product and suggest what to do next."+ >+ {!hasGithubIntegration && restrictionReason ? (+ <IntegrationAccessRequest kind="github" name="GitHub" />+ ) : (+ <GithubIntegration+ next={combineUrl(urls.inbox(), { onboarding_step: 'github' }).url}+ connectSurface="inbox_welcome"+ onAuthorize={connectGithub}+ authorizing={saving}+ connectText="Connect GitHub"+ emphasizeConnect+ showPersonalConnectionHelp={false}+ showManageButton={false}+ integrationSuffix={<></>}+ connectDescription="Choose which repositories PostHog can access when you connect GitHub."+ />+ )}+ </GuidedWizardSection>+ <InboxSetupImplementation />+ </>+ )+}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxSetupImplementation.tsx b/products/signals/frontend/inbox/components/onboarding/InboxSetupImplementation.tsxnew file mode 100644index 000000000000..ac25ec0b47f6--- /dev/null+++ b/products/signals/frontend/inbox/components/onboarding/InboxSetupImplementation.tsx@@ -0,0 +1,49 @@+import { useActions, useValues } from 'kea'++import { LemonSegmentedButton, LemonSwitch } from '@posthog/lemon-ui'++import { inboxSetupLogic } from '../../logics/inboxSetupLogic'+import { AUTONOMY_PRIORITY_OPTIONS } from '../../utils/autonomyPriorityOptions'+import { AutonomySettingGroup } from '../config/AutonomySettingGroup'+import { AutonomySettingRow } from '../config/AutonomySettingRow'++export function InboxSetupImplementation(): JSX.Element {+ const { draft, saving } = useValues(inboxSetupLogic)+ const { patchDraft } = useActions(inboxSetupLogic)+ return (+ <div className="border-t border-primary pt-4">+ <AutonomySettingGroup title="Automatic implementation">+ <AutonomySettingRow+ title="Automatically fix what agents find"+ description="Agents find and investigate problems by default. Turn this on to also get fixes as pull requests. You review and merge."+ control={+ <LemonSwitch+ checked={draft.automatic_implementation}+ onChange={(automatic_implementation) => patchDraft({ automatic_implementation })}+ disabled={saving}+ aria-label="Automatically fix what agents find"+ data-attr="inbox-setup-automatic-implementation"+ />+ }+ >+ {draft.automatic_implementation && (+ <AutonomySettingRow+ title="Priority threshold"+ description="Agents open PRs for reports at this priority or higher."+ control={+ <LemonSegmentedButton+ size="small"+ fullWidth+ value={draft.implementation_priority}+ options={AUTONOMY_PRIORITY_OPTIONS}+ onChange={(implementation_priority) => patchDraft({ implementation_priority })}+ disabledReason={saving ? 'Saving setup' : undefined}+ />+ }+ />+ )}+ </AutonomySettingRow>+ </AutonomySettingGroup>+ </div>+ )+}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxSetupScoutsStep.tsx b/products/signals/frontend/inbox/components/onboarding/InboxSetupScoutsStep.tsxnew file mode 100644index 000000000000..b98853e673d5--- /dev/null+++ b/products/signals/frontend/inbox/components/onboarding/InboxSetupScoutsStep.tsx@@ -0,0 +1,100 @@+import { useActions, useValues } from 'kea'++import { IconCheck, IconPlus } from '@posthog/icons'+import { LemonBanner, LemonButton, LemonSkeleton, Link } from '@posthog/lemon-ui'++import { GuidedWizardSection } from 'lib/components/GuidedWizard/GuidedWizardSection'+import { urls } from 'scenes/urls'++import { inboxSetupLogic } from '../../logics/inboxSetupLogic'+import { scoutSuggestionsLogic } from '../../logics/scoutSuggestionsLogic'+import { suggestionCadenceLabel } from '../../utils/scoutSuggestions'+import { AutonomySettingGroup } from '../config/AutonomySettingGroup'+import { useScoutCreateDisabledReason } from '../config/scouts/ScoutCreateModalHost'++export function InboxSetupScoutsStep(): JSX.Element {+ const { draft, saving, scoutChoices, scoutsLoading } = useValues(inboxSetupLogic)+ const { toggleSuggestion } = useActions(inboxSetupLogic)+ const { batchStatus } = useValues(scoutSuggestionsLogic)+ const creationDisabledReason = useScoutCreateDisabledReason()+ const selectedIds = new Set(draft.suggestions.map((item) => item.id))+ const items = scoutChoices+ return (+ <GuidedWizardSection+ title="Add scouts to look for problems"+ className="flex min-h-0 flex-col"+ headerClassName="shrink-0"+ contentClassName="flex min-h-0 flex-col"+ description={+ <>+ Scouts are background agents that can monitor why customers drop off from a funnel or investigate+ recurring errors. Each scout remembers what it learns across runs, shares memory with other scouts,+ and uses{' '}+ <Link to={urls.settings('mcp-servers')} target="_blank">+ MCPs+ </Link>+ .+ </>+ }+ >+ {!items.length && scoutsLoading ? (+ <>+ <LemonSkeleton className="h-24" />+ <p className="text-secondary">Preparing suggestions.</p>+ </>+ ) : null}+ {!items.length && !scoutsLoading ? (+ <LemonBanner type="info">+ {batchStatus === 'failed'+ ? "We couldn't prepare suggestions. You can add scouts later."+ : 'No scout suggestions yet. You can create one later.'}+ </LemonBanner>+ ) : null}+ <ul+ className="m-0 min-h-0 max-h-80 list-none overflow-y-auto overscroll-contain divide-y border-primary p-0 pr-2 [scrollbar-gutter:stable]"+ aria-label="Scout suggestions"+ tabIndex={0}+ >+ {items.map((item) => (+ <li key={item.id} className="flex flex-wrap items-start gap-3 py-4">+ <div className="flex-1 min-w-48">+ <h3 className="m-0 text-sm font-semibold">{item.title}</h3>+ <p className="mt-1 mb-1 text-xs text-secondary">{item.why_here}</p>+ <span className="text-xs text-tertiary">+ {`Runs ${suggestionCadenceLabel(item.proposed_config)}`}+ </span>+ </div>+ <LemonButton+ type="secondary"+ size="small"+ icon={selectedIds.has(item.id) ? <IconCheck /> : <IconPlus />}+ disabledReason={+ saving+ ? 'Saving setup'+ : !selectedIds.has(item.id)+ ? (creationDisabledReason ??+ (draft.suggestions.length >= 5 ? 'Select up to five scouts' : undefined))+ : undefined+ }+ onClick={() => toggleSuggestion(item)}+ data-attr="inbox-setup-select-scout"+ >+ {selectedIds.has(item.id) ? 'Selected' : 'Add scout'}+ </LemonButton>+ </li>+ ))}+ </ul>+ <div className="shrink-0 border-t border-primary pt-4">+ <AutonomySettingGroup title="Create a scout for your product">+ <p className="m-0 py-3 text-xs leading-snug text-secondary">+ Describe what to watch to PostHog AI, the PostHog Slack Bot, or an agent connected through{' '}+ <Link to="https://posthog.com/docs/model-context-protocol" target="_blank">+ MCP+ </Link>+ .+ </p>+ </AutonomySettingGroup>+ </div>+ </GuidedWizardSection>+ )+}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxSetupSourcesStep.tsx b/products/signals/frontend/inbox/components/onboarding/InboxSetupSourcesStep.tsxnew file mode 100644index 000000000000..6850061e0564--- /dev/null+++ b/products/signals/frontend/inbox/components/onboarding/InboxSetupSourcesStep.tsx@@ -0,0 +1,134 @@+import { useActions, useValues } from 'kea'++import { LemonButton, LemonSkeleton, LemonSwitch } from '@posthog/lemon-ui'++import { GuidedWizardSection } from 'lib/components/GuidedWizard/GuidedWizardSection'++import { inboxSetupLogic } from '../../logics/inboxSetupLogic'+import { signalSourcesLogic } from '../../signalSourcesLogic'+import { getSourceProductMeta } from '../badges/sourceProductIcons'+import { AutonomySettingGroup } from '../config/AutonomySettingGroup'+import { AutonomySettingRow } from '../config/AutonomySettingRow'+import { DataSourceSetup } from '../config/DataSourceSetup'++export function InboxSetupSourcesStep(): JSX.Element {+ const { sources, draft, ready, saving, sourceSetupSource } = useValues(inboxSetupLogic)+ const { toggleSource, setSourceSetupSource, finishSourceSetup } = useActions(inboxSetupLogic)+ const { productStatusBySource, enablingProduct } = useValues(signalSourcesLogic)+ const { enableSourceProduct } = useActions(signalSourcesLogic)+ const productsNeedingSetup = sources.filter((source) => !source.available && !source.warehouseSource)+ if (sourceSetupSource) {+ return (+ <DataSourceSetup+ source={sourceSetupSource}+ onComplete={finishSourceSetup}+ onCancel={() => setSourceSetupSource(null)}+ completing={saving}+ />+ )+ }+ return (+ <GuidedWizardSection+ title="Choose what to watch"+ description="Signals from these sources tell Self-Driving when something needs a closer look."+ descriptionClassName="text-sm"+ >+ {!ready ? (+ <LemonSkeleton className="h-40" />+ ) : (+ <>+ <div className="divide-y border-primary">+ {sources+ .filter((source) => source.available)+ .map((source) => {+ const Icon = getSourceProductMeta(source.definition.sourceProduct)?.Icon+ const checked =+ source.definition.source === 'replay_vision'+ ? draft.scanner_ids.length > 0+ : draft.sources.some(+ (item) =>+ item.source_product === source.definition.sourceProduct &&+ item.enabled+ )+ return (+ <div key={source.definition.source} className="flex items-center gap-3 py-4">+ {Icon && <Icon className="text-xl shrink-0" />}+ <div className="flex-1 min-w-0">+ <h3 className="m-0 text-sm font-semibold">{source.definition.label}</h3>+ <p className="m-0 text-xs text-secondary">{source.definition.watches}</p>+ </div>+ <LemonSwitch+ checked={checked}+ onChange={(enabled) => toggleSource(source, enabled)}+ disabled={saving}+ aria-label={`Enable ${source.definition.label}`}+ data-attr={`inbox-setup-source-${source.definition.source}`}+ />+ </div>+ )+ })}+ </div>+ {!sources.some((source) => source.available) && (+ <p>+ No products are sending usable signals yet. Enable a product below or choose a scout in the+ next step. You need at least one source or scout to activate Self-Driving.+ </p>+ )}+ {productsNeedingSetup.length > 0 && (+ <section className="border-t border-primary pt-4">+ <AutonomySettingGroup title="Products that need setup">+ {productsNeedingSetup.map((source) => {+ const product = productStatusBySource[source.definition.source]+ return (+ <AutonomySettingRow+ key={source.definition.source}+ title={source.definition.label}+ description={+ source.unavailableReason === 'Not enabled'+ ? source.definition.watches+ : source.unavailableReason+ }+ control={+ product?.enabled === false && product.enablement ? (+ <LemonButton+ type="secondary"+ size="small"+ loading={enablingProduct === product.enablement}+ disabledReason={+ saving ||+ (enablingProduct !== null &&+ enablingProduct !== product.enablement)+ ? 'Finishing setup changes'+ : undefined+ }+ onClick={() => enableSourceProduct(product.enablement!)}+ >+ {`Turn on ${product.productName}`}+ </LemonButton>+ ) : source.definition.manageUrl || source.definition.docsUrl ? (+ <LemonButton+ type="secondary"+ size="small"+ targetBlank+ to={source.definition.manageUrl ?? source.definition.docsUrl}+ >+ {source.definition.source === 'replay_vision'+ ? 'Create scanner'+ : 'Set up'}+ </LemonButton>+ ) : null+ }+ />+ )+ })}+ </AutonomySettingGroup>+ <p className="text-xs text-secondary mt-4 mb-0">+ You can add more sources after activation.+ </p>+ </section>+ )}+ </>+ )}+ </GuidedWizardSection>+ )+}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxWelcome.tsx b/products/signals/frontend/inbox/components/onboarding/InboxWelcome.tsxindex fe2f41e8794b..4a6ee1c8c4aa 100644--- a/products/signals/frontend/inbox/components/onboarding/InboxWelcome.tsx+++ b/products/signals/frontend/inbox/components/onboarding/InboxWelcome.tsx@@ -7,7 +7,6 @@ import { useEffect, useRef, useState } from 'react'import { IconCheck } from '@posthog/icons'import { LemonButton, LemonSkeleton, LemonTag } from '@posthog/lemon-ui'-import { Logomark } from 'lib/brand'import { FEATURE_FLAGS } from 'lib/constants'import { integrationsLogic } from 'lib/integrations/integrationsLogic'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'@@ -17,7 +16,7 @@ import { urls } from 'scenes/urls'import { captureInboxWelcomeCommandCopied, captureInboxWelcomeViewed } from '../../inboxAnalytics'import { inboxOnboardingLogic } from '../../logics/inboxOnboardingLogic'-import { InboxMcpBanner } from '../InboxMcpBanner'+import { InboxWelcomeLayout } from './InboxWelcomeLayout'import { LoopDiagram } from './LoopDiagram'/** The one command that sets up self-driving. The whole onboarding orbits this string. */@@ -112,7 +111,6 @@ function GithubFirstCta(): JSX.Element {)}-/** The escape hatch: skip the setup agent and turn sources and scouts on by hand. */function ManualSetupAction(): JSX.Element {const { requestManualSetup } = useActions(inboxOnboardingLogic)@@ -128,8 +126,7 @@ function ManualSetupAction(): JSX.Element {Set up manually</LemonButton><p className="m-0 max-w-prose text-[13px] text-tertiary">- Turn on sources and scouts yourself in Configuration. You still need to connect GitHub for pull- requests.+ Choose your signals and scouts, then review and activate Self-Driving.</p></div>)@@ -150,44 +147,24 @@ export function InboxWelcome(): JSX.Element {}, [])return (- <div className="InboxWelcome flex min-h-full flex-col justify-center py-10">- <div className="mx-auto mb-8 w-full max-w-4xl px-6">- <InboxMcpBanner />- </div>- <div className="px-6 pb-12">- <div className="mx-auto flex max-w-[720px] flex-col items-center text-center">- <div className="mb-7">- <Logomark jumpOnClick size="xl" />- </div>- <h1 className="mb-4 text-2xl font-bold leading-[1.1] tracking-[-0.02em] sm:text-[32px]">- Ship fixes while you sleep- </h1>- <p className="mb-9 max-w-[560px] text-[15px] leading-[1.55] text-secondary">- PostHog watches your session replays, errors, and Slack. When it finds something worth fixing,- it writes the pull request. You review and merge.+ <InboxWelcomeLayout+ title="Ship fixes while you sleep"+ description="PostHog watches your session replays, errors, and Slack. When it finds something worth fixing, it writes the pull request. You review and merge."+ illustration={<LoopDiagram />}+ footer="Your first 3 PRs each month are free, then $15 per PR. Reports are always free."+ >+ {githubFirst ? (+ <GithubFirstCta />+ ) : (+ <>+ <CommandCta />+ <p className="mt-3.5 max-w-[520px] text-[13px] text-tertiary">+ Run it in your repo. That's the whole setup: it connects GitHub and picks the signal sources and+ scouts to watch. PRs start landing in this inbox.</p>- {githubFirst ? (- <GithubFirstCta />- ) : (- <>- <CommandCta />- <p className="mt-3.5 max-w-[520px] text-[13px] text-tertiary">- Run it in your repo. That's the whole setup: it connects GitHub and picks the signal- sources and scouts to watch. PRs start landing in this inbox.- </p>- </>- )}- <ManualSetupAction />- </div>- </div>- <div className="px-6 md:px-12">- <div className="mx-auto max-w-[1060px]">- <LoopDiagram />- <p className="mt-6 text-center text-xs text-tertiary">- Your first 3 PRs each month are free, then $15 per PR. Reports are always free.- </p>- </div>- </div>- </div>+ </>+ )}+ <ManualSetupAction />+ </InboxWelcomeLayout>)}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxWelcomeLayout.tsx b/products/signals/frontend/inbox/components/onboarding/InboxWelcomeLayout.tsxnew file mode 100644index 000000000000..efe8fe656b1e--- /dev/null+++ b/products/signals/frontend/inbox/components/onboarding/InboxWelcomeLayout.tsx@@ -0,0 +1,47 @@+import { ReactNode } from 'react'++import { Logomark } from 'lib/brand'++import { InboxMcpBanner } from '../InboxMcpBanner'++interface InboxWelcomeLayoutProps {+ title: string+ description: string+ illustration: ReactNode+ footer: string+ children: ReactNode+}++export function InboxWelcomeLayout({+ title,+ description,+ illustration,+ footer,+ children,+}: InboxWelcomeLayoutProps): JSX.Element {+ return (+ <div className="InboxWelcome @container/welcome flex min-h-full flex-col justify-center py-10">+ <div className="mx-auto mb-8 w-full max-w-4xl px-6">+ <InboxMcpBanner />+ </div>+ <div className="px-6 pb-12">+ <div className="mx-auto flex max-w-[720px] flex-col items-center text-center">+ <div className="mb-7">+ <Logomark jumpOnClick size="xl" />+ </div>+ <h1 className="mb-4 text-2xl font-bold leading-[1.1] tracking-[-0.02em] @2xl/welcome:text-[32px]">+ {title}+ </h1>+ <p className="mb-9 max-w-[560px] text-[15px] leading-[1.55] text-secondary">{description}</p>+ {children}+ </div>+ </div>+ <div className="px-6 @3xl/welcome:px-12">+ <div className="mx-auto max-w-[1060px]">+ {illustration}+ <p className="mt-6 text-center text-xs text-tertiary">{footer}</p>+ </div>+ </div>+ </div>+ )+}diff --git a/products/signals/frontend/inbox/components/onboarding/LoopDiagram.tsx b/products/signals/frontend/inbox/components/onboarding/LoopDiagram.tsxindex 527b1fcd9e10..267d96b4748b 100644--- a/products/signals/frontend/inbox/components/onboarding/LoopDiagram.tsx+++ b/products/signals/frontend/inbox/components/onboarding/LoopDiagram.tsx@@ -36,7 +36,7 @@ function Arrow({ second = false }: { second?: boolean }): JSX.Element {<divclassName={`InboxWelcome__arrow ${second ? 'InboxWelcome__arrow--second ' : ''- }hidden pt-5 text-center text-2xl text-border-secondary md:block`}+ }hidden pt-5 text-center text-2xl text-border-secondary @2xl/loop:block`}aria-hidden="true">→@@ -51,62 +51,64 @@ function Arrow({ second = false }: { second?: boolean }): JSX.Element {export function LoopDiagram(): JSX.Element {return (// text-left so the mock UI stays left-aligned even inside a text-center hero (the intro modal)- <div className="pointer-events-none select-none grid grid-cols-1 items-center gap-x-1.5 gap-y-4 text-left md:grid-cols-[1fr_34px_1fr_34px_1.2fr]">- <div className="flex flex-col gap-2">- <StageLabel>Signal sources</StageLabel>- <StageCard stage="signals" className="flex items-center gap-2 px-3 py-2.5">- <span className="flex size-5 shrink-0 items-center justify-center">- <IconRewindPlay className="text-sm text-[var(--color-product-session-replay-light)] dark:text-[var(--color-product-session-replay-dark)]" />- </span>- <span className="truncate text-xs">Rage clicks in checkout replay</span>- </StageCard>- <StageCard stage="signals" className="flex items-center gap-2 px-3 py-2.5">- <span className="flex size-5 shrink-0 items-center justify-center">- <IconWarning className="text-sm text-[var(--color-product-error-tracking-light)] dark:text-[var(--color-product-error-tracking-dark)]" />- </span>- <span className="truncate font-mono text-xs">TypeError in checkout</span>- </StageCard>- <StageCard stage="signals" className="flex items-center gap-2 px-3 py-2.5">- <span className="flex size-5 shrink-0 items-center justify-center">- <IconSlack className="size-4" />- </span>- <span className="truncate text-xs">"checkout hangs on Safari"</span>- </StageCard>- </div>- <Arrow />- <div className="flex flex-col gap-2">- <StageLabel>Scouts & pipeline</StageLabel>- <StageCard stage="pipeline" className="flex flex-col gap-1.5 px-3.5 py-3">- {/* items-start + margin keeps the dot on the first line when the text wraps+ <div className="@container/loop w-full">+ <div className="pointer-events-none select-none grid grid-cols-1 items-center gap-x-1.5 gap-y-4 text-left @2xl/loop:grid-cols-[1fr_34px_1fr_34px_1.2fr]">+ <div className="flex flex-col gap-2">+ <StageLabel>Signal sources</StageLabel>+ <StageCard stage="signals" className="flex items-center gap-2 px-3 py-2.5">+ <span className="flex size-5 shrink-0 items-center justify-center">+ <IconRewindPlay className="text-sm text-[var(--color-product-session-replay-light)] dark:text-[var(--color-product-session-replay-dark)]" />+ </span>+ <span className="truncate text-xs">Rage clicks in checkout replay</span>+ </StageCard>+ <StageCard stage="signals" className="flex items-center gap-2 px-3 py-2.5">+ <span className="flex size-5 shrink-0 items-center justify-center">+ <IconWarning className="text-sm text-[var(--color-product-error-tracking-light)] dark:text-[var(--color-product-error-tracking-dark)]" />+ </span>+ <span className="truncate font-mono text-xs">TypeError in checkout</span>+ </StageCard>+ <StageCard stage="signals" className="flex items-center gap-2 px-3 py-2.5">+ <span className="flex size-5 shrink-0 items-center justify-center">+ <IconSlack className="size-4" />+ </span>+ <span className="truncate text-xs">"checkout hangs on Safari"</span>+ </StageCard>+ </div>+ <Arrow />+ <div className="flex flex-col gap-2">+ <StageLabel>Scouts & pipeline</StageLabel>+ <StageCard stage="pipeline" className="flex flex-col gap-1.5 px-3.5 py-3">+ {/* items-start + margin keeps the dot on the first line when the text wrapsin narrower hosts (the intro modal) instead of floating between lines */}- <div className="flex items-start gap-2 text-[13px] font-semibold">- <span className="mt-1.5 size-[7px] shrink-0 rounded-full bg-success" />- <span className="min-w-0">Reproduced the bug, wrote the fix</span>- </div>- <div className="flex items-center gap-2">- <span className="font-mono text-xs font-semibold text-success">+142</span>- <span className="font-mono text-xs font-semibold text-danger">−38</span>- <LemonTag type="success">Tests passing</LemonTag>- </div>- </StageCard>- </div>- <Arrow second />- <div className="flex flex-col gap-2">- <StageLabel>Your inbox</StageLabel>- <StageCard stage="inbox" className="flex items-center gap-2.5 px-3.5 py-3">- <span className="flex size-[26px] shrink-0 items-center justify-center rounded-md bg-fill-warning-highlight font-mono text-[11px] font-bold text-warning">- P1- </span>- <div className="flex min-w-0 flex-1 flex-col gap-0.5">- <div className="text-[13px] font-semibold">- <code>fix(checkout)</code> restore Safari encode+ <div className="flex items-start gap-2 text-[13px] font-semibold">+ <span className="mt-1.5 size-[7px] shrink-0 rounded-full bg-success" />+ <span className="min-w-0">Reproduced the bug, wrote the fix</span>+ </div>+ <div className="flex items-center gap-2">+ <span className="font-mono text-xs font-semibold text-success">+142</span>+ <span className="font-mono text-xs font-semibold text-danger">−38</span>+ <LemonTag type="success">Tests passing</LemonTag>+ </div>+ </StageCard>+ </div>+ <Arrow second />+ <div className="flex flex-col gap-2">+ <StageLabel>Your inbox</StageLabel>+ <StageCard stage="inbox" className="flex items-center gap-2.5 px-3.5 py-3">+ <span className="flex size-[26px] shrink-0 items-center justify-center rounded-md bg-fill-warning-highlight font-mono text-[11px] font-bold text-warning">+ P1+ </span>+ <div className="flex min-w-0 flex-1 flex-col gap-0.5">+ <div className="text-[13px] font-semibold">+ <code>fix(checkout)</code> restore Safari encode+ </div>+ <div className="text-[11.5px] text-tertiary">#486 · ready to merge</div></div>- <div className="text-[11.5px] text-tertiary">#486 · ready to merge</div>- </div>- <LemonButton type="primary" size="small" className="shrink-0">- Review- </LemonButton>- </StageCard>+ <LemonButton type="primary" size="small" className="shrink-0">+ Review+ </LemonButton>+ </StageCard>+ </div></div></div>)diff --git a/products/signals/frontend/inbox/components/shell/InboxListViewLegacy.tsx b/products/signals/frontend/inbox/components/shell/InboxListViewLegacy.tsxindex 9522919ede2a..12387541e5a6 100644--- a/products/signals/frontend/inbox/components/shell/InboxListViewLegacy.tsx+++ b/products/signals/frontend/inbox/components/shell/InboxListViewLegacy.tsx@@ -9,7 +9,7 @@ import { inboxOnboardingLogic } from '../../logics/inboxOnboardingLogic'import { InboxTabKey, SignalRun } from '../../types'import { CardSkeleton } from '../cards/CardSkeleton'import { ScoutsRosterLegacy } from '../config/scouts/ScoutsRosterLegacy'-import { InboxWelcome } from '../onboarding/InboxWelcome'+import { InboxOnboardingEntry } from '../onboarding/InboxOnboardingEntry'import { ArchivedTab } from '../tabs/ArchivedTab'import { NotActionableTab } from '../tabs/NotActionableTab'import { PullRequestsTab } from '../tabs/PullRequestsTab'@@ -129,7 +129,7 @@ export function InboxListViewLegacy(): JSX.Element {<CardSkeleton count={4} variant="cards" /></div>) : onboarding ? (- <InboxWelcome />+ <InboxOnboardingEntry />) : (<ActiveTabBodytab={effectiveTab}diff --git a/products/signals/frontend/inbox/inboxAnalytics.ts b/products/signals/frontend/inbox/inboxAnalytics.tsindex 641defae7660..95f6df320e59 100644--- a/products/signals/frontend/inbox/inboxAnalytics.ts+++ b/products/signals/frontend/inbox/inboxAnalytics.ts@@ -1232,7 +1232,7 @@ export type ScoutSuggestionCreatedVia = 'api' | 'chat'export type ScoutSuggestionsRefreshOutcome = 'accepted' | 'running' | 'capped' | 'failed' | 'resumed'/** What put the scan on screen. Without it, a client resuming a paid scan reads as a refused duplicate. */-export type ScoutSuggestionsRefreshSource = 'strip' | 'reload'+export type ScoutSuggestionsRefreshSource = 'strip' | 'reload' | 'onboarding'/*** The suggestion batch as it was first rendered this visit. Without it a batch nobody acts on isdiff --git a/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts b/products/signals/frontend/inbox/logics/inboxOnboardingLogic.tsindex 00a3c7a9775e..f01d60c331cc 100644--- a/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts+++ b/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts@@ -5,13 +5,13 @@ import { subscriptions } from 'kea-subscriptions'import { wizardActiveSessionDetectorLogic } from 'scenes/onboarding/shared/wizard-sync/wizardActiveSessionDetectorLogic'import { SELF_DRIVING_WORKFLOW_ID } from 'scenes/onboarding/shared/wizard-sync/workflows'import { teamLogic } from 'scenes/teamLogic'-import { urls } from 'scenes/urls'import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signals/frontend/generated/api.schemas'import { captureInboxOnboardingDecided, captureInboxWelcomeManualSetupClicked } from '../inboxAnalytics'import { signalSourcesLogic } from '../signalSourcesLogic'-import { INBOX_CONFIG_TAB_KEY, type SignalSourceConfig } from '../types'+import { type SignalSourceConfig } from '../types'+import { inboxSetupLogic } from './inboxSetupLogic'import { INBOX_REPORT_SECTION_LIST_PARAMS, reportListLogic } from './reportListLogic'import { scoutFleetLogic } from './scoutFleetLogic'@@ -268,6 +268,10 @@ export function computeIsSelfDrivingSetUp(// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface inboxOnboardingLogicValues {+ isUiSetup: boolean // inboxSetupLogic+ setupCompleted: boolean // inboxSetupLogic+ setupInProgress: boolean // inboxSetupLogic+ setupStateLoading: boolean // inboxSetupLogicpullsCount: number | null // reportListLogicpullsCountLoading: boolean // reportListLogicreportsCount: number | null // reportListLogic@@ -387,7 +391,11 @@ export interface inboxOnboardingLogicMeta {lastSettledUiState: InboxSettledUiState | null,searchParams: Record<string, any>,isSelfDrivingSetUp: boolean,- isWizardRunning: boolean+ isWizardRunning: boolean,+ setupInProgress: boolean,+ setupCompleted: boolean,+ isUiSetup: boolean,+ setupStateLoading: boolean) => InboxOnboardingMode}}@@ -419,6 +427,13 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([connect(() => ({values: [+ inboxSetupLogic,+ [+ 'inProgress as setupInProgress',+ 'completed as setupCompleted',+ 'usesFocusedSetup as isUiSetup',+ 'savedStateLoading as setupStateLoading',+ ],signalSourcesLogic,['sourceConfigs', 'sourceConfigsLoading', 'enabledSourcesCount', 'hasEmittingScanner'],scoutFleetLogic,@@ -477,15 +492,9 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([actions.loadPullsCount()actions.loadReportsCount()},- // Record the choice, then open the surface that holds the controls. On narrow viewports- // that is the Configuration tab; on wide ones the scene remaps `config` to `pulls` and- // shows the same widgets in the setup rail, so this one push is right at either width.requestManualSetup: () => {captureInboxWelcomeManualSetupClicked()- if (values.currentTeamId != null) {- actions.setManualSetupRequested(values.currentTeamId)- }- router.actions.push(urls.inbox(INBOX_CONFIG_TAB_KEY))+ inboxSetupLogic.actions.openSetup()},// Listeners run after the reducer, so this writes the map the choice is already in.setManualSetupRequested: () => {@@ -643,18 +652,38 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([s.searchParams,s.isSelfDrivingSetUp,s.isWizardRunning,+ s.setupInProgress,+ s.setupCompleted,+ s.isUiSetup,+ s.setupStateLoading,],(resolvedOnboardingMode: InboxOnboardingMode,lastSettledUiState: InboxSettledUiState | null,searchParams: Record<string, unknown>,isSelfDrivingSetUp: boolean,- isWizardRunning: boolean+ isWizardRunning: boolean,+ setupInProgress: boolean,+ setupCompleted: boolean,+ isUiSetup: boolean,+ setupStateLoading: boolean): InboxOnboardingMode => {+ if (isUiSetup) {+ if (setupCompleted) {+ return 'none'+ }+ if (setupInProgress) {+ return 'takeover'+ }+ if (setupStateLoading) {+ return 'pending'+ }+ }if (searchParams.setup === 'github-first' && !isSelfDrivingSetUp && !isWizardRunning) {return 'takeover'}- return resolveDisplayMode(resolvedOnboardingMode, lastSettledUiState)+ const mode = resolveDisplayMode(resolvedOnboardingMode, lastSettledUiState)+ return mode === 'takeover' && setupStateLoading ? 'pending' : mode},],}),diff --git a/products/signals/frontend/inbox/logics/inboxSetupLogic.test.ts b/products/signals/frontend/inbox/logics/inboxSetupLogic.test.tsnew file mode 100644index 000000000000..2a9219c67d9a--- /dev/null+++ b/products/signals/frontend/inbox/logics/inboxSetupLogic.test.ts@@ -0,0 +1,611 @@+import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'++import { waitFor } from '@testing-library/react'+import { router } from 'kea-router'+import { expectLogic } from 'kea-test-utils'+import posthog from 'posthog-js'++import { FEATURE_FLAGS } from 'lib/constants'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'++import { useMocks } from '~/mocks/jest'+import { initKeaTests } from '~/test/init'++import * as signalsApi from '../../generated/api'+import type {+ InboxOnboardingStateApi,+ InboxOnboardingDraftApi,+ SignalSourceConfigApi,+ SignalScoutConfigApi,+} from '../../generated/api.schemas'+import { mockScoutConfigs, mockScoutSuggestionSet } from '../__mocks__/scoutConfigs'+import { signalSourcesLogic } from '../signalSourcesLogic'+import { inboxOnboardingLogic } from './inboxOnboardingLogic'+import { inboxSetupLogic } from './inboxSetupLogic'+import { scoutFleetLogic } from './scoutFleetLogic'++const draft: InboxOnboardingDraftApi = {+ step: 'github',+ sources: [{ source_product: 'error_tracking', source_type: 'issue_created', enabled: true }],+ scanner_ids: [],+ suggestions: [],++ automatic_implementation: false,+ implementation_priority: 'P1',+}++describe('focused Inbox setup', () => {+ let logic: ReturnType<typeof inboxSetupLogic.build>+ let savedDraft: InboxOnboardingDraftApi | null+ let variant: 'control' | 'test' | null+ let sources: SignalSourceConfigApi[]+ let failCompletion: boolean+ let createdSources: number+ let warehouseConnected: boolean+ let syncedSchemas: number+ let canonicalScouts: SignalScoutConfigApi[]+ let enabledScouts: string[]+ let hasErrorTrackingData: boolean+ let hasEvents: boolean+ let completedAt: string | null+ let scanners: { id: string; enabled: boolean; emits_signals: boolean }[]++ beforeEach(() => {+ initKeaTests()+ savedDraft = { ...draft }+ variant = 'test'+ sources = []+ createdSources = 0+ warehouseConnected = false+ syncedSchemas = 0+ canonicalScouts = []+ enabledScouts = []+ hasErrorTrackingData = false+ hasEvents = false+ failCompletion = true+ completedAt = null+ scanners = []+ useMocks({+ get: {+ '/api/projects/@current': () => [200, { ...MOCK_DEFAULT_TEAM, ingested_event: hasEvents }],+ '/api/projects/:id/signals/reports/available_reviewers/': {},+ '/api/environments/:id/external_data_sources/': () => ({+ results: warehouseConnected+ ? [+ {+ id: 'linear-source',+ source_type: 'Linear',+ schemas: [{ id: 'issues', name: 'issues', should_sync: false }],+ },+ ]+ : [],+ next: null,+ }),+ '/api/projects/:id/signals/onboarding/': () => ({+ draft: savedDraft,+ completed_at: completedAt,+ variant,+ }),+ '/api/projects/:id/signals/source_configs/': () => ({+ results: sources,+ next: null,+ count: sources.length,+ }),+ '/api/projects/:id/event_definitions/': () => ({+ results: hasErrorTrackingData ? [{ name: '$exception', last_seen_at: '2026-10-15T00:00:00Z' }] : [],+ next: null,+ count: hasErrorTrackingData ? 1 : 0,+ }),+ '/api/projects/:id/error_tracking/issues/exists/': () => ({ exists: hasErrorTrackingData }),+ '/api/projects/:id/vision/scanners/': () => ({+ results: scanners.filter((scanner) => scanner.enabled),+ next: null,+ count: scanners.length,+ }),+ '/api/projects/:id/signals/scout/configs/': () => canonicalScouts,+ '/api/projects/:id/signals/scout/suggestions/': mockScoutSuggestionSet({+ status: 'low_activity',+ items: [],+ }),+ '/api/projects/:id/integrations/': {+ results: [+ {+ id: 1,+ kind: 'github',+ config: {},+ display_name: 'example',+ created_at: '2026-10-14',+ icon_url: '',+ },+ ],+ next: null,+ count: 1,+ },+ },+ post: {+ '/api/projects/:id/signals/scout/configs/sync/': ({ request }) => {+ expect(new URL(request.url).searchParams.get('surface')).toBe('onboarding')+ return [200, canonicalScouts]+ },+ '/api/projects/:id/signals/scout/configs/': async ({ request }) => {+ const config = (await request.json()) as { skill_name: string; enabled: boolean }+ expect(config.enabled).toBe(true)+ enabledScouts.push(config.skill_name)+ const current = canonicalScouts.find((item) => item.skill_name === config.skill_name)!+ Object.assign(current, config)+ return [200, current]+ },+ '/api/projects/:id/signals/onboarding/': async ({ request }) => {+ savedDraft = (await request.json()) as InboxOnboardingDraftApi+ return [200, { draft: savedDraft, completed_at: completedAt, variant }]+ },+ '/api/projects/:id/signals/config/': {},+ '/api/projects/:id/signals/source_configs/': async ({ request }) => {+ createdSources+++ const source = {+ ...((await request.json()) as SignalSourceConfigApi),+ id: '11111111-1111-4111-8111-111111111111',+ }+ sources.push(source)+ return [201, source]+ },+ '/api/projects/:id/signals/onboarding/complete/': () =>+ failCompletion+ ? [500, { detail: 'Activation interrupted' }]+ : [200, { draft: savedDraft, completed_at: '2026-10-14T12:00:00Z', variant }],+ },+ patch: {+ '/api/projects/:id/vision/scanners/:scanner/': async ({ request, params }) => {+ const scanner = scanners.find((item) => item.id === params.scanner)!+ Object.assign(scanner, await request.json())+ return [200, scanner]+ },+ '/api/projects/:id/signals/scout/configs/:config/': async ({ request, params }) => {+ const config = canonicalScouts.find((item) => item.id === params.config)!+ Object.assign(config, await request.json())+ return [200, config]+ },+ '/api/projects/:id/external_data_schemas/:schema/': async ({ request }) => {+ expect(await request.json()).toEqual({ should_sync: true })+ syncedSchemas+++ return [200, {}]+ },+ '/api/projects/:id/signals/source_configs/:source/': () => [200, sources[0]],+ },+ })+ featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.INBOX_UI_ONBOARDING]: 'test' })+ logic = inboxSetupLogic()+ logic.mount()+ })++ afterEach(() => {+ logic.unmount()+ jest.restoreAllMocks()+ jest.useRealTimers()+ })++ it.each(['control', null, 'test'] as const)(+ 'opens setup and preserves the %s assignment through resume and activation',+ async (assignment) => {+ variant = assignment+ savedDraft = null+ featureFlagLogic.actions.setFeatureFlags(+ [],+ assignment ? { [FEATURE_FLAGS.INBOX_UI_ONBOARDING]: assignment } : {}+ )+ await expectLogic(logic, () => logic.actions.loadSetup()).toFinishAllListeners()+ expect(logic.values.usesFocusedSetup).toBe(assignment === 'test')+ expect(logic.values.inProgress).toBe(false)+ const capture = jest.spyOn(posthog, 'capture')+ const onboarding = inboxOnboardingLogic()+ onboarding.mount()+ try {+ if (assignment === 'test') {+ await expectLogic(logic, () => logic.actions.continueFromWelcome()).toFinishAllListeners()+ await expectLogic(logic, () => logic.actions.continueFromWelcome()).toFinishAllListeners()+ } else {+ await expectLogic(logic, () => onboarding.actions.requestManualSetup()).toFinishAllListeners()+ }+ expect(logic.values.usesFocusedSetup).toBe(true)+ expect(logic.values.inProgress).toBe(true)+ expect(onboarding.values.onboardingMode).toBe('takeover')+ expect(router.values.searchParams.onboarding_step).toBe('signals')+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ await expectLogic(logic, () => logic.actions.goToStep('github')).toFinishAllListeners()+ await expectLogic(logic, () =>+ logic.actions.patchDraft({ sources: draft.sources })+ ).toFinishAllListeners()+ expect(+ capture.mock.calls.filter(([event]) => event === 'self-driving onboarding started')+ ).toHaveLength(1)+ expect(capture).toHaveBeenCalledWith(+ 'self-driving onboarding started',+ expect.objectContaining({ variant: assignment })+ )+ expect(+ capture.mock.calls.filter(([event]) => event === 'self-driving onboarding welcome continued')+ ).toHaveLength(assignment === 'test' ? 1 : 0)+ } finally {+ onboarding.unmount()+ capture.mockRestore()+ }+ logic.unmount()+ router.actions.replace('/inbox')+ logic = inboxSetupLogic()+ logic.mount()+ await expectLogic(logic, () => logic.actions.loadSetup()).toFinishAllListeners()+ expect(logic.values.usesFocusedSetup).toBe(true)+ expect(logic.values.inProgress).toBe(true)+ expect(logic.values.draft.step).toBe('github')+ expect(logic.values.experimentVariant).toBe(assignment)+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ failCompletion = false+ await expectLogic(logic, () => logic.actions.activate()).toFinishAllListeners()+ expect(logic.values.completed).toBe(true)+ expect(logic.values.inProgress).toBe(false)+ expect(logic.values.experimentVariant).toBe(assignment)+ }+ )++ it('keeps partially activated setup open and retries without creating another source', async () => {+ const capture = jest.spyOn(posthog, 'capture')+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ expect(logic.values.activationDisabledReason).toBeUndefined()+ expect(capture.mock.calls.filter(([event]) => event === 'self-driving onboarding started')).toHaveLength(0)+ await expectLogic(logic, () => logic.actions.activate()).toFinishAllListeners()+ expect(logic.values.completed).toBe(false)+ expect(logic.values.inProgress).toBe(true)+ expect(logic.values.draft).toEqual(draft)+ expect(logic.values.error).toBeTruthy()+ expect(createdSources).toBe(1)++ failCompletion = false+ await expectLogic(logic, () => logic.actions.retry()).toFinishAllListeners()+ expect(savedDraft?.automatic_implementation).toBe(false)+ expect(logic.values.completed).toBe(true)+ expect(logic.values.inProgress).toBe(false)+ expect(createdSources).toBe(1)+ expect(capture.mock.calls.filter(([event]) => event === 'self-driving onboarding started')).toHaveLength(1)+ capture.mockRestore()+ })++ it('preserves a committed activation when its completion response was lost', async () => {+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ logic.actions.setEditedDraft({ ...logic.values.draft, automatic_implementation: true })+ const writeConfig = jest.spyOn(signalsApi, 'signalsConfigCreate')+ const complete = jest.spyOn(signalsApi, 'signalsOnboardingCompleteCreate').mockImplementation(async () => {+ completedAt = '2026-10-14T12:00:00Z'+ throw new Error('Response lost')+ })+ await expectLogic(logic, () => logic.actions.activate()).toFinishAllListeners()+ expect(logic.values.completed).toBe(false)+ expect(writeConfig).toHaveBeenCalledTimes(1)+ await expectLogic(logic, () => logic.actions.retry()).toFinishAllListeners()+ expect(logic.values.completed).toBe(true)+ expect(writeConfig).toHaveBeenCalledTimes(1)+ expect(complete).toHaveBeenCalledTimes(1)+ expect(savedDraft?.automatic_implementation).toBe(true)+ })++ it('disables a scanner deselected after partially successful activation', async () => {+ scanners = [{ id: 'scanner-one', enabled: true, emits_signals: false }]+ savedDraft = { ...draft, scanner_ids: ['scanner-one'] }+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ await expectLogic(logic, () => logic.actions.activate()).toFinishAllListeners()+ expect(scanners[0].emits_signals).toBe(true)+ expect(logic.values.completed).toBe(false)+ logic.actions.setEditedDraft({ ...logic.values.draft, scanner_ids: [] })+ failCompletion = false+ await expectLogic(logic, () => logic.actions.activate()).toFinishAllListeners()+ expect(scanners[0].emits_signals).toBe(false)+ expect(logic.values.completed).toBe(true)+ })++ it('preserves selected scanners when inventory refresh fails', async () => {+ scanners = [{ id: 'scanner-one', enabled: true, emits_signals: false }]+ savedDraft = { ...draft, scanner_ids: ['scanner-one'] }+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ useMocks({ get: { '/api/projects/:id/vision/scanners/': () => [500, { detail: 'Unavailable' }] } })+ await expectLogic(signalSourcesLogic, () =>+ signalSourcesLogic.actions.loadVisionScanners()+ ).toFinishAllListeners()+ expect(logic.values.draft.scanner_ids).toEqual(['scanner-one'])+ })++ it.each([false, true])('handles unavailable scanner access with selected scanners: %s', async (selected) => {+ savedDraft = { ...draft, scanner_ids: selected ? ['scanner-one'] : [] }+ failCompletion = false+ useMocks({ get: { '/api/projects/:id/vision/scanners/': () => [403, { detail: 'Scanner access denied' }] } })+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ await expectLogic(logic, () => logic.actions.activate()).toFinishAllListeners()+ expect(logic.values.completed).toBe(!selected)+ expect(logic.values.error).toBe(selected ? 'Scanner access denied' : null)+ })++ it('retries source inventory after a failed background refresh', async () => {+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ let unavailable = true+ const recoveredSource = {+ id: 'recovered-source',+ source_product: 'error_tracking',+ source_type: 'issue_created',+ enabled: true,+ }+ useMocks({+ get: {+ '/api/projects/:id/signals/source_configs/': () =>+ unavailable+ ? [503, { detail: 'Unavailable' }]+ : { results: [recoveredSource], next: null, count: 1 },+ },+ })+ await expectLogic(logic, () => logic.actions.refreshSources()).toFinishAllListeners()+ expect(logic.values.ready).toBe(true)+ expect(logic.values.error).toBeTruthy()+ unavailable = false+ await expectLogic(logic, () => logic.actions.retry()).toFinishAllListeners()+ expect(logic.values.sourceConfigs).toEqual([recoveredSource])+ expect(logic.values.error).toBeNull()+ })++ it('recovers scout choices after materialization fails', async () => {+ useMocks({ post: { '/api/projects/:id/signals/scout/configs/sync/': () => [503, { detail: 'Unavailable' }] } })+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ expect(logic.values.error).toBe('Could not prepare your scouts. Try again.')+ const generalScout = { ...mockScoutConfigs[0], skill_name: 'signals-scout-general', enabled: false }+ useMocks({ post: { '/api/projects/:id/signals/scout/configs/sync/': () => [200, [generalScout]] } })+ await expectLogic(logic, () => logic.actions.retry()).toFinishAllListeners()+ expect(logic.values.scoutChoices.some((scout) => scout.skill_name === generalScout.skill_name)).toBe(true)+ expect(logic.values.error).toBeNull()+ })++ it.each([false, true])(+ 'reconciles deselected scouts after reload without changing pre-existing enablement (%s)',+ async (enabledBeforeSetup) => {+ const suggestion = {+ ...mockScoutSuggestionSet().items[0],+ kind: 'canonical' as const,+ skill_name: 'signals-scout-general',+ }+ canonicalScouts = [+ { ...mockScoutConfigs[0], skill_name: suggestion.skill_name, enabled: enabledBeforeSetup },+ ]+ savedDraft = { ...draft, suggestions: [suggestion] }+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ await expectLogic(logic, () => logic.actions.activate()).toFinishAllListeners()+ expect(canonicalScouts[0].enabled).toBe(true)+ expect(logic.values.completed).toBe(false)+ logic.unmount()+ logic = inboxSetupLogic()+ logic.mount()+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ logic.actions.setEditedDraft({ ...logic.values.draft, suggestions: [] })+ failCompletion = false+ await expectLogic(logic, () => logic.actions.activate()).toFinishAllListeners()+ expect(canonicalScouts[0].enabled).toBe(enabledBeforeSetup)+ expect(logic.values.completed).toBe(true)+ }+ )++ it.each(['product-analytics', 'general'])('offers %s and enables it only at activation', async (name) => {+ hasEvents = name === 'product-analytics'+ const skillName = `signals-scout-${name}`+ canonicalScouts = [{ ...mockScoutConfigs[0], skill_name: skillName, enabled: false }]+ savedDraft = { ...draft, step: 'scouts' }+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ const suggestion = logic.values.scoutChoices.find((item) => item.skill_name === skillName)+ expect(suggestion).not.toBeUndefined()+ await expectLogic(logic, () => logic.actions.toggleSuggestion(suggestion!)).toFinishAllListeners()+ expect(savedDraft?.suggestions).toEqual([suggestion])+ expect(enabledScouts).toEqual([])+ await expectLogic(logic, () => logic.actions.goToStep('github')).toFinishAllListeners()+ failCompletion = false+ await expectLogic(logic, () => logic.actions.activate()).toFinishAllListeners()+ expect(enabledScouts).toEqual([skillName])+ expect(logic.values.completed).toBe(true)+ })++ it.each(['signals', 'scouts', 'github'] as const)(+ 'only waits for scouts on the second step when viewing %s',+ async (step) => {+ savedDraft = { ...draft, step }+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ let finishLoading!: () => void+ const pending = new Promise<void>((resolve) => {+ finishLoading = resolve+ })+ useMocks({+ get: {+ '/api/projects/:id/signals/scout/configs/': async () => {+ await pending+ return [200, []]+ },+ },+ })+ scoutFleetLogic.actions.loadScoutConfigs()+ expect(logic.values.scoutsLoading).toBe(true)+ expect(logic.values.ready).toBe(step !== 'scouts')+ finishLoading()+ await expectLogic(logic).toFinishAllListeners()+ expect(logic.values.ready).toBe(true)+ }+ )++ it('keeps GitHub as the final step for an existing connection', async () => {+ savedDraft = { ...draft, step: 'scouts' }+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ expect(logic.values.isFinalStep).toBe(false)+ await expectLogic(logic, () => logic.actions.goToStep('github')).toFinishAllListeners()+ expect(logic.values.draft.step).toBe('github')+ expect(logic.values.isFinalStep).toBe(true)+ expect(logic.values.activationDisabledReason).toBeUndefined()+ })++ it('stages an inline connection without starting signals and preserves choices when confirmation is retried', async () => {+ savedDraft = { ...draft, step: 'signals', sources: [{ ...draft.sources[0], enabled: false }] }+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ await expectLogic(logic, () => logic.actions.openSourceSetup('linear')).toFinishAllListeners()+ await expectLogic(logic, () => logic.actions.finishSourceSetup()).toFinishAllListeners()+ expect(logic.values.sourceSetupSource).toBe('linear')+ expect(logic.values.error).toBeTruthy()+ expect(savedDraft?.sources).toEqual([{ ...draft.sources[0], enabled: false }])++ warehouseConnected = true+ await expectLogic(logic, () => logic.actions.finishSourceSetup()).toFinishAllListeners()+ expect(logic.values.sourceSetupSource).toBeNull()+ expect(savedDraft?.sources).toEqual([+ { ...draft.sources[0], enabled: false },+ { source_product: 'linear', source_type: 'issue', enabled: true },+ ])+ expect(createdSources).toBe(0)+ expect(syncedSchemas).toBe(0)++ failCompletion = false+ await expectLogic(logic, () => logic.actions.activate()).toFinishAllListeners()+ expect(logic.values.completed).toBe(true)+ expect(createdSources).toBe(1)+ expect(syncedSchemas).toBe(1)+ })++ it.each(['refresh', 'return'] as const)(+ 'updates saved source choices on %s without undoing explicit deselection',+ async (mode) => {+ savedDraft = { ...draft, step: 'signals', sources: [] }+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ expect(logic.values.draft.sources).toEqual([])+ await expectLogic(logic, () => logic.actions.goToStep('scouts')).toFinishAllListeners()++ hasErrorTrackingData = true+ if (mode === 'return') {+ logic.unmount()+ logic = inboxSetupLogic()+ logic.mount()+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ } else {+ await expectLogic(logic, () => logic.actions.refreshSources()).toFinishAllListeners()+ }+ const source = logic.values.sources.find((item) => item.definition.source === 'error_tracking')!+ expect(source.available).toBe(true)+ expect(logic.values.draft.sources).toEqual(source.sources)+ expect(logic.values.draft.step).toBe('scouts')+ await expectLogic(logic, () => logic.actions.goToStep('github')).toFinishAllListeners()+ expect(savedDraft?.sources).toEqual(source.sources)++ await expectLogic(logic, () => logic.actions.toggleSource(source, false)).toFinishAllListeners()+ logic.unmount()+ logic = inboxSetupLogic()+ logic.mount()+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ expect(logic.values.draft.sources).toEqual(source.sources.map((item) => ({ ...item, enabled: false })))+ }+ )++ it('batches rapid edits without locking the form', async () => {+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ const save = jest.spyOn(signalsApi, 'signalsOnboardingCreate').mockImplementation(async (_, draft) => ({+ draft,+ completed_at: null,+ variant: 'test',+ }))+ jest.useFakeTimers()+ logic.actions.patchDraft({ automatic_implementation: true })+ await jest.advanceTimersByTimeAsync(500)+ logic.actions.patchDraft({ implementation_priority: 'P2' })+ expect(logic.values.draft).toMatchObject({ automatic_implementation: true, implementation_priority: 'P2' })+ expect(logic.values.saving).toBe(false)+ await jest.advanceTimersByTimeAsync(749)+ expect(save).not.toHaveBeenCalled()+ await jest.advanceTimersByTimeAsync(1)+ expect(save).toHaveBeenCalledTimes(1)+ expect(save.mock.calls[0][1]).toMatchObject({ automatic_implementation: true, implementation_priority: 'P2' })+ })++ it('serializes saves and keeps newer edits while navigation waits for them', async () => {+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ let finishFirst!: (state: InboxOnboardingStateApi) => void+ let finishSecond!: (state: InboxOnboardingStateApi) => void+ const save = jest+ .spyOn(signalsApi, 'signalsOnboardingCreate')+ .mockImplementationOnce(+ () =>+ new Promise((resolve) => {+ finishFirst = resolve+ })+ )+ .mockImplementationOnce(+ () =>+ new Promise((resolve) => {+ finishSecond = resolve+ })+ )+ logic.actions.patchDraft({ automatic_implementation: true })+ await waitFor(() => expect(save).toHaveBeenCalledTimes(1))+ expect(logic.values.saving).toBe(false)+ logic.actions.patchDraft({ automatic_implementation: false, implementation_priority: 'P2' })+ logic.actions.goToStep('scouts')+ expect(save).toHaveBeenCalledTimes(1)+ expect(logic.values.saving).toBe(true)+ finishFirst({ draft: save.mock.calls[0][1], completed_at: null, variant: 'test' })+ await waitFor(() => expect(save).toHaveBeenCalledTimes(2))+ expect(logic.values.draft).toMatchObject({ automatic_implementation: false, implementation_priority: 'P2' })+ expect(router.values.searchParams.onboarding_step).not.toBe('scouts')+ finishSecond({ draft: save.mock.calls[1][1], completed_at: null, variant: 'test' })+ await expectLogic(logic).toFinishAllListeners()+ expect(save).toHaveBeenCalledTimes(2)+ expect(logic.values.saving).toBe(false)+ expect(router.values.searchParams.onboarding_step).toBe('scouts')+ expect(logic.values.savedState?.draft).toMatchObject({+ automatic_implementation: false,+ implementation_priority: 'P2',+ })+ })++ it('keeps failed edits and retries before leaving for GitHub', async () => {+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ const originalLocation = window.location+ const assign = jest.fn()+ Object.defineProperty(window, 'location', { configurable: true, value: { ...originalLocation, assign } })+ const save = jest.spyOn(signalsApi, 'signalsOnboardingCreate').mockRejectedValueOnce(new Error('Offline'))+ try {+ await expectLogic(logic, () =>+ logic.actions.patchDraft({ automatic_implementation: true })+ ).toFinishAllListeners()+ expect(logic.values.error).toContain('Could not save')+ expect(logic.values.draft.automatic_implementation).toBe(true)+ expect(logic.values.saving).toBe(false)+ let finish!: (state: InboxOnboardingStateApi) => void+ save.mockImplementationOnce(+ () =>+ new Promise((resolve) => {+ finish = resolve+ })+ )+ logic.actions.connectGithub('/authorize-github')+ expect(assign).not.toHaveBeenCalled()+ expect(logic.values.saving).toBe(true)+ finish({ draft: save.mock.calls[1][1], completed_at: null, variant: 'test' })+ await expectLogic(logic).toFinishAllListeners()+ expect(logic.values.error).toBeNull()+ expect(assign).toHaveBeenCalledWith('/authorize-github')+ expect(logic.values.savedState?.draft?.automatic_implementation).toBe(true)+ } finally {+ Object.defineProperty(window, 'location', { configurable: true, value: originalLocation })+ }+ })++ it('persists final-step choices so they survive leaving for GitHub', async () => {+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ await expectLogic(logic, () =>+ logic.actions.patchDraft({ automatic_implementation: true })+ ).toFinishAllListeners()+ logic.unmount()+ logic = inboxSetupLogic()+ logic.mount()+ await expectLogic(logic, () => logic.actions.startSetup()).toFinishAllListeners()+ expect(logic.values.isFinalStep).toBe(true)+ expect(logic.values.draft).toMatchObject({+ step: 'github',+ automatic_implementation: true,+ })+ })+})diff --git a/products/signals/frontend/inbox/logics/inboxSetupLogic.ts b/products/signals/frontend/inbox/logics/inboxSetupLogic.tsnew file mode 100644index 000000000000..0e220c695598--- /dev/null+++ b/products/signals/frontend/inbox/logics/inboxSetupLogic.ts@@ -0,0 +1,1014 @@+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'+import { loaders } from 'kea-loaders'+import { router } from 'kea-router'+import posthog from 'posthog-js'++import { ApiError } from 'lib/api-error'+import { FEATURE_FLAGS } from 'lib/constants'+import { integrationsLogic } from 'lib/integrations/integrationsLogic'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { objectsEqual } from 'lib/utils/objects'+import { teamLogic } from 'scenes/teamLogic'+import { urls } from 'scenes/urls'++import { sourcesDataLogic } from 'products/data_warehouse/frontend/shared/logics/sourcesDataLogic'+import { engineeringAnalyticsCiSignalsConfigUpdate } from 'products/engineering_analytics/frontend/generated/api'+import { visionScannersList, visionScannersPartialUpdate } from 'products/replay_vision/frontend/generated/api'+import { externalDataSchemasPartialUpdate } from 'products/warehouse_sources/frontend/generated/api'++import type { PaginatedResponse } from '../../../../../frontend/src/lib/api'+import type { FeatureFlagsSet } from '../../../../../frontend/src/lib/logic/featureFlagLogic'+import type { IntegrationType, TeamPublicType, TeamType } from '../../../../../frontend/src/types'+import type { ExternalDataSource } from '../../../../../frontend/src/types'+import type { ReplayScannerApi } from '../../../../replay_vision/frontend/generated/api.schemas'+import {+ signalsConfigCreate,+ signalsOnboardingCreate,+ signalsOnboardingList,+ signalsOnboardingCompleteCreate,+ signalsOnboardingExposeCreate,+ signalsScoutConfigCreate,+ signalsScoutConfigList,+ signalsScoutConfigUpdate,+ signalsScoutCreate,+ signalsSourceConfigsCreate,+ signalsSourceConfigsList,+ signalsSourceConfigsPartialUpdate,+} from '../../generated/api'+import type {+ InboxOnboardingDraftApi,+ InboxOnboardingStateApi,+ ScoutSuggestionItemApi,+ SignalScoutConfigApi,+} from '../../generated/api.schemas'+import type { InboxOnboardingStepEnumApi } from '../../generated/api.schemas'+import type { AgentRosterSource } from '../components/config/agentRosterMeta'+import { signalSourcesLogic, WAREHOUSE_SOURCE_SETUP, type WarehouseBackedSource } from '../signalSourcesLogic'+import type { SourceProductStatus } from '../signalSourcesLogic'+import type { SignalSourceConfig } from '../types'+import { newInboxSetupDraft, reconcileInboxSetupDraft, selectedSourceCount, setupSources } from '../utils/inboxSetup'+import type { InboxSetupSource } from '../utils/inboxSetup'+import { inboxSetupDefaultScouts, inboxSetupScoutChoices } from '../utils/inboxSetupScouts'+import { DEFAULT_SUGGESTION_INTERVAL_MINUTES } from '../utils/scoutSuggestions'+import { scoutFleetLogic } from './scoutFleetLogic'+import type { SignalScoutConfig } from './scoutFleetLogic'+import { scoutSuggestionsLogic } from './scoutSuggestionsLogic'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface inboxSetupLogicValues {+ featureFlags: FeatureFlagsSet // featureFlagLogic+ githubIntegrations: IntegrationType[] // integrationsLogic+ integrationsLoading: boolean // integrationsLogic+ searchParams: Record<string, any> // router+ scoutConfigs: SignalScoutConfig[] | null // scoutFleetLogic+ scoutConfigsLoading: boolean // scoutFleetLogic+ isRefreshing: boolean // scoutSuggestionsLogic+ suggestionSetLoading: boolean // scoutSuggestionsLogic+ suggestions: ScoutSuggestionItemApi[] // scoutSuggestionsLogic+ productDataEvents: Set<string> | null // signalSourcesLogic+ productDataEventsLoading: boolean // signalSourcesLogic+ productStatusBySource: Partial<Record<AgentRosterSource, SourceProductStatus>> // signalSourcesLogic+ scannerInventoryKnown: boolean // signalSourcesLogic+ sourceConfigs: SignalSourceConfig[] | null // signalSourcesLogic+ sourceConfigsLoading: boolean // signalSourcesLogic+ visionScanners: ReplayScannerApi[] | null // signalSourcesLogic+ visionScannersLoading: boolean // signalSourcesLogic+ dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null // sourcesDataLogic+ dataWarehouseSourcesLoading: boolean // sourcesDataLogic+ currentTeam: TeamPublicType | TeamType | null // teamLogic+ currentTeamId: number | null // teamLogic+ activationDisabledReason: string | undefined+ completed: boolean+ defaultScouts: ScoutSuggestionItemApi[]+ draft: InboxOnboardingDraftApi+ editedDraft: InboxOnboardingDraftApi | null+ error: string | null+ experimentVariant: 'control' | 'test' | null+ failedOperation: 'activation' | 'other' | 'scouts' | 'sources' | null+ hasGithubIntegration: boolean+ inProgress: boolean+ isFinalStep: boolean+ isTreatment: boolean+ ready: boolean+ refreshingSources: boolean+ resumingSetup: boolean+ savedState: InboxOnboardingStateApi | null+ savedStateLoading: boolean+ saving: boolean+ scoutChoices: ScoutSuggestionItemApi[]+ scoutsLoading: boolean+ sourceCount: number+ sourceSetupSource: WarehouseBackedSource | null+ sources: InboxSetupSource[]+ started: boolean+ usesFocusedSetup: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface inboxSetupLogicActions {+ loadIntegrations: (_?: any) => any // integrationsLogic+ loadScoutConfigs: (_?: void | undefined) => void // scoutFleetLogic+ materializeScoutFleet: (+ surface?: import('../../generated/api.schemas').SignalsScoutConfigSyncSurface | undefined+ ) => {+ surface: import('../../generated/api.schemas').SignalsScoutConfigSyncSurface+ } // scoutFleetLogic+ syncScoutFleet: (_?: void | undefined) => void // scoutFleetLogic+ loadProductDataEvents: () => any // signalSourcesLogic+ loadSourceConfigs: () => any // signalSourcesLogic+ loadVisionScanners: () => any // signalSourcesLogic+ loadSources: () => {+ value: true+ } // sourcesDataLogic+ activate: () => {+ value: true+ }+ connectGithub: (url: string) => {+ url: string+ }+ continueFromWelcome: () => {+ value: true+ }+ expose: (variant: 'control' | 'test') => {+ variant: 'control' | 'test'+ }+ finishSourceSetup: () => {+ value: true+ }+ goToStep: (step: InboxOnboardingDraftApi['step']) => {+ step: InboxOnboardingStepEnumApi+ }+ loadSetup: () => any+ loadSetupFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadSetupSuccess: (+ savedState: InboxOnboardingStateApi,+ payload?: any+ ) => {+ savedState: InboxOnboardingStateApi+ payload?: any+ }+ openSetup: () => {+ value: true+ }+ openSourceSetup: (source: WarehouseBackedSource) => {+ source: WarehouseBackedSource+ }+ patchDraft: (patch: Partial<InboxOnboardingDraftApi>) => {+ patch: Partial<InboxOnboardingDraftApi>+ }+ refreshSources: () => {+ value: true+ }+ reportInteraction: () => {+ value: true+ }+ retry: () => {+ value: true+ }+ setEditedDraft: (draft: InboxOnboardingDraftApi) => {+ draft: InboxOnboardingDraftApi+ }+ setError: (+ error: string | null,+ failedOperation?: 'activation' | 'other' | 'scouts' | 'sources'+ ) => {+ error: string | null+ failedOperation: 'activation' | 'other' | 'scouts' | 'sources'+ }+ setSavedState: (state: InboxOnboardingStateApi) => {+ state: InboxOnboardingStateApi+ }+ setSaving: (saving: boolean) => {+ saving: boolean+ }+ setSourceSetupSource: (source: WarehouseBackedSource | null) => {+ source: WarehouseBackedSource | null+ }+ startSetup: () => {+ value: true+ }+ toggleSource: (+ source: InboxSetupSource,+ enabled: boolean+ ) => {+ enabled: boolean+ source: InboxSetupSource+ }+ toggleSuggestion: (suggestion: ScoutSuggestionItemApi) => {+ suggestion: ScoutSuggestionItemApi+ }+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface inboxSetupLogicMeta {+ __keaTypeGenInternalSelectorTypes: {+ experimentVariant: (+ featureFlags: FeatureFlagsSet,+ savedState: InboxOnboardingStateApi | null+ ) => 'control' | 'test' | null+ isTreatment: (experimentVariant: 'control' | 'test' | null) => boolean+ resumingSetup: (searchParams: Record<string, any>) => boolean+ usesFocusedSetup: (+ isTreatment: boolean,+ started: boolean,+ savedState: InboxOnboardingStateApi | null,+ resumingSetup: boolean+ ) => boolean+ sources: (+ sourceConfigs: SignalSourceConfig[] | null,+ productStatusBySource: Partial<Record<AgentRosterSource, SourceProductStatus>>,+ visionScanners: ReplayScannerApi[] | null,+ featureFlags: FeatureFlagsSet,+ currentTeam: TeamPublicType | TeamType | null,+ dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null+ ) => InboxSetupSource[]+ draft: (+ editedDraft: InboxOnboardingDraftApi | null,+ sources: InboxSetupSource[],+ visionScanners: ReplayScannerApi[] | null,+ scannerInventoryKnown: boolean+ ) => InboxOnboardingDraftApi+ scoutsLoading: (+ scoutConfigsLoading: boolean,+ suggestionSetLoading: boolean,+ isRefreshing: boolean,+ scoutChoices: ScoutSuggestionItemApi[]+ ) => boolean+ ready: (+ savedState: InboxOnboardingStateApi | null,+ sourceConfigs: SignalSourceConfig[] | null,+ visionScanners: ReplayScannerApi[] | null,+ productDataEvents: Set<string> | null,+ integrationsLoading: boolean,+ dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null,+ draft: InboxOnboardingDraftApi,+ scoutsLoading: boolean+ ) => boolean+ refreshingSources: (+ sourceConfigsLoading: boolean,+ visionScannersLoading: boolean,+ productDataEventsLoading: boolean,+ dataWarehouseSourcesLoading: boolean+ ) => boolean+ inProgress: (savedState: InboxOnboardingStateApi | null, started: boolean, resumingSetup: boolean) => boolean+ completed: (savedState: InboxOnboardingStateApi | null) => boolean+ sourceCount: (draft: InboxOnboardingDraftApi) => number+ hasGithubIntegration: (githubIntegrations: IntegrationType[]) => boolean+ isFinalStep: (draft: InboxOnboardingDraftApi) => boolean+ defaultScouts: (+ scoutConfigs: SignalScoutConfigApi[] | null,+ sources: InboxSetupSource[],+ currentTeam: TeamPublicType | TeamType | null,+ productStatusBySource: Partial<Record<AgentRosterSource, SourceProductStatus>>+ ) => ScoutSuggestionItemApi[]+ scoutChoices: (+ suggestions: ScoutSuggestionItemApi[],+ defaultScouts: ScoutSuggestionItemApi[],+ draft: InboxOnboardingDraftApi+ ) => ScoutSuggestionItemApi[]+ activationDisabledReason: (+ ready: boolean,+ draft: InboxOnboardingDraftApi,+ hasGithubIntegration: boolean,+ sourceCount: number+ ) => string | undefined+ }+}++export type inboxSetupLogicType = MakeLogicType<+ inboxSetupLogicValues,+ inboxSetupLogicActions,+ Record<string, any>,+ inboxSetupLogicMeta+>++export const inboxSetupLogic = kea<inboxSetupLogicType>([+ path(['products', 'signals', 'inbox', 'inboxSetupLogic']),+ connect(() => ({+ values: [+ router,+ ['searchParams'],+ teamLogic,+ ['currentTeam', 'currentTeamId'],+ featureFlagLogic,+ ['featureFlags'],+ signalSourcesLogic,+ [+ 'sourceConfigs',+ 'sourceConfigsLoading',+ 'visionScanners',+ 'visionScannersLoading',+ 'scannerInventoryKnown',+ 'productStatusBySource',+ 'productDataEvents',+ 'productDataEventsLoading',+ ],+ sourcesDataLogic,+ ['dataWarehouseSources', 'dataWarehouseSourcesLoading'],+ integrationsLogic,+ ['githubIntegrations', 'integrationsLoading'],+ scoutFleetLogic,+ ['scoutConfigs', 'scoutConfigsLoading'],+ scoutSuggestionsLogic,+ ['suggestions', 'suggestionSetLoading', 'isRefreshing'],+ ],+ actions: [+ signalSourcesLogic,+ ['loadSourceConfigs', 'loadVisionScanners', 'loadProductDataEvents'],+ scoutFleetLogic,+ ['loadScoutConfigs', 'materializeScoutFleet', 'syncScoutFleet'],+ integrationsLogic,+ ['loadIntegrations'],+ sourcesDataLogic,+ ['loadSources'],+ ],+ })),+ actions({+ continueFromWelcome: true,+ startSetup: true,+ openSetup: true,+ refreshSources: true,+ openSourceSetup: (source: WarehouseBackedSource) => ({ source }),+ setSourceSetupSource: (source: WarehouseBackedSource | null) => ({ source }),+ finishSourceSetup: true,+ reportInteraction: true,+ expose: (variant: 'control' | 'test') => ({ variant }),+ patchDraft: (patch: Partial<InboxOnboardingDraftApi>) => ({ patch }),+ setEditedDraft: (draft: InboxOnboardingDraftApi) => ({ draft }),+ connectGithub: (url: string) => ({ url }),+ toggleSource: (source: InboxSetupSource, enabled: boolean) => ({ source, enabled }),+ toggleSuggestion: (suggestion: ScoutSuggestionItemApi) => ({ suggestion }),+ goToStep: (step: InboxOnboardingDraftApi['step']) => ({ step }),+ activate: true,+ retry: true,+ setSaving: (saving: boolean) => ({ saving }),+ setError: (error: string | null, failedOperation: 'activation' | 'sources' | 'scouts' | 'other' = 'other') => ({+ error,+ failedOperation,+ }),+ setSavedState: (state: InboxOnboardingStateApi) => ({ state }),+ }),+ loaders(({ values }) => ({+ savedState: [+ null as InboxOnboardingStateApi | null,+ {+ loadSetup: async () => signalsOnboardingList(String(values.currentTeamId)),+ },+ ],+ })),+ reducers({+ savedState: { setSavedState: (_, { state }) => state },+ editedDraft: [+ null as InboxOnboardingDraftApi | null,+ {+ setEditedDraft: (_, { draft }) => draft,+ loadSetupSuccess: (_, { savedState }) => savedState.draft,+ },+ ],+ sourceSetupSource: [null as WarehouseBackedSource | null, { setSourceSetupSource: (_, { source }) => source }],+ saving: [false, { setSaving: (_, { saving }) => saving }],+ error: [+ null as string | null,+ { setError: (_, { error }) => error, loadSetupFailure: (_, { error }) => error },+ ],+ failedOperation: [+ null as 'activation' | 'sources' | 'scouts' | 'other' | null,+ { setError: (_, { error, failedOperation }) => (error ? failedOperation : null) },+ ],+ started: [false, { startSetup: () => true, openSetup: () => true }],+ }),+ selectors({+ experimentVariant: [+ (s) => [s.featureFlags, s.savedState],+ (flags: FeatureFlagsSet, state: InboxOnboardingStateApi | null): 'control' | 'test' | null => {+ const variant = state?.variant ?? flags[FEATURE_FLAGS.INBOX_UI_ONBOARDING]+ return variant === 'control' || variant === 'test' ? variant : null+ },+ ],+ isTreatment: [+ (s) => [s.experimentVariant],+ (variant: 'control' | 'test' | null): boolean => variant === 'test',+ ],+ resumingSetup: [+ (s) => [s.searchParams],+ (params: Record<string, any>): boolean =>+ ['signals', 'scouts', 'github'].includes(String(params.onboarding_step)),+ ],+ usesFocusedSetup: [+ (s) => [s.isTreatment, s.started, s.savedState, s.resumingSetup],+ (treatment: boolean, started: boolean, state: InboxOnboardingStateApi | null, resuming: boolean): boolean =>+ treatment || started || !!state?.draft || resuming,+ ],+ sources: [+ (s) => [+ s.sourceConfigs,+ s.productStatusBySource,+ s.visionScanners,+ s.featureFlags,+ s.currentTeam,+ s.dataWarehouseSources,+ ],+ (+ configs: SignalSourceConfig[] | null,+ statuses: Partial<Record<AgentRosterSource, SourceProductStatus>>,+ scanners: ReplayScannerApi[] | null,+ flags: FeatureFlagsSet,+ team: TeamPublicType | TeamType | null,+ warehouseSources: PaginatedResponse<ExternalDataSource> | null+ ): InboxSetupSource[] =>+ setupSources(+ configs ?? [],+ statuses,+ scanners?.length ?? 0,+ flags,+ !!team?.ingested_event,+ warehouseSources?.results ?? null+ ),+ ],+ draft: [+ (s) => [s.editedDraft, s.sources, s.visionScanners, s.scannerInventoryKnown],+ (+ draft: InboxOnboardingDraftApi | null,+ sources: InboxSetupSource[],+ scanners: ReplayScannerApi[] | null,+ scannerInventoryKnown: boolean+ ): InboxOnboardingDraftApi =>+ draft+ ? reconcileInboxSetupDraft(+ draft,+ sources,+ scannerInventoryKnown ? (scanners?.map((scanner) => scanner.id) ?? null) : null+ )+ : newInboxSetupDraft(+ sources,+ (scanners ?? []).map((scanner) => scanner.id)+ ),+ ],+ scoutsLoading: [+ (s) => [s.scoutConfigsLoading, s.suggestionSetLoading, s.isRefreshing, s.scoutChoices],+ (configs: boolean, suggestions: boolean, refreshing: boolean, choices: ScoutSuggestionItemApi[]): boolean =>+ configs || suggestions || (refreshing && choices.length === 0),+ ],+ ready: [+ (s) => [+ s.savedState,+ s.sourceConfigs,+ s.visionScanners,+ s.productDataEvents,+ s.integrationsLoading,+ s.dataWarehouseSources,+ s.draft,+ s.scoutsLoading,+ ],+ (+ state: InboxOnboardingStateApi | null,+ configs: SignalSourceConfig[] | null,+ scanners: ReplayScannerApi[] | null,+ events: Set<string> | null,+ integrationsLoading: boolean,+ warehouseSources: PaginatedResponse<ExternalDataSource> | null,+ draft: InboxOnboardingDraftApi,+ scoutsLoading: boolean+ ): boolean =>+ state !== null &&+ configs !== null &&+ scanners !== null &&+ events !== null &&+ !integrationsLoading &&+ warehouseSources !== null &&+ (draft.step !== 'scouts' || !scoutsLoading),+ ],+ refreshingSources: [+ (s) => [+ s.sourceConfigsLoading,+ s.visionScannersLoading,+ s.productDataEventsLoading,+ s.dataWarehouseSourcesLoading,+ ],+ (configs: boolean, scanners: boolean, events: boolean, sources: boolean): boolean =>+ configs || scanners || events || sources,+ ],+ inProgress: [+ (s) => [s.savedState, s.started, s.resumingSetup],+ (state: InboxOnboardingStateApi | null, started: boolean, resuming: boolean): boolean =>+ !state?.completed_at && (started || !!state?.draft || resuming),+ ],+ completed: [(s) => [s.savedState], (state: InboxOnboardingStateApi | null): boolean => !!state?.completed_at],+ sourceCount: [(s) => [s.draft], (draft: InboxOnboardingDraftApi): number => selectedSourceCount(draft)],+ hasGithubIntegration: [+ (s) => [s.githubIntegrations],+ (integrations: IntegrationType[]): boolean =>+ integrations.some((integration) => integration.installation_status !== 'unavailable'),+ ],+ isFinalStep: [(s) => [s.draft], (draft: InboxOnboardingDraftApi): boolean => draft.step === 'github'],+ defaultScouts: [+ (s) => [s.scoutConfigs, s.sources, s.currentTeam, s.productStatusBySource],+ (+ configs: SignalScoutConfigApi[] | null,+ sources: InboxSetupSource[],+ team: TeamPublicType | TeamType | null,+ statuses: Partial<Record<AgentRosterSource, SourceProductStatus>>+ ): ScoutSuggestionItemApi[] =>+ inboxSetupDefaultScouts(configs ?? [], sources, !!team?.ingested_event, statuses),+ ],+ scoutChoices: [+ (s) => [s.suggestions, s.defaultScouts, s.draft],+ (+ suggestions: ScoutSuggestionItemApi[],+ defaults: ScoutSuggestionItemApi[],+ draft: InboxOnboardingDraftApi+ ): ScoutSuggestionItemApi[] =>+ inboxSetupScoutChoices(suggestions.length ? suggestions : defaults, draft.suggestions),+ ],+ activationDisabledReason: [+ (s) => [s.ready, s.draft, s.hasGithubIntegration, s.sourceCount],+ (+ ready: boolean,+ draft: InboxOnboardingDraftApi,+ connected: boolean,+ sourceCount: number+ ): string | undefined =>+ !ready+ ? 'Loading setup'+ : !connected+ ? 'Connect GitHub to continue'+ : !sourceCount && !draft.suggestions.length+ ? 'Select a signal source or scout'+ : undefined,+ ],+ }),+ listeners(({ values, actions, cache }) => {+ let pendingSave: Promise<void> | null = null+ let persistedDraft: InboxOnboardingDraftApi | null = null+ let requestedStep: InboxOnboardingDraftApi['step'] | undefined++ const saveDraft = async (step?: InboxOnboardingDraftApi['step']): Promise<void> => {+ requestedStep = step ?? requestedStep+ if (pendingSave) {+ await pendingSave+ return saveDraft()+ }+ const save = async (): Promise<void> => {+ while (!values.completed) {+ const step = requestedStep+ const draft = step ? { ...values.draft, step } : values.draft+ if (objectsEqual(draft, persistedDraft ?? values.savedState?.draft)) {+ return+ }+ const state = await signalsOnboardingCreate(String(values.currentTeamId), draft)+ persistedDraft = draft+ actions.setSavedState(state)+ if (step) {+ actions.setEditedDraft({ ...values.draft, step })+ requestedStep = undefined+ }+ }+ }+ pendingSave = save()+ try {+ await pendingSave+ } finally {+ pendingSave = null+ requestedStep = undefined+ }+ }++ return {+ continueFromWelcome: () => {+ if (values.inProgress) {+ return+ }+ posthog.capture('self-driving onboarding welcome continued', {+ variant: values.experimentVariant,+ project_id: values.currentTeamId,+ flow_version: 'ui-first-v1',+ })+ actions.openSetup()+ },+ expose: async ({ variant }) => {+ try {+ const state = await signalsOnboardingExposeCreate(String(values.currentTeamId), { variant })+ if (state.variant !== values.savedState?.variant) {+ actions.setSavedState({+ ...(values.savedState ?? state),+ variant: state.variant,+ })+ }+ } catch (error) {+ posthog.captureException(error)+ }+ },+ openSetup: () => {+ actions.reportInteraction()+ router.actions.push(urls.inbox(), { onboarding_step: values.draft.step })+ },+ startSetup: () => {+ actions.setError(null)+ actions.refreshSources()+ actions.loadIntegrations()+ cache.disposables.add(() => {+ const refresh = (): void => {+ if (!values.saving && !values.sourceSetupSource && !values.refreshingSources) {+ actions.refreshSources()+ }+ }+ window.addEventListener('focus', refresh)+ return () => window.removeEventListener('focus', refresh)+ }, 'setupSourceRefresh')+ actions.loadScoutConfigs()+ actions.materializeScoutFleet('onboarding')+ if (scoutSuggestionsLogic.isMounted()) {+ scoutSuggestionsLogic.actions.loadSuggestions()+ }+ if (!values.savedState) {+ actions.loadSetup()+ }+ },+ refreshSources: () => {+ actions.loadSources()+ actions.loadSourceConfigs()+ actions.loadVisionScanners()+ actions.loadProductDataEvents()+ teamLogic.actions.loadCurrentTeam()+ },+ openSourceSetup: async ({ source }) => {+ if (values.saving || !values.ready) {+ return+ }+ actions.reportInteraction()+ actions.setSaving(true)+ actions.setError(null)+ try {+ await saveDraft()+ actions.setSourceSetupSource(source)+ } catch {+ actions.setError('Could not save your choices. Try again before connecting a source.')+ } finally {+ actions.setSaving(false)+ }+ },+ finishSourceSetup: async () => {+ const sourceKey = values.sourceSetupSource+ if (values.saving || !sourceKey) {+ return+ }+ actions.setSaving(true)+ actions.setError(null)+ try {+ await sourcesDataLogic.asyncActions.loadSources()+ const source = values.sources.find((item) => item.definition.source === sourceKey)+ if (!source?.available) {+ throw new Error('Source is not connected')+ }+ actions.setEditedDraft({+ ...values.draft,+ sources: [+ ...values.draft.sources.filter(+ (item) => item.source_product !== source.definition.sourceProduct+ ),+ ...source.sources,+ ],+ })+ await saveDraft()+ actions.setSourceSetupSource(null)+ } catch {+ actions.setError('Could not confirm your source connection. Try again.')+ } finally {+ actions.setSaving(false)+ }+ },+ [signalSourcesLogic.actionTypes.enableSourceProduct]: () => {+ if (values.inProgress) {+ actions.reportInteraction()+ }+ },+ [signalSourcesLogic.actionTypes.enableSourceProductComplete]: () => actions.refreshSources(),+ [sourcesDataLogic.actionTypes.loadSourcesFailure]: () =>+ actions.setError('Could not load connected sources. Try again.', 'sources'),+ [scoutFleetLogic.actionTypes.syncScoutFleetFailure]: () => {+ if (values.started) {+ actions.setError('Could not prepare your scouts. Try again.', 'scouts')+ }+ },+ reportInteraction: () => {+ if (!cache.startReported) {+ posthog.capture('self-driving onboarding started', {+ variant: values.experimentVariant,+ project_id: values.currentTeamId,+ flow_version: 'ui-first-v1',+ })+ cache.startReported = true+ }+ },+ [signalSourcesLogic.actionTypes.loadSourceConfigsFailure]: () => {+ actions.setError('Could not load signal sources. Try again.', 'sources')+ },+ [signalSourcesLogic.actionTypes.loadProductDataEventsFailure]: () => {+ actions.setError('Could not check which sources are ready. Try again.', 'sources')+ },+ patchDraft: async ({ patch }, breakpoint) => {+ actions.reportInteraction()+ actions.setEditedDraft({ ...values.draft, ...patch })+ actions.setError(null)+ await breakpoint(750)+ try {+ await saveDraft()+ } catch {+ actions.setError('Could not save your choices. Try again before leaving setup.')+ }+ },+ connectGithub: async ({ url }) => {+ if (values.saving) {+ return+ }+ actions.setSaving(true)+ actions.setError(null)+ try {+ await saveDraft()+ window.location.assign(url)+ } catch {+ actions.setError('Could not save your choices. Try again before connecting GitHub.')+ } finally {+ actions.setSaving(false)+ }+ },+ [scoutSuggestionsLogic.actionTypes.loadSuggestionsSuccess]: ({ suggestionSet }) => {+ if (!values.started || cache.suggestionsChecked || !suggestionSet) {+ return+ }+ cache.suggestionsChecked = true+ if (+ suggestionSet.status === 'empty' &&+ !suggestionSet.generated_at &&+ !scoutSuggestionsLogic.values.isRefreshing+ ) {+ scoutSuggestionsLogic.actions.requestRefresh('onboarding')+ }+ },+ toggleSource: ({ source, enabled }) => {+ actions.reportInteraction()+ const draft = values.draft+ actions.patchDraft(+ source.definition.source === 'replay_vision'+ ? { scanner_ids: enabled ? (values.visionScanners ?? []).map((scanner) => scanner.id) : [] }+ : {+ sources: [+ ...draft.sources.filter(+ (item) => item.source_product !== source.definition.sourceProduct+ ),+ ...source.sources.map((item) => ({ ...item, enabled })),+ ],+ }+ )+ },+ toggleSuggestion: ({ suggestion }) => {+ if (+ values.draft.suggestions.length >= 5 &&+ !values.draft.suggestions.some((item) => item.id === suggestion.id)+ ) {+ return+ }+ actions.reportInteraction()+ const draft = values.draft+ actions.patchDraft({+ suggestions: draft.suggestions.some((item) => item.id === suggestion.id)+ ? draft.suggestions.filter((item) => item.id !== suggestion.id)+ : [...draft.suggestions, suggestion],+ })+ },+ goToStep: async ({ step }) => {+ if (values.saving || values.sourceSetupSource) {+ return+ }+ actions.reportInteraction()+ const previousStep = values.draft.step+ actions.setSaving(true)+ actions.setError(null)+ try {+ await saveDraft(step)+ if (step !== previousStep) {+ posthog.capture('self-driving onboarding step completed', {+ step: previousStep,+ variant: values.experimentVariant,+ project_id: values.currentTeamId,+ skipped: previousStep === 'scouts' && !values.draft.suggestions.length,+ })+ }+ router.actions.replace(urls.inbox(), { ...router.values.searchParams, onboarding_step: step })+ posthog.capture('self-driving onboarding step viewed', {+ step,+ variant: values.experimentVariant,+ project_id: values.currentTeamId,+ })+ } catch (error) {+ actions.setError(+ error instanceof ApiError ? error.detail : 'Could not save your choices. Try again.'+ )+ } finally {+ actions.setSaving(false)+ }+ },+ retry: () => {+ if (values.failedOperation === 'activation') {+ actions.activate()+ } else if (values.failedOperation === 'sources') {+ actions.setError(null)+ actions.refreshSources()+ } else if (values.failedOperation === 'scouts') {+ actions.setError(null)+ actions.syncScoutFleet()+ } else if (values.sourceSetupSource) {+ actions.finishSourceSetup()+ } else if (values.ready) {+ actions.goToStep(values.draft.step)+ } else {+ actions.startSetup()+ }+ },+ activate: async () => {+ if (values.saving || cache.activating || values.activationDisabledReason) {+ return+ }+ actions.reportInteraction()+ cache.activating = true+ actions.setSaving(true)+ actions.setError(null)+ let draft = values.draft+ const projectId = String(values.currentTeamId)+ try {+ await saveDraft()+ actions.setSavedState(await signalsOnboardingList(projectId))+ if (values.completed) {+ router.actions.replace(urls.inbox())+ return+ }+ let scanners: ReplayScannerApi[] = []+ try {+ const response = await visionScannersList(projectId, { enabled: 'enabled', limit: 1000 })+ scanners = response.results+ signalSourcesLogic.actions.setScannerInventoryKnown(!response.next)+ signalSourcesLogic.actions.loadVisionScannersSuccess(scanners)+ } catch (error) {+ if (+ !(error instanceof ApiError) ||+ (error.status !== 403 && error.status !== 404) ||+ draft.scanner_ids.length ||+ values.visionScanners?.length+ ) {+ throw error+ }+ }+ draft = values.draft+ await saveDraft()+ const currentScouts =+ draft.suggestions.length || draft.activation_scouts?.length+ ? await signalsScoutConfigList(projectId)+ : []+ const activationScouts = new Set(draft.activation_scouts ?? [])+ const persistActivationScouts = async (): Promise<void> => {+ draft = { ...draft, activation_scouts: [...activationScouts] }+ actions.setEditedDraft(draft)+ await saveDraft()+ }+ for (const skillName of activationScouts) {+ if (draft.suggestions.some((suggestion) => suggestion.skill_name === skillName)) {+ continue+ }+ const scout = currentScouts.find((config) => config.skill_name === skillName)+ if (scout?.enabled) {+ await signalsScoutConfigUpdate(projectId, scout.id, { enabled: false })+ }+ activationScouts.delete(skillName)+ await persistActivationScouts()+ }+ // Disable the legacy default before enabling any work that could create a pull request.+ await signalsConfigCreate(projectId, { autostart_enabled: false })+ for (const source of values.sources.filter((item) => item.warehouseSource)) {+ if (+ !draft.sources.some(+ (item) => item.source_product === source.definition.sourceProduct && item.enabled+ )+ ) {+ continue+ }+ const setup = WAREHOUSE_SOURCE_SETUP[source.warehouseSource!]+ const schemas = (values.dataWarehouseSources?.results ?? [])+ .filter((item) => item.source_type === setup.dwSourceType)+ .flatMap((item) => item.schemas ?? [])+ for (const table of setup.requiredTables) {+ const matches = schemas.filter(+ (schema) => schema.name === table || schema.name.endsWith(`.${table}`)+ )+ if (!matches.length) {+ throw new Error(`Missing required table: ${table}`)+ }+ for (const schema of matches.filter((item) => !item.should_sync)) {+ await externalDataSchemasPartialUpdate(projectId, schema.id, { should_sync: true })+ }+ }+ }+ const ciSources = draft.sources.filter(+ (source) => source.source_product === 'engineering_analytics'+ )+ if (ciSources.length) {+ await engineeringAnalyticsCiSignalsConfigUpdate(projectId, {+ enabled: ciSources.some((source) => source.enabled),+ })+ }+ const currentSources = await signalsSourceConfigsList(projectId, { limit: 1000 })+ for (const source of draft.sources) {+ const existing = currentSources.results.find(+ (item) =>+ item.source_product === source.source_product && item.source_type === source.source_type+ )+ if (existing) {+ await signalsSourceConfigsPartialUpdate(projectId, existing.id, { enabled: source.enabled })+ } else if (source.enabled) {+ await signalsSourceConfigsCreate(projectId, source)+ }+ }+ for (const scanner of scanners) {+ const enabled = draft.scanner_ids.includes(scanner.id)+ if (scanner.emits_signals !== enabled) {+ await visionScannersPartialUpdate(projectId, scanner.id, { emits_signals: enabled })+ }+ }+ for (const suggestion of draft.suggestions) {+ if (+ !currentScouts.some(+ (config) => config.skill_name === suggestion.skill_name && config.enabled+ )+ ) {+ activationScouts.add(suggestion.skill_name)+ await persistActivationScouts()+ }+ const config = {+ enabled: true,+ emit: true,+ run_cron_schedule: suggestion.proposed_config.run_cron_schedule ?? null,+ run_interval_minutes:+ suggestion.proposed_config.run_interval_minutes ?? DEFAULT_SUGGESTION_INTERVAL_MINUTES,+ }+ if (suggestion.kind === 'canonical') {+ await signalsScoutConfigCreate(projectId, { skill_name: suggestion.skill_name, ...config })+ } else {+ await signalsScoutCreate(projectId, {+ name: suggestion.skill_name,+ display_name: suggestion.title,+ description: suggestion.description,+ body: suggestion.draft_body,+ config,+ })+ }+ }+ actions.setSavedState(await signalsOnboardingCompleteCreate(projectId, draft))+ actions.loadSourceConfigs()+ actions.loadVisionScanners()+ actions.loadScoutConfigs()+ router.actions.replace(urls.inbox())+ } catch (error) {+ actions.setError(+ error instanceof ApiError+ ? error.detail+ : 'Could not finish setup. Your choices are saved. Retry activation.',+ 'activation'+ )+ posthog.capture('self-driving onboarding failed', {+ variant: values.experimentVariant,+ project_id: values.currentTeamId,+ step: draft.step,+ })+ } finally {+ actions.setSaving(false)+ cache.activating = false+ }+ },+ [teamLogic.actionTypes.loadCurrentTeamSuccess]: () => {+ if (values.currentTeamId && !values.savedState && !values.savedStateLoading) {+ actions.loadSetup()+ }+ },+ [featureFlagLogic.actionTypes.setFeatureFlags]: () => {+ if (+ ['control', 'test'].includes(String(values.featureFlags[FEATURE_FLAGS.INBOX_UI_ONBOARDING])) &&+ !values.savedState &&+ !values.savedStateLoading &&+ values.currentTeamId+ ) {+ actions.loadSetup()+ }+ },+ }+ }),+ afterMount(({ actions, values }) => {+ if (values.currentTeamId) {+ actions.loadSetup()+ }+ }),+])diff --git a/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts b/products/signals/frontend/inbox/logics/scoutFleetLogic.test.tsindex 49be4b8aac25..1b14802b9262 100644--- a/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts+++ b/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts@@ -580,14 +580,14 @@ describe('scoutFleetLogic', () => {// The whole point of materializing on open: a project the coordinator never reached has no// configs at all, and the roster has no other way to get any.- it('fills an empty roster from the fleet the sync materializes', async () => {+ it.each(['roster', 'onboarding'] as const)('fills an empty fleet for %s', async (surface) => {mockSignalsScoutConfigSync.mockResolvedValue([BASE_CONFIG])logic.actions.loadScoutConfigsSuccess([])- logic.actions.materializeScoutFleet()+ logic.actions.materializeScoutFleet(surface)await expectLogic(logic).toDispatchActions(['syncScoutFleetSuccess'])- expect(mockSignalsScoutConfigSync).toHaveBeenCalledWith(String(MOCK_TEAM_ID), { surface: 'roster' })+ expect(mockSignalsScoutConfigSync).toHaveBeenCalledWith(String(MOCK_TEAM_ID), { surface })expect(logic.values.scoutConfigs).toEqual([BASE_CONFIG])expect(logic.values.scoutFleetSynced).toBe(true)expect(logic.values.scoutFleetSyncOutcome).toBe('synced')diff --git a/products/signals/frontend/inbox/logics/scoutFleetLogic.ts b/products/signals/frontend/inbox/logics/scoutFleetLogic.tsindex 552866a2a5b1..88aa1e5ef8d6 100644--- a/products/signals/frontend/inbox/logics/scoutFleetLogic.ts+++ b/products/signals/frontend/inbox/logics/scoutFleetLogic.ts@@ -45,6 +45,7 @@ import type {ScoutCostsApi,ScoutMetadataApi,SignalScoutConfigApi,+ SignalsScoutConfigSyncSurface,} from 'products/signals/frontend/generated/api.schemas'import { llmSkillsNameArchiveCreate, llmSkillsNamePublishCommunityCreate } from 'products/skills/frontend/generated/api'import type { CommunitySkillScoutConfigApi } from 'products/skills/frontend/generated/api.schemas'@@ -437,6 +438,7 @@ export interface scoutFleetLogicValues {scoutEnabledFilter: ScoutEnabledFilterscoutFleetSyncOutcome: ScoutFleetSyncOutcomescoutFleetSyncRequested: boolean+ scoutFleetSyncSurface: SignalsScoutConfigSyncSurfacescoutFleetSynced: booleanscoutMetadata: ScoutMetadataApi | nullscoutMetadataLoading: boolean@@ -606,8 +608,8 @@ export interface scoutFleetLogicActions {scoutRuns: SignalScoutRunSummary[]payload?: void}- materializeScoutFleet: () => {- value: true+ materializeScoutFleet: (surface?: SignalsScoutConfigSyncSurface) => {+ surface: SignalsScoutConfigSyncSurface}mergeScoutRunCosts: (costs: Map<string, number>) => {costs: Map<string, number>@@ -830,7 +832,7 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([actions({// Fired when the roster opens. The listener decides whether a sync is still owed, so the// caller never has to know whether one already ran.- materializeScoutFleet: true,+ materializeScoutFleet: (surface: SignalsScoutConfigSyncSurface = 'roster') => ({ surface }),updateScoutConfig: (configId: string, updates: SignalScoutConfigUpdate) => ({ configId, updates }),updateScoutConfigFinished: (configId: string) => ({ configId }),// A full server config doubles as a local patch when reconciling optimistic edits.@@ -925,7 +927,9 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([return values.scoutConfigs}try {- const configs = await signalsScoutConfigSync(String(teamId), { surface: 'roster' })+ const configs = await signalsScoutConfigSync(String(teamId), {+ surface: values.scoutFleetSyncSurface,+ })// Same unmount race as `loadScoutConfigs`: break before reading `values`.breakpoint()actions.setScoutFleetSyncOutcome('synced')@@ -1346,6 +1350,10 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([materializeScoutFleet: () => true,},],+ scoutFleetSyncSurface: [+ 'roster' as SignalsScoutConfigSyncSurface,+ { materializeScoutFleet: (_, { surface }) => surface },+ ],// Flips true once the fleet materialization settles, either way. It does double duty: the// listener reads it so one roster session syncs at most once, and the roster reads it to// tell "the fleet is still being materialized" from "this project genuinely has no scouts",diff --git a/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts b/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.tsindex b5e6db4cd80f..942d7f19921f 100644--- a/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts+++ b/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts@@ -441,14 +441,22 @@ describe('scoutSuggestionsLogic', () => {expect(logic.values.isRefreshing).toBe(false)})- it('does not wait for a scan the daily cap refused', async () => {+ it.each([+ ['strip', 429, true],+ ['onboarding', 403, false],+ ['strip', 403, true],+ ['onboarding', 500, true],+ ] as const)('handles a refused %s scan with status %s', async (source, status, showsToast) => {await mountWithBatch()- mockRefresh.mockRejectedValueOnce(new ApiError("You've reached today's limit.", 429))+ const toast = jest.spyOn(lemonToast, 'error')+ mockRefresh.mockRejectedValueOnce(new ApiError('Scan unavailable', status))- logic.actions.requestRefresh('strip')+ logic.actions.requestRefresh(source)await expectLogic(logic).toFinishAllListeners()expect(logic.values.isRefreshing).toBe(false)+ expect(toast).toHaveBeenCalledTimes(showsToast ? 1 : 0)+ toast.mockRestore()})it('keeps waiting when the row was already failed before the refresh', async () => {diff --git a/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.ts b/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.tsindex 49b234ef64be..7c0a7937c3ee 100644--- a/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.ts+++ b/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.ts@@ -687,7 +687,9 @@ export const scoutSuggestionsLogic = kea<scoutSuggestionsLogicType>([actions.refreshRequestRefused()// The endpoint refuses for ordinary reasons — the daily cap, the org's AI setting,// a quota — so its own message is the one worth showing.- lemonToast.error(apiError?.detail ?? 'Could not start a new scan')+ if (source !== 'onboarding' || apiError?.status !== 403) {+ lemonToast.error(apiError?.detail ?? 'Could not start a new scan')+ }} finally {cache.refreshInFlight = false}diff --git a/products/signals/frontend/inbox/signalSourcesLogic.test.ts b/products/signals/frontend/inbox/signalSourcesLogic.test.tsindex 16c2109c07e0..1917f5c840dd 100644--- a/products/signals/frontend/inbox/signalSourcesLogic.test.ts+++ b/products/signals/frontend/inbox/signalSourcesLogic.test.ts@@ -82,6 +82,7 @@ describe('signalSourcesLogic', () => {200,{ results: warehouseSources, count: warehouseSources.length, next: null, previous: null },],+ '/api/projects/:team_id/error_tracking/issues/exists/': { exists: false },'/api/projects/:team_id/signals/source_configs/': () => [200,{ results: [], count: 0, next: null, previous: null },@@ -332,6 +333,15 @@ describe('signalSourcesLogic', () => {enabled: false,dataStatus: 'none',},+ {+ name: 'when the issue check fails and no recent exceptions exist',+ arrange: (mountedLogic: typeof logic) => {+ mountedLogic.actions.setErrorTrackingHasIssues(null)+ mountedLogic.actions.loadProductDataEventsSuccess(new Set())+ },+ enabled: null,+ dataStatus: 'error',+ },{name: 'when a successful check finds recent exceptions',arrange: (mountedLogic: typeof logic) =>@@ -345,11 +355,52 @@ describe('signalSourcesLogic', () => {autocapture_exceptions_opt_in: false,})+ logic.actions.setErrorTrackingHasIssues(false)arrange(logic)expect(logic.values.productStatusBySource.error_tracking).toMatchObject({ enabled, dataStatus })})+ it('keeps loaded product statuses visible until a background refresh completes', async () => {+ const refresh = deferred<void>()+ useMocks({+ get: {+ '/api/projects/:team_id/event_definitions/': async () => {+ await refresh.promise+ return [200, { results: [], count: 0, next: null }]+ },+ },+ })+ logic.actions.setErrorTrackingHasIssues(false)+ logic.actions.loadProductDataEventsSuccess(new Set(['$exception', '$ai_generation', '$pageview']))+ const statuses = logic.values.productStatusBySource++ logic.actions.loadProductDataEvents()+ expect(logic.values.productDataEventsLoading).toBe(true)+ expect(logic.values.productStatusBySource).toEqual(statuses)++ refresh.resolve()+ await expectLogic(logic).toFinishAllListeners()+ expect(logic.values.productStatusBySource.llm_analytics?.dataStatus).toBe('none')+ })++ it('recognizes existing Error tracking issues without recent event definitions or browser autocapture', async () => {+ useMocks({+ get: {+ '/api/projects/:team_id/error_tracking/issues/exists/': { exists: true },+ '/api/projects/:team_id/event_definitions/': { results: [], count: 0, next: null },+ },+ })+ teamLogic.actions.loadCurrentTeamSuccess({ ...MOCK_DEFAULT_TEAM, autocapture_exceptions_opt_in: false })++ await expectLogic(logic, () => logic.actions.loadProductDataEvents()).toFinishAllListeners()++ expect(logic.values.productStatusBySource.error_tracking).toMatchObject({+ enabled: true,+ dataStatus: 'unavailable',+ })+ })+it('uses only recently seen event definitions as product data', async () => {useMocks({get: {diff --git a/products/signals/frontend/inbox/signalSourcesLogic.ts b/products/signals/frontend/inbox/signalSourcesLogic.tsindex 3605c47b98f5..9ac3c9ff7c32 100644--- a/products/signals/frontend/inbox/signalSourcesLogic.ts+++ b/products/signals/frontend/inbox/signalSourcesLogic.ts@@ -20,13 +20,14 @@ import {engineeringAnalyticsCiSignalsConfigUpdate,} from 'products/engineering_analytics/frontend/generated/api'import type { CISignalsConfigApi } from 'products/engineering_analytics/frontend/generated/api.schemas'+import { errorTrackingIssuesExistsRetrieve } from 'products/error_tracking/frontend/generated/api'import { eventDefinitionsList } from 'products/event_definitions/frontend/generated/api'import { visionScannersList, visionScannersPartialUpdate } from 'products/replay_vision/frontend/generated/api'import type { ReplayScannerApi } from 'products/replay_vision/frontend/generated/api.schemas'import { SignalSourceProduct, SignalSourceType } from 'products/signals/frontend/inbox/types'import { ExternalDataSourceTypeEnumApi } from 'products/warehouse_sources/frontend/generated/api.schemas'-import type { SignalSourceTypeApi } from '../generated/api.schemas'+import type { SignalSourceTypeApi, SignalSourceConfigSourceTypeEnumApi } from '../generated/api.schemas'import type { AgentRosterSource } from './components/config/agentRosterMeta'import {SignalSourceToggleFailureReason,@@ -90,7 +91,7 @@ type WarehouseSourceCompletion =| {kind: 'source_config'sourceProduct: SignalSourceProduct- sourceType: SignalSourceType+ sourceType: SignalSourceConfigSourceTypeEnumApienableErrorMessage: string}| { kind: 'ci_signals_bundle' }@@ -243,6 +244,7 @@ export interface signalSourcesLogicValues {enabledSourcesCount: numberenablingProduct: SourceProductEnablement | nullerrorTrackingConfigs: SignalSourceConfig[]+ errorTrackingHasIssues: boolean | nullerrorTrackingIsFullyEnabled: booleanerrorTrackingTypeStates: {enabled: boolean@@ -270,6 +272,7 @@ export interface signalSourcesLogicValues {productDataEventsFailed: booleanproductDataEventsLoading: booleanproductStatusBySource: Partial<Record<AgentRosterSource, SourceProductStatus>>+ scannerInventoryKnown: booleansourceConfigs: SignalSourceConfig[] | nullsourceConfigsLoadFailed: booleansourceConfigsLoading: boolean@@ -407,6 +410,12 @@ export interface signalSourcesLogicActions {enabled: booleansource: WarehouseBackedSource}+ setErrorTrackingHasIssues: (hasIssues: boolean | null) => {+ hasIssues: boolean | null+ }+ setScannerInventoryKnown: (known: boolean) => {+ known: boolean+ }startDataWarehouseSourceToggle: (source: WarehouseBackedSource) => {source: WarehouseBackedSource}@@ -491,7 +500,8 @@ export interface signalSourcesLogicMeta {currentTeam: TeamPublicType | TeamType | null,productDataEvents: Set<string> | null,productDataEventsLoading: boolean,- productDataEventsFailed: boolean+ productDataEventsFailed: boolean,+ errorTrackingHasIssues: boolean | null) => Partial<Record<AgentRosterSource, SourceProductStatus>>errorTrackingIsFullyEnabled: (sourceConfigs: SignalSourceConfig[] | null) => booleanciSignalsIsFullyEnabled: (ciSignalsConfig: CISignalsConfigApi | null) => boolean@@ -530,6 +540,7 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([})),actions({+ setScannerInventoryKnown: (known: boolean) => ({ known }),openSourcesModal: true,closeSourcesModal: true,initiateDataWarehouseSourceToggle: (source: WarehouseBackedSource) => ({ source }),@@ -557,9 +568,10 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([toggleAnomalyInvestigation: true,enableSourceProduct: (enablement: SourceProductEnablement) => ({ enablement }),enableSourceProductComplete: true,+ setErrorTrackingHasIssues: (hasIssues: boolean | null) => ({ hasIssues }),}),- loaders(({ values }) => ({+ loaders(({ values, actions }) => ({sourceConfigs: [null as SignalSourceConfig[] | null,{@@ -580,11 +592,16 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([null as Set<string> | null,{loadProductDataEvents: async (): Promise<Set<string>> => {- const response = await eventDefinitionsList(String(teamLogic.values.currentTeamId), {- exclude_stale: true,- names: PRODUCT_USAGE_EVENTS,- limit: PRODUCT_USAGE_EVENTS.length,- })+ const projectId = String(ApiConfig.getCurrentProjectId())+ const [response, issues] = await Promise.all([+ eventDefinitionsList(projectId, {+ exclude_stale: true,+ names: PRODUCT_USAGE_EVENTS,+ limit: PRODUCT_USAGE_EVENTS.length,+ }),+ errorTrackingIssuesExistsRetrieve(projectId).catch(() => null),+ ])+ actions.setErrorTrackingHasIssues(issues?.exists ?? null)return new Set(response.results.filter(({ last_seen_at }) => !!last_seen_at).map(({ name }) => name))@@ -605,8 +622,10 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([enabled: 'enabled',limit: ENTITY_PAGE_SIZE,})+ actions.setScannerInventoryKnown(!response.next)return response.results} catch {+ actions.setScannerInventoryKnown(false)// Replay Vision 404s when its flag is off, and this source only ever adds to// the count, so a failure reads as "no scanners" rather than stranding every// consumer of the count on a loading state.@@ -650,6 +669,11 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([})),reducers({+ scannerInventoryKnown: [false, { setScannerInventoryKnown: (_, { known }) => known }],+ errorTrackingHasIssues: [+ null as boolean | null,+ { setErrorTrackingHasIssues: (_, { hasIssues }) => hasIssues },+ ],sourcesModalOpen: [false,{@@ -876,16 +900,23 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([keys.has(`${SignalSourceProduct.Analytics}_${SignalSourceType.AnomalyInvestigation}`),],productStatusBySource: [- (s) => [s.currentTeam, s.productDataEvents, s.productDataEventsLoading, s.productDataEventsFailed],+ (s) => [+ s.currentTeam,+ s.productDataEvents,+ s.productDataEventsLoading,+ s.productDataEventsFailed,+ s.errorTrackingHasIssues,+ ],(currentTeam: TeamPublicType | TeamType | null,productDataEvents: Set<string> | null,productDataEventsLoading: boolean,- productDataEventsFailed: boolean+ productDataEventsFailed: boolean,+ errorTrackingHasIssues: boolean | null): Partial<Record<AgentRosterSource, SourceProductStatus>> => {const team = currentTeam as TeamType | nullconst dataStatus = (...events: string[]): SourceProductDataStatus => {- if (productDataEventsLoading || (productDataEvents === null && !productDataEventsFailed)) {+ if (productDataEvents === null && (productDataEventsLoading || !productDataEventsFailed)) {return 'loading'}if (productDataEventsFailed) {@@ -893,9 +924,17 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([}return events.some((event) => productDataEvents?.has(event)) ? 'recent' : 'none'}- const errorTrackingDataStatus = dataStatus('$exception')+ const exceptionEventStatus = dataStatus('$exception')+ const errorTrackingDataStatus =+ errorTrackingHasIssues && exceptionEventStatus !== 'recent'+ ? 'unavailable'+ : exceptionEventStatus === 'none' && errorTrackingHasIssues === null+ ? 'error'+ : exceptionEventStatusconst errorTrackingEnabled =- team?.autocapture_exceptions_opt_in === true || errorTrackingDataStatus === 'recent'+ team?.autocapture_exceptions_opt_in === true ||+ errorTrackingHasIssues === true ||+ errorTrackingDataStatus === 'recent'? true: team && errorTrackingDataStatus === 'none'? false@@ -911,8 +950,7 @@ export const signalSourcesLogic = kea<signalSourcesLogicType>([return {error_tracking: {productName: 'Error tracking',- // Server SDKs capture exceptions without the autocapture opt-in, so recent- // exception data counts as on.+ // Server SDKs and manually captured exceptions do not require browser autocapture.enabled: errorTrackingEnabled,enablement: 'error_tracking',dataStatus: errorTrackingDataStatus,diff --git a/products/signals/frontend/inbox/utils/autonomyPriorityOptions.ts b/products/signals/frontend/inbox/utils/autonomyPriorityOptions.tsnew file mode 100644index 000000000000..f597651fecf3--- /dev/null+++ b/products/signals/frontend/inbox/utils/autonomyPriorityOptions.ts@@ -0,0 +1,8 @@+import { PRIORITY_THRESHOLD_OPTIONS, SignalReportPriority } from '../types'++const LABELS: Record<SignalReportPriority, string> = { P0: 'P0', P1: 'P1+', P2: 'P2+', P3: 'P3+', P4: 'All' }++export const AUTONOMY_PRIORITY_OPTIONS = PRIORITY_THRESHOLD_OPTIONS.map(({ value }) => ({+ value,+ label: LABELS[value],+}))diff --git a/products/signals/frontend/inbox/utils/inboxSetup.test.ts b/products/signals/frontend/inbox/utils/inboxSetup.test.tsnew file mode 100644index 000000000000..a25f41b7549e--- /dev/null+++ b/products/signals/frontend/inbox/utils/inboxSetup.test.ts@@ -0,0 +1,162 @@+import { mockScoutConfigs, mockScoutSuggestionSet } from '../__mocks__/scoutConfigs'+import type { AgentRosterSource } from '../components/config/agentRosterMeta'+import type { SourceProductStatus } from '../signalSourcesLogic'+import { newInboxSetupDraft, reconcileInboxSetupDraft, setupSources } from './inboxSetup'+import { inboxSetupDefaultScouts, inboxSetupScoutChoices } from './inboxSetupScouts'++describe('Inbox setup defaults', () => {+ it.each(['none', 'loading', 'error'] as const)(+ 'does not enable error tracking when its data is %s',+ (dataStatus) => {+ const sources = setupSources(+ [],+ {+ error_tracking: {+ enabled: true,+ productName: 'Error tracking',+ enablement: 'error_tracking',+ dataStatus,+ },+ },+ 0,+ {},+ false+ )+ expect(newInboxSetupDraft(sources, []).sources).toEqual([])+ }+ )++ it('selects available signals without enabling automatic implementation', () => {+ const sources = setupSources(+ [],+ {+ error_tracking: {+ enabled: true,+ productName: 'Error tracking',+ enablement: 'error_tracking',+ dataStatus: 'recent',+ },+ },+ 1,+ {},+ false+ )+ const draft = newInboxSetupDraft(sources, ['scanner-id'])+ expect(draft.sources).toHaveLength(3)+ expect(draft.sources.every((source) => source.enabled)).toBe(true)+ expect(draft.scanner_ids).toEqual(['scanner-id'])+ expect(draft.automatic_implementation).toBe(false)+ expect(draft.implementation_priority).toBe('P1')+ })++ it('uses connected warehouse sources before a signal config exists, without confusing GitHub code access with issue sync', () => {+ const sources = setupSources([], {}, 0, {}, false, [+ { id: 'linear-source', source_type: 'Linear', schemas: [{ name: 'issues' }] },+ ])+ expect(newInboxSetupDraft(sources, []).sources).toEqual([+ { source_product: 'linear', source_type: 'issue', enabled: true },+ ])+ expect(sources.find((source) => source.definition.source === 'github')?.available).toBe(false)+ expect(sources.some((source) => source.definition.source === 'pganalyze')).toBe(false)+ const missingTables = setupSources([], {}, 0, {}, false, [+ { id: 'github-source', source_type: 'Github', schemas: [] },+ ])+ const github = missingTables.find((source) => source.definition.source === 'github')+ expect(github?.available).toBe(false)+ expect(github?.setupUrl).toContain('github-source')+ expect(newInboxSetupDraft(missingTables, []).sources).toEqual([])+ })++ it.each([+ { available: null, expected: ['retained', 'removed'] },+ { available: ['retained', 'new'], expected: ['retained'] },+ { available: [], expected: [] },+ ])('reconciles selected scanners only after loading: $available', ({ available, expected }) => {+ const draft = newInboxSetupDraft([], ['retained', 'removed'])+ expect(reconcileInboxSetupDraft(draft, [], available).scanner_ids).toEqual(expected)+ expect(reconcileInboxSetupDraft({ ...draft, scanner_ids: [] }, [], available).scanner_ids).toEqual([])+ })++ it('keeps recommendations in place when one is selected', () => {+ const items = mockScoutSuggestionSet().items+ expect(inboxSetupScoutChoices(items, [items[1]])).toEqual(items)+ expect(inboxSetupScoutChoices(items, [items[1], items[0]])).toEqual(items)+ const previouslySelected = { ...items[0], id: 'previously-selected', skill_name: 'previous-scout' }+ expect(inboxSetupScoutChoices(items, [previouslySelected, items[1]])).toEqual([...items, previouslySelected])+ const canonical = { ...items[0], kind: 'canonical' as const }+ const selectedBuiltin = { ...canonical, id: 'builtin:scout-id' }+ expect(inboxSetupScoutChoices([canonical], [selectedBuiltin])).toEqual([selectedBuiltin])+ })++ it('matches built-in scouts to enabled products and connected sources', () => {+ const names = [+ 'general',+ 'product-analytics',+ 'error-tracking',+ 'session-replay',+ 'replay-vision',+ 'ai-observability',+ 'conversations',+ 'data-warehouse',+ 'health-checks',+ ]+ const configs = names.map((name) => ({+ ...mockScoutConfigs[0],+ id: name,+ skill_name: `signals-scout-${name}`,+ enabled: false,+ }))+ const statuses: Partial<Record<AgentRosterSource, SourceProductStatus>> = {+ error_tracking: {+ enabled: true,+ productName: 'Error tracking',+ enablement: 'error_tracking',+ dataStatus: 'none',+ },+ replay_vision: {+ enabled: true,+ productName: 'Session replay',+ enablement: 'session_replay',+ dataStatus: 'unavailable',+ },+ llm_analytics: { enabled: true, productName: 'AI observability', enablement: null, dataStatus: 'recent' },+ conversations: {+ enabled: true,+ productName: 'Support',+ enablement: 'conversations',+ dataStatus: 'unavailable',+ },+ }+ const sources = setupSources([], statuses, 1, {}, true, [+ { id: 'linear-source', source_type: 'Linear', schemas: [{ name: 'issues' }] },+ ])+ expect(inboxSetupDefaultScouts(configs, sources, true, statuses).map((scout) => scout.skill_name)).toEqual(+ names.map((name) => `signals-scout-${name}`)+ )+ expect(inboxSetupDefaultScouts(configs, [], false).map((scout) => scout.skill_name)).toEqual([+ 'signals-scout-general',+ ])+ expect(inboxSetupDefaultScouts([], sources, true)).toEqual([])+ const withoutScanners = setupSources([], statuses, 0, {}, false)+ const replayChoices = inboxSetupDefaultScouts(configs, withoutScanners, false, statuses).map(+ (scout) => scout.skill_name+ )+ expect(replayChoices).toContain('signals-scout-session-replay')+ expect(replayChoices).not.toContain('signals-scout-replay-vision')+ })++ it.each([+ { enabled: true },+ { lifecycle_locked: true },+ { scout_origin: 'custom' as const },+ { deprecation: { phase: 'announced' as const, reason: 'Retiring', superseded_by: '', sunset_at: null } },+ ])('does not recommend unavailable canonical configs: %j', (overrides) => {+ const config = {+ ...mockScoutConfigs[0],+ skill_name: 'signals-scout-product-analytics',+ enabled: false,+ ...overrides,+ }+ expect(inboxSetupDefaultScouts([config], [], true)).toEqual([])+ })+})diff --git a/products/signals/frontend/inbox/utils/inboxSetup.ts b/products/signals/frontend/inbox/utils/inboxSetup.tsnew file mode 100644index 000000000000..6c4bafc6e92a--- /dev/null+++ b/products/signals/frontend/inbox/utils/inboxSetup.ts@@ -0,0 +1,150 @@+import { urls } from 'scenes/urls'++import type {+ ExternalDataSourceSerializersApi,+ ExternalDataSchemaApi,+} from 'products/warehouse_sources/frontend/generated/api.schemas'++import type { InboxOnboardingDraftApi, InboxOnboardingSourceApi } from '../../generated/api.schemas'+import { AGENT_ROSTER_GROUPS, AgentRosterDefinition } from '../components/config/agentRosterMeta'+import { WAREHOUSE_SOURCE_SETUP, type SourceProductStatus, type WarehouseBackedSource } from '../signalSourcesLogic'+import { SignalSourceProduct, SignalSourceType, type SignalSourceConfig } from '../types'++export interface InboxSetupSource {+ definition: AgentRosterDefinition+ sources: InboxOnboardingSourceApi[]+ available: boolean+ unavailableReason: string+ warehouseSource: WarehouseBackedSource | null+ setupUrl: string | null+}++interface InboxSetupWarehouseSource extends Pick<ExternalDataSourceSerializersApi, 'id' | 'source_type'> {+ schemas?: readonly Pick<ExternalDataSchemaApi, 'name'>[]+}++const SOURCE_TYPES: Partial<Record<string, InboxOnboardingSourceApi['source_type'][]>> = {+ error_tracking: [SignalSourceType.IssueCreated, SignalSourceType.IssueReopened, SignalSourceType.IssueSpiking],+ conversations: [SignalSourceType.Ticket],+ llm_analytics: [SignalSourceType.EvaluationReport],+ analytics: [SignalSourceType.AnomalyInvestigation],+ health_checks: [SignalSourceType.HealthIssue],+ engineering_analytics: [+ SignalSourceType.CiFlakyCheck,+ SignalSourceType.CiBrokenDefaultBranch,+ SignalSourceType.CiDurationRegression,+ ],+}++export function setupSources(+ configs: SignalSourceConfig[],+ statuses: Partial<Record<string, SourceProductStatus>>,+ scannerCount: number,+ flags: Record<string, boolean | string | undefined>,+ hasEvents: boolean,+ warehouseSources: readonly InboxSetupWarehouseSource[] | null = null+): InboxSetupSource[] {+ return AGENT_ROSTER_GROUPS.flatMap((group) => group.agents)+ .filter(+ (definition) =>+ !definition.legacy && definition.source !== 'pganalyze' && (!definition.flag || flags[definition.flag])+ )+ .map((definition) => {+ const existing = configs.filter((config) => config.source_product === definition.sourceProduct)+ const status = statuses[definition.source]+ const warehouseSource = Object.hasOwn(WAREHOUSE_SOURCE_SETUP, definition.source)+ ? (definition.source as WarehouseBackedSource)+ : null+ const warehouseSetup = warehouseSource ? WAREHOUSE_SOURCE_SETUP[warehouseSource] : null+ const connectedSources =+ warehouseSources?.filter((source) => source.source_type === warehouseSetup?.dwSourceType) ?? []+ const hasRequiredTables =+ !!warehouseSetup &&+ warehouseSetup.requiredTables.every((table) =>+ connectedSources.some((source) =>+ source.schemas?.some((schema) => schema.name === table || schema.name.endsWith(`.${table}`))+ )+ )+ const setupUrl =+ connectedSources.length && !hasRequiredTables+ ? urls.dataWarehouseSource(connectedSources[0].id, 'schemas')+ : null+ const available =+ definition.source === 'replay_vision'+ ? scannerCount > 0+ : warehouseSetup && warehouseSources !== null+ ? hasRequiredTables+ : definition.source === 'health_checks'+ ? hasEvents+ : status+ ? status.enabled === true &&+ (status.dataStatus === 'recent' || status.dataStatus === 'unavailable')+ : existing.length > 0+ const types =+ SOURCE_TYPES[definition.source] ??+ (warehouseSetup?.completion.kind === 'source_config'+ ? [warehouseSetup.completion.sourceType]+ : existing.map((config) => config.source_type as InboxOnboardingSourceApi['source_type']))+ return {+ definition,+ warehouseSource,+ setupUrl,+ available: available && (types.length > 0 || definition.source === 'replay_vision'),+ unavailableReason: setupUrl+ ? 'Needs tables'+ : status?.dataStatus === 'error'+ ? 'Could not check data'+ : definition.source === 'replay_vision' && status?.enabled+ ? 'No scanners'+ : status?.enabled === false+ ? 'Not enabled'+ : status+ ? 'No recent data'+ : definition.source === 'health_checks'+ ? 'No data yet'+ : 'Not connected',+ sources: types.map((source_type) => ({+ source_product: definition.sourceProduct,+ source_type,+ enabled: true,+ })),+ }+ })+}++export function newInboxSetupDraft(sources: InboxSetupSource[], scannerIds: string[]): InboxOnboardingDraftApi {+ return {+ step: 'signals',+ sources: sources.filter((source) => source.available).flatMap((source) => source.sources),+ scanner_ids: scannerIds,+ suggestions: [],++ automatic_implementation: false,+ implementation_priority: 'P1',+ }+}++export function reconcileInboxSetupDraft(+ draft: InboxOnboardingDraftApi,+ sources: InboxSetupSource[],+ scannerIds: string[] | null = null+): InboxOnboardingDraftApi {+ const chosenProducts = new Set(draft.sources.map((source) => source.source_product))+ const newSources = sources+ .filter((source) => source.available && !chosenProducts.has(source.definition.sourceProduct))+ .flatMap((source) => source.sources)+ const availableScanners = scannerIds === null ? null : new Set(scannerIds)+ const selectedScanners = availableScanners+ ? draft.scanner_ids.filter((id) => availableScanners.has(id))+ : draft.scanner_ids+ return newSources.length || selectedScanners.length !== draft.scanner_ids.length+ ? { ...draft, sources: [...draft.sources, ...newSources], scanner_ids: selectedScanners }+ : draft+}++export function selectedSourceCount(draft: InboxOnboardingDraftApi): number {+ return new Set([+ ...draft.sources.filter((source) => source.enabled).map((source) => source.source_product),+ ...(draft.scanner_ids.length ? [SignalSourceProduct.ReplayVision] : []),+ ]).size+}diff --git a/products/signals/frontend/inbox/utils/inboxSetupScouts.ts b/products/signals/frontend/inbox/utils/inboxSetupScouts.tsnew file mode 100644index 000000000000..e7b3a1c44d1a--- /dev/null+++ b/products/signals/frontend/inbox/utils/inboxSetupScouts.ts@@ -0,0 +1,142 @@+import type { ScoutSuggestionItemApi, SignalScoutConfigApi } from '../../generated/api.schemas'+import type { AgentRosterSource } from '../components/config/agentRosterMeta'+import type { SourceProductStatus } from '../signalSourcesLogic'+import type { InboxSetupSource } from './inboxSetup'++interface StarterScout {+ name: string+ source: AgentRosterSource | 'session_replay' | 'data_warehouse' | 'general'+ title: string+ description: string+}++const STARTER_SCOUTS: StarterScout[] = [+ {+ name: 'signals-scout-general',+ source: 'general',+ title: 'General scout',+ description:+ 'Explore available project data, connect patterns across products, and investigate what needs attention.',+ },+ {+ name: 'signals-scout-product-analytics',+ source: 'analytics',+ title: 'Monitor funnel drop-offs',+ description: 'Investigate changes in funnel conversion, retention, and how customers use your product.',+ },+ {+ name: 'signals-scout-error-tracking',+ source: 'error_tracking',+ title: 'Investigate recurring errors',+ description: 'Look for error patterns, regressions, and groups of failures affecting customers.',+ },+ {+ name: 'signals-scout-session-replay',+ source: 'session_replay',+ title: 'Find friction in session recordings',+ description: 'Watch for recording gaps, rage clicks, dead clicks, and recurring usability problems.',+ },+ {+ name: 'signals-scout-replay-vision',+ source: 'replay_vision',+ title: 'Monitor usability problems',+ description: 'Follow recurring themes and changes found by your Replay Vision scanners.',+ },+ {+ name: 'signals-scout-ai-observability',+ source: 'llm_analytics',+ title: 'Monitor AI cost and reliability',+ description: 'Investigate changes in LLM costs, latency, errors, and output quality.',+ },+ {+ name: 'signals-scout-conversations',+ source: 'conversations',+ title: 'Monitor support response times',+ description: 'Look for slow first responses, growing backlogs, and missed support targets.',+ },+ {+ name: 'signals-scout-data-warehouse',+ source: 'data_warehouse',+ title: 'Monitor connected data sources',+ description: 'Watch warehouse imports for failed syncs, stale tables, and unexpected drops in data volume.',+ },+ {+ name: 'signals-scout-health-checks',+ source: 'health_checks',+ title: 'Investigate setup health issues',+ description: 'Group related health checks and identify the setup problems worth fixing.',+ },+]++export function inboxSetupDefaultScouts(+ configs: SignalScoutConfigApi[],+ sources: InboxSetupSource[],+ hasEvents: boolean,+ statuses: Partial<Record<AgentRosterSource, SourceProductStatus>> = {}+): ScoutSuggestionItemApi[] {+ return STARTER_SCOUTS.flatMap((starter) => {+ const config = configs.find(+ (item) =>+ item.skill_name === starter.name &&+ item.scout_origin === 'canonical' &&+ !item.enabled &&+ !item.deprecation &&+ !item.lifecycle_locked+ )+ const hasData =+ starter.source === 'general'+ ? true+ : starter.source === 'analytics'+ ? hasEvents+ : starter.source === 'session_replay'+ ? statuses.replay_vision?.enabled === true+ : starter.source === 'data_warehouse'+ ? sources.some((source) => source.warehouseSource && source.available)+ : sources.some(+ (source) =>+ source.definition.source === starter.source &&+ (source.available ||+ (starter.source !== 'replay_vision' &&+ statuses[starter.source]?.enabled === true &&+ statuses[starter.source]?.enablement != null))+ )+ if (!config || !hasData) {+ return []+ }+ return [+ {+ id: `builtin:${config.id}`,+ kind: 'canonical' as const,+ skill_name: config.skill_name,+ title: starter.title,+ why_here: starter.description,+ description: '',+ draft_body: '',+ proposed_config: {+ run_interval_minutes: config.run_interval_minutes ?? 1440,+ run_cron_schedule: config.run_cron_schedule,+ emit: true,+ },+ gap: true,+ confidence: 'medium' as const,+ },+ ]+ })+}++export function inboxSetupScoutChoices(+ suggestions: ScoutSuggestionItemApi[],+ selected: ScoutSuggestionItemApi[]+): ScoutSuggestionItemApi[] {+ const choices = suggestions.map(+ (suggestion) =>+ selected.find(+ (item) =>+ item.id === suggestion.id ||+ (item.kind === 'canonical' &&+ suggestion.kind === 'canonical' &&+ item.skill_name === suggestion.skill_name)+ ) ?? suggestion+ )+ return [...choices, ...selected.filter((item) => !choices.some((choice) => choice.id === item.id))]+}