: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 self-driving onboarding takeover and banner (#65429)
Michael Matlokaad106c025185
diff --git a/frontend/public/sounds/meep.mp3 b/frontend/public/sounds/meep.mp3new file mode 100644index 000000000000..fd7b4cf7e0afBinary files /dev/null and b/frontend/public/sounds/meep.mp3 differdiff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex fa3ef004d5ff..9b6632ad4920 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -5453,17 +5453,17 @@ snapshots:scenes-app-inbox-cards--agent-run-cards--light:hash: v1.k794b7964.4fced4761948504f507f7c797cca06f09b9384dc13e053f3af5c893e7c0cd2d2.J1aM-6ZJAZvKQnV4Zd93kTJUK9pMEQYYWijc25ewVbQscenes-app-inbox-cards--pull-request-cards--dark:- hash: v1.k794b7964.497e11ffa4bd37a28f23346c9de83855be14498a84152fde99f9c9d78cb0ee79.5Ekzd1b8rnOBxbnBX-gSRgF3J7nMRnZi7hG-3Q25c4k+ hash: v1.k794b7964.6c910721b62a91dedc74f54618cd91772d8ce8a86f2ae30964016b5da00cc536.j5V0OesEhQkbrgynTg-77qUvSh-A-fhexpUuzP7jqyUscenes-app-inbox-cards--pull-request-cards--light:- hash: v1.k794b7964.3fc2e2866feb9be1b05c7a17a8e7165d321f2694f4639805c7e74083b4aa14f7.RfSfQmQWBF48GY1wDF76z-hN09r3Fwz4bSG6GFqNseo+ hash: v1.k794b7964.edd43eae334c61222b1a116740a56cd5d2b1f19cdb6b9f4c5dfef43d7c115d07.lZ8XUEK-3314NrURHGlocim4owCaLOL8k9-AxSwAopwscenes-app-inbox-cards--report-card-states--dark:- hash: v1.k794b7964.ad2381f9f853e117fc1bb32a5b52df82fa140887429d40cfe47f0af571dea8ff.IixA--QW9BdKnE0eKsnR9sKwcW63o5KNIOmyrTnFO5U+ hash: v1.k794b7964.5918680705ef5859b6924c8ec948aa3f7c111feaa53c1b3f35ab8f805ef6fa4f.9iv7kwrFSC_htm2KBGr_QLbMONU1prYoghfPyWnzn_4scenes-app-inbox-cards--report-card-states--light:- hash: v1.k794b7964.d49cbf402191824c2177369beb09f95cd19cb50234196c536fe42214f894c0ff.-d2_s6pz-ytJ7BfzqPnUE41Lo6ppPbi7bSvLyYz3-pA+ hash: v1.k794b7964.27185fda8647396443bef0605ec67b47fda0f33e62ddf159f2d6defe0e410a14.rDUPHd6M6uakdvF6jFPGzLlntKjW1CJq8bHwx5yeTNgscenes-app-inbox-cards--report-cards--dark:- hash: v1.k794b7964.461ca058bc8d0c7d0018f9a7b87f41839f000676d1e6cdce81473f1ad2170da7.6u6Cm_0P6wvoQdO5yIVGdKtWj7PCXYmT2xsvTulynRE+ hash: v1.k794b7964.a47698a08ae6beead235b3ba717638c2f1582b6ee8a6ec96373ed75bdfb5ec5b.wECZPpvIC0f8M7qNtbopZ_SmhydKnycJmU-4dQfFl2Ascenes-app-inbox-cards--report-cards--light:- hash: v1.k794b7964.2e3e0099408744c0b80b0884f23ac8d7e1a6e19da5eed2c8b74282bbb94ceef6.SPXO5NaPdNI7nzYMxGjSjrVzX5lXA19lYGq5voBMoww+ hash: v1.k794b7964.fb1563b17b289c6b13590c6b58bba2e5c5c4387c28f1b5af1fe4e2c438856722.RNUvuvZLpAQ8rZBuzAHVwR6NR2aSEzYQnG0MIGlXedwscenes-app-inbox-cards--skeleton--dark:hash: v1.k794b7964.4ab1f8cb97f347a2aae442ca814c70c538c54e4a9efb1c3cdd6681a56cad5e90.wVmcanELl0wz7-rhcnN8K5MGXmKMMxXELkYcCEpCxKsscenes-app-inbox-cards--skeleton--light:@@ -5493,25 +5493,33 @@ snapshots:scenes-app-inbox-detail--run-ready--light:hash: v1.k794b7964.ab7dd7badc02bcaab9fbcfaddb17930eaa8abf9f1936571441296cb9e8cb246f.iZzPaulpiIzqj0r1tcargjZMm5DOxqA3eca-zhEtW84scenes-app-inbox-scene--empty--dark:- hash: v1.k794b7964.5e028d969ab0fde2b308bbc3bbc78ef671a5892454486d07739b43dd9a11fe2f.-cAwhDDmKAi9Ps2rzFpfUBl7Dc5RaHFxzLfHDR2XJRo+ hash: v1.k794b7964.dcea4918fc6eb13da632805e3f984217d42b0d190cc3e2cd78932b13fbaf2864.XyfvI_WWQc5huS6qi4k66rQebEt_KTOQixgRNcKHRZcscenes-app-inbox-scene--empty--light:- hash: v1.k794b7964.9e7ec94a31e2f894d70eec79f0747b51ae66f97fddd11a9cafbaf4570ad58d0f.vNN8ruYbbKTfj_3Do3q7R_XvQJfilsTZl8cL8YDJaM0+ hash: v1.k794b7964.792c574a3d7f61c29963b16cdaaedaed29b6c3e5cad1d8db0dc04b60a9a073b7.1XlxAgtsKl4zDWyyglqhdPApeyTP29yezAiMR75GiRsscenes-app-inbox-scene--inbox--dark:- hash: v1.k794b7964.7ac4cd509a3cc40957183200e2055e8ee10fa7ebb4638b886edec47956f3d69a.Kue4fX-RZ4gJowrkDXGSM_LvrLNTzeG98HLiXWgyf84+ hash: v1.k794b7964.eae93d2c506e66eb23f36e19f05bf6f07286d9a895dbad8f970c009fd98f1d53.AqLzv_So4UaxCTEYyb-ZB24M8Z4KF2Zq8PyO-8FDfosscenes-app-inbox-scene--inbox--light:- hash: v1.k794b7964.40c4ef842c1ebc1de3a430e65869f66fb2ccd2179b3d7c541cfb208e099ccf02.Ffm7PLvZFi-gwk-7K27Mt9jVWJtoI30KpIguGNhVhJU+ hash: v1.k794b7964.f9b5a6f1ecd482963d9850ced2d07c1ea729d2d63be8679db907709e5a6fde89.kWZ_EUm4zZwm068_9nLGo5dWzvu78oVbcMTHqOHOEcY+ scenes-app-inbox-scene--self-driving-onboarding--dark:+ hash: v1.k794b7964.dcea4918fc6eb13da632805e3f984217d42b0d190cc3e2cd78932b13fbaf2864.vI-KFL7Y13sO7lTuGaMzcdiZy3_SMl-3gBaFvGCrTq8+ scenes-app-inbox-scene--self-driving-onboarding--light:+ hash: v1.k794b7964.f63cb2dbe95deadfc259399fb53119b0ed992b5ad0e7dc07838c4be773b72a65.CUNHNlCtLNlZF1JmEUMUEy1ZyBGIPpjeOnFPz-rg1wY+ scenes-app-inbox-scene--self-driving-paused--dark:+ hash: v1.k794b7964.eae93d2c506e66eb23f36e19f05bf6f07286d9a895dbad8f970c009fd98f1d53.7hksyy3ldoFdJY9rpLYMe7FNYuMAi-U1Vlh3OGhv3wY+ scenes-app-inbox-scene--self-driving-paused--light:+ hash: v1.k794b7964.f9b5a6f1ecd482963d9850ced2d07c1ea729d2d63be8679db907709e5a6fde89.upcV4EokxFjnADvyUmiBiIp7UTjShqKZHDv2EKVV6HMscenes-app-inbox-tabs--pull-requests--dark:- hash: v1.k794b7964.1b389684f50110e0a29fcd8fe1627f5c1184e6a140c68996c2fccbd782309aa0.hp1HJMSMvnHyIAUvhfTXZOnOF4nKOkr5gskBs10efeE+ hash: v1.k794b7964.2eca881c5c5611bb0fe54188f74652897fec431ea1520db0318a3879ec27130c.oLFR4bQxt-ZvTWUbNWiEzp77LmoZzhdcez_af_uUEawscenes-app-inbox-tabs--pull-requests--light:- hash: v1.k794b7964.6a4e11dc09866839a0cc528c1cb657cbeaaefb6998abc54ef01ded88f62442af.smueUB8lJNSe1Q9fQQGITnVq28dYzrK8tU9nBQhpg3E+ hash: v1.k794b7964.632aab4de9cb18ff597a8682dd0e8c18e9bf998f4182e87d51504b4da402939c.AMKsEcESbmhTBPwqC8bM91E0dKfv3grLtCPO96R-6_oscenes-app-inbox-tabs--pull-requests-empty--dark:hash: v1.k794b7964.46c7e27bcf7c8eeff940cd1ba52c379fa29c6fd26efa8e5511ce6fae0ebb97f2.LxZ71depKylIFoMgKmsEJGRnkU8SZ7UIOrqU_wn8QQYscenes-app-inbox-tabs--pull-requests-empty--light:hash: v1.k794b7964.167de2b957533bcc5780f9ddac38b19a4d4892d6fcbb92e985b9a71d8c3fd7d4.rpDhhtvsIxoxhtaVy23_PS6KE1PyvOtTjeh-GlVvaq8scenes-app-inbox-tabs--reports--dark:- hash: v1.k794b7964.701a0ceda712f1d8d834db294d2eff1ebccd88f443d9c8b92d4ab6c6ab8c5ede.Um1YVrlAZdV8TV_L82dVeAn7OlD6VB8kTqTxD5kAXlY+ hash: v1.k794b7964.32f343cb491d531f7d372709d963bed63b86fb2e48d344aaf03071311b470970.9OnV2RodRDxAS2qQ0MSo5NEEUIaXnovzjRSZ1hrk5ssscenes-app-inbox-tabs--reports--light:- hash: v1.k794b7964.79457871f1c2a6ddcde75f12bf5f3a669bda1f8adfaefc0dc7449a62899b04dc.UKqUPy4FmQy51-lzVRQK9w7-iPnUVr9LD6FMsDVxk34+ hash: v1.k794b7964.e6f65ea9a96eaf3f3c696a4e59c24df35703951113e588e2c7ff80ebe8fef792.VUS7SPVjs3icWdFx-VePID_zbUkqKwfclso_dYE9NQsscenes-app-inbox-tabs--reports-empty--dark:hash: v1.k794b7964.c3c5ebc57b2f0370c61ca952ce372725898e6242c8c938be810948012c97b49f.1uja5-2bTIAszcF7RaIDcEIAcf3lctJMAzJEuNGWMdQscenes-app-inbox-tabs--reports-empty--light:diff --git a/frontend/src/lib/brand/JumpingLogomark.tsx b/frontend/src/lib/brand/JumpingLogomark.tsxnew file mode 100644index 000000000000..94ce1a703342--- /dev/null+++ b/frontend/src/lib/brand/JumpingLogomark.tsx@@ -0,0 +1,45 @@+import { useState } from 'react'++import { cn } from 'lib/utils/css-classes'++import { Logomark } from './Logomark'++const LOGOMARK_AIRTIME_MS = 400 // Sync with --logomark-airtime in base.scss++interface LogomarkJumpCSSProperties extends React.CSSProperties {+ '--logomark-jump-magnitude': number+}++/**+ * The PostHog logomark that springs up when clicked – rapid repeat clicks escalate the jump. Used as+ * the playful mascot in the PostHog AI (Max) intro and the Inbox self-driving onboarding.+ */+export function JumpingLogomark({ className }: { className?: string }): JSX.Element {+ const [lastJumped, setLastJumped] = useState<number | null>(() => Date.now())+ const [jumpIteration, setJumpIteration] = useState(0)++ const handleClick = (): void => {+ const now = Date.now()+ if (lastJumped && now - lastJumped < LOGOMARK_AIRTIME_MS) {+ return // Don't interrupt an in-flight jump.+ }+ setJumpIteration(jumpIteration + 1)+ setLastJumped(null)+ requestAnimationFrame(() => setLastJumped(now))+ }++ return (+ <div+ className={cn('cursor-pointer select-none', lastJumped && 'animate-logomark-jump', className)}+ // eslint-disable-next-line react/forbid-dom-props+ style={+ {+ '--logomark-jump-magnitude': jumpIteration ? 1.5 ** ((jumpIteration % 8) - 2) : 1,+ } as LogomarkJumpCSSProperties+ }+ onClick={handleClick}+ >+ <Logomark />+ </div>+ )+}diff --git a/frontend/src/lib/components/CommandBlock/CommandBlock.scss b/frontend/src/lib/components/CommandBlock/CommandBlock.scssindex 6f1761b5f717..3a8b45c7ffa5 100644--- a/frontend/src/lib/components/CommandBlock/CommandBlock.scss+++ b/frontend/src/lib/components/CommandBlock/CommandBlock.scss@@ -11,10 +11,6 @@animation: CommandBlock-flash 1500ms ease-out forwards;}-.CommandBlock__bounce {- animation: CommandBlock-bounce 400ms ease-out;-}-/* stylelint-disable-next-line keyframes-name-pattern */@keyframes CommandBlock-flash {0%,@@ -26,26 +22,3 @@opacity: 0;}}--/* stylelint-disable-next-line keyframes-name-pattern */-@keyframes CommandBlock-bounce {- 0% {- transform: scale(1);- }-- 15% {- transform: scale(0.96);- }-- 40% {- transform: scale(1.03);- }-- 70% {- transform: scale(0.99);- }-- 100% {- transform: scale(1);- }-}diff --git a/frontend/src/lib/components/CommandBlock/CommandBlock.tsx b/frontend/src/lib/components/CommandBlock/CommandBlock.tsxindex 8c93b6171027..f1514eab700c 100644--- a/frontend/src/lib/components/CommandBlock/CommandBlock.tsx+++ b/frontend/src/lib/components/CommandBlock/CommandBlock.tsx@@ -1,6 +1,6 @@import './CommandBlock.scss'-import { useState } from 'react'+import { useRef, useState } from 'react'import { IconCopy, IconTerminal } from '@posthog/icons'@@ -16,6 +16,16 @@ const SIZE_STYLES: Record<Size, { padding: string; font: string; icon: string }>md: { padding: 'px-4 py-3', font: 'text-sm', icon: 'size-4' },}+// A gentle squish-and-settle on copy. Played via the Web Animations API rather than by+// remounting the button (a remount would also restart the rainbow gradient scroll on the+// command text, making it visibly jump back to the start on every click).+const BOUNCE_KEYFRAMES: Keyframe[] = [+ { transform: 'scale(1)' },+ { transform: 'scale(0.985)', offset: 0.35 },+ { transform: 'scale(1.008)', offset: 0.7 },+ { transform: 'scale(1)' },+]+interface CommandBlockProps {command: string/** Label passed to the copy-to-clipboard toast (e.g. "MCP install command"). */@@ -47,6 +57,7 @@ export function CommandBlock({silentCopy = false,}: CommandBlockProps): JSX.Element {const [copyKey, setCopyKey] = useState(0)+ const buttonRef = useRef<HTMLButtonElement>(null)const sizeStyle = SIZE_STYLES[size]const isStorybook = inStorybook() || inStorybookTestRunner()@@ -54,18 +65,23 @@ export function CommandBlock({void copyToClipboard(command, copyLabel, { silent: silentCopy })const next = copyKey + 1setCopyKey(next)+ // WAAPI (not a CSS-class remount) so the bounce replays without resetting the rainbow scroll.+ // Guarded for jsdom, which doesn't implement `Element.animate`.+ const button = buttonRef.current+ if (button && typeof button.animate === 'function') {+ button.animate(BOUNCE_KEYFRAMES, { duration: 320, easing: 'ease-out' })+ }onCopy?.(next)}return (<button+ ref={buttonRef}onClick={handleCopy}- key={`cmd-${copyKey}`}className={cn('group inline-flex items-center gap-2 font-mono rounded-lg cursor-pointer transition-colors w-fit',sizeStyle.font,sizeStyle.padding,- copyKey > 0 && 'CommandBlock__bounce',className)}type="button"diff --git a/frontend/src/lib/lemon-ui/LemonTabs/LemonTabs.scss b/frontend/src/lib/lemon-ui/LemonTabs/LemonTabs.scssindex 72942c2598a1..c9b23e790c69 100644--- a/frontend/src/lib/lemon-ui/LemonTabs/LemonTabs.scss+++ b/frontend/src/lib/lemon-ui/LemonTabs/LemonTabs.scss@@ -86,6 +86,20 @@color: var(--color-text-primary);}+ &.LemonTabs__tab--disabled {+ color: var(--color-text-tertiary);+ opacity: 0.5;++ &:hover,+ &:active {+ color: var(--color-text-tertiary);+ }++ .LemonTabs__tab-content {+ cursor: not-allowed;+ }+ }+&.LemonTabs__tab--active {color: var(--color-accent);text-shadow: 0 0 0.25px currentColor; // Simulate increased weight without affecting widthdiff --git a/frontend/src/lib/lemon-ui/LemonTabs/LemonTabs.tsx b/frontend/src/lib/lemon-ui/LemonTabs/LemonTabs.tsxindex 904d0e72a04d..e3ec827d5fa4 100644--- a/frontend/src/lib/lemon-ui/LemonTabs/LemonTabs.tsx+++ b/frontend/src/lib/lemon-ui/LemonTabs/LemonTabs.tsx@@ -13,6 +13,8 @@ export interface AbstractLemonTab<T extends string | number> {key: Tlabel: string | JSX.Elementtooltip?: string | JSX.Element+ /** When set, the tab is shown but greyed out and not selectable; the reason is its tooltip. */+ disabledReason?: string/** URL of the tab if it can be linked to (which is usually a good practice). */link?: stringtooltipDocLink?: string@@ -96,6 +98,7 @@ export function LemonTabs<T extends string | number>({})}>{realTabs.map((tab) => {+ const disabled = !!tab.disabledReasonconst content = (<div className="relative flex items-center gap-1" data-attr={tab['data-attr']}>{tab.label}@@ -111,19 +114,24 @@ export function LemonTabs<T extends string | number>({return (<Tooltipkey={tab.key}- title={tab.tooltip}+ title={tab.disabledReason || tab.tooltip}placement="top"offset={0}docLink={tab.tooltipDocLink}><li- className={cn('LemonTabs__tab', tab.key === activeKey && 'LemonTabs__tab--active')}- onClick={onChange ? () => onChange(tab.key) : undefined}+ className={cn(+ 'LemonTabs__tab',+ tab.key === activeKey && 'LemonTabs__tab--active',+ disabled && 'LemonTabs__tab--disabled'+ )}+ onClick={onChange && !disabled ? () => onChange(tab.key) : undefined}role="tab"aria-selected={tab.key === activeKey}- tabIndex={0}+ aria-disabled={disabled || undefined}+ tabIndex={disabled ? -1 : 0}onKeyDown={- onChange+ onChange && !disabled? (e) => {if (e.key === 'Enter') {onChange(tab.key)diff --git a/frontend/src/scenes/inbox/InboxScene.stories.tsx b/frontend/src/scenes/inbox/InboxScene.stories.tsxindex 2c22b5916fac..5605ce3694b7 100644--- a/frontend/src/scenes/inbox/InboxScene.stories.tsx+++ b/frontend/src/scenes/inbox/InboxScene.stories.tsx@@ -33,6 +33,8 @@ const sceneMocks = mswDecorator({],'/api/projects/:id/tasks/:taskId': (req) => [200, mockTask(req.params.taskId as string)],'/api/projects/:id/signals/source_configs': () => [200, mockSourceConfigs],+ '/api/projects/:id/signals/scout/configs': () => [200, []],+ '/api/projects/:id/signals/scout/runs': () => [200, []],'/api/projects/:id/external_data_sources': () => [200, { results: [], count: 0 }],'/api/projects/:id/external_data_sources/': () => [200, { results: [], count: 0 }],},@@ -56,12 +58,45 @@ type Story = StoryObjexport const Inbox: Story = {}+// Set up (sources enabled) but no reports yet – exercises the empty list states.export const Empty: Story = {decorators: [mswDecorator({get: {'/api/projects/:id/signals/reports': () => [200, { results: [], count: 0, next: null, previous: null }],+ '/api/projects/:id/signals/source_configs': () => [200, mockSourceConfigs],+ '/api/projects/:id/signals/scout/configs': () => [200, []],+ },+ }),+ ],+}++// Fresh project: nothing watching and nothing in the inbox → the single-command takeover.+export const SelfDrivingOnboarding: Story = {+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:id/signals/reports': () => [200, { results: [], count: 0, next: null, previous: null }],+ '/api/projects/:id/signals/source_configs': () => [200, { results: [], count: 0 }],+ '/api/projects/:id/signals/scout/configs': () => [200, []],+ },+ }),+ ],+}++// Had self-driving before (reports exist) but nothing is watching now → the sleek re-enable banner+// over the normal inbox, so existing work stays accessible. Reports are mocked explicitly (not+// inherited) so "existing work" is unambiguous and the banner – not the takeover – is shown.+export const SelfDrivingPaused: Story = {+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:id/signals/reports': () => [+ 200,+ { results: allReports, count: allReports.length, next: null, previous: null },+ ],'/api/projects/:id/signals/source_configs': () => [200, { results: [], count: 0 }],+ '/api/projects/:id/signals/scout/configs': () => [200, []],},}),],diff --git a/frontend/src/scenes/inbox/InboxScene.tsx b/frontend/src/scenes/inbox/InboxScene.tsxindex 1d6384ce68e6..59dd8475ad0c 100644--- a/frontend/src/scenes/inbox/InboxScene.tsx+++ b/frontend/src/scenes/inbox/InboxScene.tsx@@ -14,6 +14,7 @@ import { ScoutDetailView } from './components/config/scouts/ScoutDetailView'import { AgentRunDetail } from './components/detail/AgentRunDetail'import { InboxDetailHeader } from './components/detail/InboxDetailHeader'import { ReportDetail, ReportDetailSkeleton } from './components/detail/ReportDetail'+import { InboxOnboardingBanner, InboxOnboardingTakeover } from './components/onboarding/InboxOnboarding'import { AgentSetupColumn } from './components/shell/AgentSetupColumn'import { InboxScopeSelect } from './components/shell/InboxScopeSelect'import { InboxTabBar } from './components/shell/InboxTabBar'@@ -23,6 +24,7 @@ import { PullRequestsTab } from './components/tabs/PullRequestsTab'import { ReportsTab } from './components/tabs/ReportsTab'import { RunsTab } from './components/tabs/RunsTab'import { inboxSceneLogic } from './inboxSceneLogic'+import { inboxOnboardingLogic } from './logics/inboxOnboardingLogic'import { InboxTabKey, SignalReport } from './types'export const scene: SceneExport = {@@ -65,11 +67,17 @@ function ActiveTabBody({ tab, runsReports }: { tab: InboxTabKey; runsReports: Si*/function InboxListView(): JSX.Element {const { activeTab, runsTabReports } = useValues(inboxSceneLogic)+ const { onboardingMode } = useValues(inboxOnboardingLogic)const { ref: widthRef, size } = useResizeBreakpoints({ 0: 'narrow', [SETUP_RAIL_MIN_PX]: 'wide' },{ initialSize: 'wide' })- const showRail = size === 'wide'+ const wide = size === 'wide'+ // Self-driving isn't set up and the inbox is empty: the inbox becomes a single locked "Welcome"+ // tab (the other tabs are visible but disabled) whose body is the onboarding card. The setup rail+ // is dropped too, so the onboarding is the whole story – just run the one command.+ const onboarding = onboardingMode === 'takeover'+ const showRail = wide && !onboarding// The rail and the Configuration tab are mutually exclusive – never leave 'config' active// (e.g. via a deep link) while the rail shows, or the rail and a config body would both appear.const effectiveTab = showRail && activeTab === 'config' ? 'pulls' : activeTab@@ -79,15 +87,19 @@ function InboxListView(): JSX.Element {<div className="flex flex-col min-h-0 flex-1 min-w-0">{/* pl-5 (20px) aligns the first tab label with the SceneTitleSection description above. */}<div className="flex items-end justify-between gap-2 border-b border-primary pl-5 pr-2 shrink-0">- <InboxTabBar showConfigTab={!showRail} />- {isReportListTab(effectiveTab) && (+ <InboxTabBar showConfigTab={!wide} onboarding={onboarding} />+ {!onboarding && isReportListTab(effectiveTab) && (<div className="pb-1.5"><InboxScopeSelect /></div>)}</div><div className="flex-1 overflow-auto min-h-0">- <ActiveTabBody tab={effectiveTab} runsReports={runsTabReports} />+ {onboarding ? (+ <InboxOnboardingTakeover />+ ) : (+ <ActiveTabBody tab={effectiveTab} runsReports={runsTabReports} />+ )}</div></div>{showRail && (@@ -132,6 +144,7 @@ export function InboxScene(): JSX.Element {selectedScoutSkillName,} = useValues(inboxSceneLogic)const { runSessionAnalysis } = useActions(inboxSceneLogic)+ const { onboardingMode } = useValues(inboxOnboardingLogic)const { isDev } = useValues(preflightLogic)// Detail routes (report or scout) render full-width over the list (desktop parity), but the list view@@ -142,10 +155,12 @@ export function InboxScene(): JSX.Element {return (<SceneContent className="gap-y-0 border-b-0 flex-1 min-h-0">- <div className={showDetail ? 'hidden' : 'flex flex-col gap-y-2 flex-1 min-h-0'}>+ <div className={showDetail ? 'hidden' : 'flex flex-col gap-y-4 flex-1 min-h-0'}><SceneTitleSectionname="Inbox"- description="Work done by your agents – pull requests, reports, and live runs."+ // The takeover's hero carries its own headline + pitch, so the scene description+ // would be redundant there; keep it for the normal/banner states.+ description="Self-driving for your product. Look through work done by PostHog agents – code changes and reports."resourceType={{ type: 'inbox' }}actions={isDev ? (@@ -166,7 +181,11 @@ export function InboxScene(): JSX.Element {}/>- <div className="flex flex-col -mx-4 flex-1 min-h-0">+ <div className="flex flex-col -mx-4 -mt-4 flex-1 min-h-0">+ {/* The inbox always renders (its own list skeleton covers loading). When self-driving+ isn't set up, the list view itself swaps in a locked "Welcome" onboarding tab; the+ banner sits above the otherwise-normal inbox when there's already work to keep. */}+ {onboardingMode === 'banner' && <InboxOnboardingBanner />}<InboxListView /></div></div>diff --git a/frontend/src/scenes/inbox/components/cards/ReportCard.tsx b/frontend/src/scenes/inbox/components/cards/ReportCard.tsxindex efdabdb4cdfd..87927ab75f06 100644--- a/frontend/src/scenes/inbox/components/cards/ReportCard.tsx+++ b/frontend/src/scenes/inbox/components/cards/ReportCard.tsx@@ -200,7 +200,7 @@ export function ReportCard({{/* Pad clear of the absolute PR badge on mobile, where the title spans the full card width. */}<divclassName={clsx(- 'min-w-0 break-words font-semibold text-sm leading-snug',+ 'min-w-0 break-words font-semibold text-sm leading-snug text-balance',hasPr && 'pr-14 @lg:pr-0')}>@@ -211,17 +211,25 @@ export function ReportCard({</div>{headline ? (- <div className={clsx('mt-0.5 min-w-0', !hasPr && !isReady && 'opacity-80')}>- <p className="break-words line-clamp-2 text-xs text-secondary leading-snug m-0">- {headline}- </p>- </div>+ <p+ className={clsx(+ 'min-w-0',+ !hasPr && !isReady && 'opacity-80',+ 'break-words line-clamp-2 text-xs text-secondary leading-snug m-0'+ )}+ >+ {headline}+ </p>) : !hasPr ? (- <div className={clsx('mt-0.5 min-w-0', !isReady && 'opacity-80')}>- <p className="break-words line-clamp-2 text-xs text-tertiary italic leading-snug m-0">- No summary yet – still collecting context.- </p>- </div>+ <p+ className={clsx(+ 'min-w-0',+ !isReady && 'opacity-80',+ 'break-words line-clamp-2 text-xs text-tertiary italic leading-snug m-0'+ )}+ >+ No summary yet – still collecting context.+ </p>) : null}{showMeta ? (diff --git a/frontend/src/scenes/inbox/components/onboarding/InboxOnboarding.scss b/frontend/src/scenes/inbox/components/onboarding/InboxOnboarding.scssnew file mode 100644index 000000000000..f90954514424--- /dev/null+++ b/frontend/src/scenes/inbox/components/onboarding/InboxOnboarding.scss@@ -0,0 +1,24 @@+// Entrance for the onboarding column, which renders in place of the report list as a locked "Welcome"+// tab. A subtle scale + fade so it settles in rather than popping.+.InboxOnboardingTakeover {+ transform-origin: top center;+ animation: InboxOnboardingTakeover__in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;+}++@keyframes InboxOnboardingTakeover__in {+ from {+ opacity: 0;+ transform: scale(0.98);+ }++ to {+ opacity: 1;+ transform: scale(1);+ }+}++@media (prefers-reduced-motion: reduce) {+ .InboxOnboardingTakeover {+ animation: none;+ }+}diff --git a/frontend/src/scenes/inbox/components/onboarding/InboxOnboarding.tsx b/frontend/src/scenes/inbox/components/onboarding/InboxOnboarding.tsxnew file mode 100644index 000000000000..4183d71c2163--- /dev/null+++ b/frontend/src/scenes/inbox/components/onboarding/InboxOnboarding.tsx@@ -0,0 +1,172 @@+import './InboxOnboarding.scss'++import { useActions } from 'kea'++import { IconBolt, IconGithub, IconNotebook, IconPause, IconX } from '@posthog/icons'+import { LemonButton } from '@posthog/lemon-ui'++import { JumpingLogomark } from 'lib/brand/JumpingLogomark'+import { CommandBlock } from 'lib/components/CommandBlock/CommandBlock'++import { inboxOnboardingLogic } from '../../logics/inboxOnboardingLogic'+import { PullRequestPreview, ReportPreview } from './InboxOnboardingPreviews'++/** The one command that sets up self-driving. The whole onboarding orbits this string. */+export const SELF_DRIVING_WIZARD_COMMAND = 'npx -y @posthog/wizard@latest self-driving'++/** What the wizard wires up, shown as a reassuring checklist under the command. */+const WIZARD_SETS_UP: { icon: JSX.Element; label: string }[] = [+ { icon: <IconGithub />, label: 'Connects your GitHub, so agents can open pull requests' },+ { icon: <IconBolt />, label: 'Picks the signal sources and scouts to watch' },+ { icon: <IconNotebook />, label: 'Brings shippable PRs and reports that need input here' },+]++interface Beat {+ label: string+ description: string+ preview: JSX.Element+}++const BEATS: Beat[] = [+ {+ label: 'Pull requests, ready to merge.',+ description:+ 'Agents read your product data and open a PR for anything safe to ship – with the diff, tests, and reviewers already lined up.',+ preview: <PullRequestPreview />,+ },+ {+ label: 'Reports, when it needs your call.',+ description:+ "Not everything is a clean code change. When something needs your judgment, agents file a report with the context and what they'd do – you decide.",+ preview: <ReportPreview />,+ },+]++/**+ * The wizard command as a click-to-copy pill – the single call-to-action of the whole onboarding.+ * 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.+ */+function SelfDrivingCommand({ size = 'md' }: { size?: 'sm' | 'md' }): JSX.Element {+ return (+ <CommandBlock+ command={SELF_DRIVING_WIZARD_COMMAND}+ copyLabel="self-driving setup command"+ ariaLabel="Copy self-driving setup command"+ decoration="rainbow"+ size={size}+ // rounded-md sits one step inside the rounded-lg card/banner it nests in.+ className="!m-0 rounded-md border border-primary bg-surface-secondary hover:border-accent"+ />+ )+}++function Hero(): JSX.Element {+ return (+ <div className="flex flex-col items-start gap-3">+ <JumpingLogomark className="w-fit [&_svg]:h-7 [&_svg]:w-auto" />+ <h1 className="m-0 text-2xl font-bold leading-tight tracking-tight sm:text-3xl">+ Put your product on self-driving+ </h1>+ <p className="m-0 max-w-prose text-sm text-secondary leading-relaxed">+ <strong>Scouts and Signal Sources identify product issues and opportunities</strong>. Bugs in error+ tracking, users expressing their needs in Slack, and more.+ <br />+ <strong>PostHog then ships quality PRs for you to merge.</strong> Prioritized by impact, assigned to+ relevant team members. <u>The work lands right here in your Inbox.</u>+ </p>+ </div>+ )+}++function CommandCard(): JSX.Element {+ return (+ <div className="flex flex-col gap-3 rounded-lg border border-primary bg-surface-primary p-5">+ <div>+ <h2 className="-mt-1 mb-1 text-base font-semibold">One command. That's the whole setup.</h2>+ <p className="m-0 text-sm text-secondary">+ Run it in your project's repo – there are no in-app steps to click through.+ </p>+ </div>+ <SelfDrivingCommand size="md" />+ <ul className="m-0 flex list-none flex-col gap-1.5 p-0">+ {WIZARD_SETS_UP.map((item) => (+ <li key={item.label} className="flex items-center gap-2.5 text-sm text-secondary">+ <span className="flex size-5 shrink-0 items-center justify-center rounded bg-surface-secondary text-default [&_svg]:size-3">+ {item.icon}+ </span>+ <span className="min-w-0">{item.label}</span>+ </li>+ ))}+ </ul>+ </div>+ )+}++function BeatRow({ beat, index }: { beat: Beat; index: number }): JSX.Element {+ return (+ <div className="flex flex-col gap-3">+ <div className="flex items-baseline gap-3">+ <span className="font-mono text-xs text-muted tabular-nums">0{index + 1}</span>+ <div className="flex min-w-0 flex-1 flex-col gap-0.5">+ <span className="text-[15px] font-semibold leading-snug">{beat.label}</span>+ <span className="max-w-prose text-[13px] text-secondary leading-snug">{beat.description}</span>+ </div>+ </div>+ {/* Real inbox cards, kept inert by the preview's click interception (it meeps instead).+ Full-width on mobile; indented to align under the beat text from sm up. */}+ <div className="select-none pl-0 sm:pl-8">{beat.preview}</div>+ </div>+ )+}++/**+ * Self-driving onboarding, shown when self-driving isn't set up and there's nothing in the inbox+ * yet. Sells the payoff (pull requests to ship, reports that need your call) and centers the single+ * wizard command. Rendered as the body of a locked "Welcome" tab (see `InboxTabBar`), in place of the+ * report list – a plain centered column (not itself a card) that eases in with a subtle scale + fade.+ */+export function InboxOnboardingTakeover(): JSX.Element {+ return (+ <div className="InboxOnboardingTakeover mx-auto flex w-full max-w-3xl flex-col gap-6 px-4 py-6 sm:px-6 sm:py-12">+ <Hero />+ <CommandCard />+ <div className="flex flex-col gap-7">+ {BEATS.map((beat, index) => (+ <BeatRow key={beat.label} beat={beat} index={index} />+ ))}+ </div>+ </div>+ )+}++/**+ * 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 { dismissBanner } = useActions(inboxOnboardingLogic)++ return (+ <div className="mx-4 mb-3 mt-2 flex flex-col gap-2 rounded-lg border border-dashed border-primary bg-bg-light p-4">+ <div className="flex items-center gap-2 -my-1">+ <IconPause className="size-4 shrink-0 text-accent" />+ <h4 className="m-0 flex-1 text-sm font-semibold">Self-driving is paused</h4>+ <LemonButton+ size="xsmall"+ icon={<IconX />}+ tooltip="Dismiss for now"+ aria-label="Dismiss self-driving reminder"+ 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>+ <SelfDrivingCommand size="sm" />+ </div>+ )+}diff --git a/frontend/src/scenes/inbox/components/onboarding/InboxOnboardingPreviews.tsx b/frontend/src/scenes/inbox/components/onboarding/InboxOnboardingPreviews.tsxnew file mode 100644index 000000000000..9f2dccc85ed8--- /dev/null+++ b/frontend/src/scenes/inbox/components/onboarding/InboxOnboardingPreviews.tsx@@ -0,0 +1,86 @@+import { dayjs } from 'lib/dayjs'++import { SignalReport, SignalReportStatus } from '../../types'+import { ReportCard } from '../cards/ReportCard'+import { playMeep } from './meep'++/**+ * Onboarding previews that render the *real* inbox `ReportCard` (the very component the Pull+ * requests / Reports tabs use), fed mock data – so they read as the genuine article rather than a+ * lookalike. Every click inside a card is intercepted (capture phase) and turned into a cheeky+ * `meep` instead of navigating or archiving, so the samples stay inert while still feeling alive.+ *+ * The sample work is a wink at Silicon Valley (the show): Pied Piper's middle-out compression and+ * the ever-looming Hooli.+ */++// Timestamps are relative to "now" at render time (not a fixed calendar date) so `ReportCard`'s+// `TZLabel` always reads as just-landed work ("2 hours ago") instead of drifting to "months ago".+// Subtracting from the current clock also keeps the relative label stable in snapshot/VR runs.+const landedHoursAgo = (hours: number): string => dayjs().subtract(hours, 'hours').toISOString()++// A shippable fix Pied Piper's agents could open against the compression engine.+const PULL_REQUEST_SAMPLE: Omit<SignalReport, 'created_at' | 'updated_at'> = {+ id: 'onboarding-preview-pr',+ title: 'fix(compression): stop 4K streams dropping to single-threaded encode',+ summary:+ 'Middle-out throughput fell 41% above 2160p after the Anton migration – the Weissman score slid from 5.2 to 2.9 and p95 encode time tripled. This repins the chunk scheduler and restores both to pre-migration numbers.',+ status: SignalReportStatus.READY,+ total_weight: 0,+ signal_count: 3,+ relevant_user_count: null,+ artefact_count: 0,+ is_suggested_reviewer: false,+ priority: 'P1',+ source_products: ['session_replay'],+ implementation_pr_url: 'https://github.com/PiedPiper/pipernet/pull/486',+}++// A "needs your call" report: no clean code change, a judgment to make.+const REPORT_SAMPLE: Omit<SignalReport, 'created_at' | 'updated_at'> = {+ id: 'onboarding-preview-report',+ title: 'Hooli traffic is hammering the Pipernet beta – throttle or let it ride?',+ summary:+ "Sign-ups from Hooli IP ranges jumped 6× overnight and mostly bounce at onboarding. Could be Gavin's team load-testing us, or real interest worth keeping – worth your call before we rate-limit.",+ status: SignalReportStatus.READY,+ total_weight: 0,+ signal_count: 5,+ relevant_user_count: null,+ artefact_count: 0,+ is_suggested_reviewer: false,+ priority: 'P2',+ actionability: 'requires_human_input',+ source_products: ['error_tracking', 'session_replay'],+}++/**+ * Wraps a real `ReportCard` so the whole card is inert-but-playful: an `onClickCapture` swallows+ * every click (stopping the card's links/buttons from navigating or archiving) and meeps instead.+ */+function MeepCard({ report, tabKey }: { report: SignalReport; tabKey: 'pulls' | 'reports' }): JSX.Element {+ return (+ // `@container` so ReportCard's `@lg:` row layout resolves against the preview width (it has no+ // inbox-list container here). `role="presentation"` – the swallowed clicks are pure flair.+ <div+ role="presentation"+ className="@container"+ onClickCapture={(event) => {+ event.preventDefault()+ event.stopPropagation()+ playMeep()+ }}+ >+ <ReportCard report={report} tabKey={tabKey} />+ </div>+ )+}++export function PullRequestPreview(): JSX.Element {+ const landed = landedHoursAgo(2)+ return <MeepCard report={{ ...PULL_REQUEST_SAMPLE, created_at: landed, updated_at: landed }} tabKey="pulls" />+}++export function ReportPreview(): JSX.Element {+ const landed = landedHoursAgo(4)+ return <MeepCard report={{ ...REPORT_SAMPLE, created_at: landed, updated_at: landed }} tabKey="reports" />+}diff --git a/frontend/src/scenes/inbox/components/onboarding/meep.ts b/frontend/src/scenes/inbox/components/onboarding/meep.tsnew file mode 100644index 000000000000..599d333b036b--- /dev/null+++ b/frontend/src/scenes/inbox/components/onboarding/meep.ts@@ -0,0 +1,26 @@+import { lemonToast } from '@posthog/lemon-ui'++import meepUrl from 'public/sounds/meep.mp3'++let audio: HTMLAudioElement | null = null++/**+ * Cheeky easter egg for the onboarding previews: clicking the (otherwise inert) sample cards plays+ * a "meep" and pops a matching toast – a nod to PostHog Code. Pure flair; nothing else depends on it.+ */+export function playMeep(): void {+ lemonToast.info('Meep')+ try {+ // Reuse one element across clicks; rewind so rapid clicks restart the sound rather than overlap.+ if (!audio) {+ audio = new Audio(meepUrl)+ audio.volume = 0.8+ }+ audio.currentTime = 0+ // Autoplay can be blocked until the page has been interacted with; a click satisfies that,+ // but ignore any rejection (and jsdom, which doesn't implement playback) regardless.+ void audio.play().catch(() => {})+ } catch {+ // Audio unsupported in this environment – the toast alone is fine.+ }+}diff --git a/frontend/src/scenes/inbox/components/shell/InboxTabBar.tsx b/frontend/src/scenes/inbox/components/shell/InboxTabBar.tsxindex 700bffeffe5f..4b57a2ebd61e 100644--- a/frontend/src/scenes/inbox/components/shell/InboxTabBar.tsx+++ b/frontend/src/scenes/inbox/components/shell/InboxTabBar.tsx@@ -36,22 +36,59 @@ function FlatTabCount({ tabKey }: { tabKey: InboxFlatListTabKey }): JSX.Elementreturn <span className="text-xs text-muted tabular-nums">{count ?? 0}</span>}+/** Synthetic key for the onboarding "Welcome" tab – presentational only, never routed to. */+const WELCOME_TAB_KEY = 'welcome'++type InboxTabBarKey = InboxTabKey | typeof WELCOME_TAB_KEY+/*** Tab bar: Pull requests / Reports (everyone) + Not actionable / Runs (staff-only, with a* "Staff" tag). Each report tab shows its own server-computed count. The Configuration tab* is only shown when `showConfigTab` is set – i.e. when the scene is too narrow for the* setup rail; on wide viewports the rail replaces it.+ *+ * In `onboarding` mode (self-driving not set up, empty inbox) a locked "Welcome" tab is shown and+ * selected, while the real tabs stay visible but disabled – the user can see what's coming, but the+ * inbox only opens up once self-driving is set up.*/-export function InboxTabBar({ showConfigTab }: { showConfigTab?: boolean }): JSX.Element {+export function InboxTabBar({+ showConfigTab,+ onboarding,+}: {+ showConfigTab?: boolean+ onboarding?: boolean+}): JSX.Element {const { activeTab, isStaff, runsCount } = useValues(inboxSceneLogic)const visibleTabKeys = INBOX_TAB_KEYS.filter((key) => (key !== 'config' || showConfigTab) && (!isStaffOnlyTabKey(key) || isStaff))+ const realTabs = visibleTabKeys.map((key) => ({+ key,+ label: (+ <span className="flex items-center gap-1.5">+ <span>{INBOX_TAB_LABEL[key]}</span>+ {isFlatListTabKey(key) && <FlatTabCount tabKey={key} />}+ {key === 'runs' && <span className="text-xs text-muted tabular-nums">{runsCount}</span>}+ {isStaffOnlyTabKey(key) && (+ <LemonTag type="completion" size="small">+ Staff+ </LemonTag>+ )}+ </span>+ ),+ disabledReason: onboarding ? 'Set up self-driving to open your inbox' : undefined,+ content: <></>,+ }))++ const tabs = onboarding+ ? [{ key: WELCOME_TAB_KEY as InboxTabBarKey, label: <span>Welcome</span>, content: <></> }, ...realTabs]+ : realTabs+return (- <LemonTabs- activeKey={activeTab}+ <LemonTabs<InboxTabBarKey>+ activeKey={onboarding ? WELCOME_TAB_KEY : activeTab}// min-w-0 lets the tab bar shrink inside the header flex row so its own overflow-x scroll// engages on narrow/mobile widths – otherwise it grows to fit every tab and the last ones// (e.g. Configuration) overflow off-screen with no way to reach them.@@ -59,23 +96,12 @@ export function InboxTabBar({ showConfigTab }: { showConfigTab?: boolean }): JSX// Hide LemonTabs' own bottom border + margin so the single full-width border lives on the// scene header row; the active-tab slider then sits directly on that one border.barClassName="before:hidden mb-0"- onChange={(key) => router.actions.push(urls.inbox(key))}- tabs={visibleTabKeys.map((key) => ({- key,- label: (- <span className="flex items-center gap-1.5">- <span>{INBOX_TAB_LABEL[key]}</span>- {isFlatListTabKey(key) && <FlatTabCount tabKey={key} />}- {key === 'runs' && <span className="text-xs text-muted tabular-nums">{runsCount}</span>}- {isStaffOnlyTabKey(key) && (- <LemonTag type="completion" size="small">- Staff- </LemonTag>- )}- </span>- ),- content: <></>,- }))}+ onChange={(key) => {+ if (key !== WELCOME_TAB_KEY) {+ router.actions.push(urls.inbox(key))+ }+ }}+ tabs={tabs}/>)}diff --git a/frontend/src/scenes/inbox/logics/inboxOnboardingLogic.test.ts b/frontend/src/scenes/inbox/logics/inboxOnboardingLogic.test.tsnew file mode 100644index 000000000000..116037df88ef--- /dev/null+++ b/frontend/src/scenes/inbox/logics/inboxOnboardingLogic.test.ts@@ -0,0 +1,35 @@+import { computeOnboardingMode, InboxOnboardingMode, OnboardingModeInputs } from './inboxOnboardingLogic'++describe('computeOnboardingMode', () => {+ const base: OnboardingModeInputs = {+ isSetupLoaded: true,+ isSelfDrivingSetUp: false,+ areCountsResolved: true,+ hasExistingWork: false,+ bannerDismissed: false,+ }++ it.each<[string, Partial<OnboardingModeInputs>, InboxOnboardingMode]>([+ // Until the config check resolves, stay on the normal inbox (its own skeleton) – never guess+ // the takeover, which would jolt for a set-up user.+ ['config still loading', { isSetupLoaded: false }, 'none'],+ // Config not loaded wins even if the set-up flag is incidentally true – we don't trust it yet.+ ['config still loading, set-up flag ignored', { isSetupLoaded: false, isSelfDrivingSetUp: true }, 'none'],+ // Not set up, counts still loading → keep the inbox until we can choose takeover vs banner.+ ['not set up, counts still loading', { areCountsResolved: false }, 'none'],+ // Set up (a source or scout is watching) → no onboarding at all, and no wait on counts.+ ['set up, empty inbox', { isSelfDrivingSetUp: true }, 'none'],+ ['set up, with work', { isSelfDrivingSetUp: true, hasExistingWork: true }, 'none'],+ ['set up, counts unresolved (skipped)', { isSelfDrivingSetUp: true, areCountsResolved: false }, 'none'],+ // Not set up + nothing in the inbox → full-pane takeover (nothing to block).+ ['not set up, empty inbox', {}, 'takeover'],+ // Not set up but work exists → non-blocking banner, so existing work stays accessible.+ ['not set up, with work', { hasExistingWork: true }, 'banner'],+ // A dismissed banner falls back to the normal inbox for the session.+ ['not set up, with work, banner dismissed', { hasExistingWork: true, bannerDismissed: true }, 'none'],+ // Dismissing the banner has no effect on the takeover (the takeover has no dismiss).+ ['not set up, empty inbox, banner dismissed', { bannerDismissed: true }, 'takeover'],+ ])('%s', (_label, overrides, expected) => {+ expect(computeOnboardingMode({ ...base, ...overrides })).toBe(expected)+ })+})diff --git a/frontend/src/scenes/inbox/logics/inboxOnboardingLogic.ts b/frontend/src/scenes/inbox/logics/inboxOnboardingLogic.tsnew file mode 100644index 000000000000..80454f8caa65--- /dev/null+++ b/frontend/src/scenes/inbox/logics/inboxOnboardingLogic.ts@@ -0,0 +1,144 @@+import { actions, connect, kea, path, reducers, selectors } from 'kea'++import { signalSourcesLogic } from '../signalSourcesLogic'+import type { inboxOnboardingLogicType } from './inboxOnboardingLogicType'+import { INBOX_FLAT_TAB_LIST_PARAMS, reportListLogic } from './reportListLogic'+import { scoutFleetLogic } from './scoutFleetLogic'++/** How the self-driving onboarding presents itself over the inbox. */+export type InboxOnboardingMode = 'takeover' | 'banner' | 'none'++export interface OnboardingModeInputs {+ /** Both source + scout config loaders have settled, so the set-up verdict is trustworthy. */+ isSetupLoaded: boolean+ /** At least one signal source or scout is watching. */+ isSelfDrivingSetUp: boolean+ /** Both tab count loaders have settled (returned, or failed) – the work verdict is trustworthy. */+ areCountsResolved: boolean+ /** There are existing reports or PRs in the inbox. */+ hasExistingWork: boolean+ /** The banner was dismissed this session. */+ bannerDismissed: boolean+}++/**+ * Pure decision for how (if at all) the onboarding shows.+ *+ * `'none'` is the default: render the normal inbox, which shows its own list skeleton while loading.+ * We only switch to a takeover/banner once we're *confident* self-driving isn't set up – so we stay+ * on `'none'` (the familiar skeleton) until both the config check and, if needed, the report counts+ * have settled. This avoids flashing the takeover/banner before we know the verdict.+ */+export function computeOnboardingMode({+ isSetupLoaded,+ isSelfDrivingSetUp,+ areCountsResolved,+ hasExistingWork,+ bannerDismissed,+}: OnboardingModeInputs): InboxOnboardingMode {+ // Until the config check resolves we don't know the verdict – stay on the normal inbox skeleton.+ if (!isSetupLoaded) {+ return 'none'+ }+ // Set-up users go straight to their inbox – no need to wait on the report counts.+ if (isSelfDrivingSetUp) {+ return 'none'+ }+ // Not set up: the report counts decide takeover (empty inbox) vs. banner (work already exists).+ // Keep the inbox skeleton until they settle, rather than guessing.+ if (!areCountsResolved) {+ return 'none'+ }+ if (hasExistingWork) {+ return bannerDismissed ? 'none' : 'banner'+ }+ return 'takeover'+}++/**+ * Decides how the single-command self-driving onboarding presents itself. There are no in-app+ * setup steps – the user runs one wizard command in their repo – so "set up" is read straight+ * from what the wizard turns on: at least one signal source or scout watching.+ *+ * When self-driving is NOT set up, the presentation depends on whether there's anything to show:+ * - nothing landed yet (no reports or PRs) → the inbox becomes a locked "Welcome" tab whose body is+ * the onboarding card (the other tabs are visible but disabled). Nothing to block, so we lean in.+ * - reports or PRs already exist (they had sources/scouts before) → a sleek, non-blocking banner+ * above the inbox, so the team keeps access to their work while we entice them to re-enable.+ *+ * The banner is session-dismissable; it returns next time the inbox is opened still un-set-up.+ * The takeover has no dismiss – there's nothing behind it to reach.+ */+export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([+ path(['scenes', 'inbox', 'logics', 'inboxOnboardingLogic']),++ connect(() => ({+ values: [+ signalSourcesLogic,+ ['sourceConfigs', 'enabledSourcesCount'],+ scoutFleetLogic,+ ['scoutConfigs', 'enabledCount as enabledScoutsCount'],+ // Mount the pulls + reports count loaders directly (cheap limit=1 each) so we know+ // whether there's existing work even during a takeover, when the tab bar that usually+ // mounts these isn't rendered. Same keyed instances the tab bar uses – no double-fetch.+ reportListLogic({ tabKey: 'pulls', listParams: INBOX_FLAT_TAB_LIST_PARAMS.pulls }),+ ['count as pullsCount', 'countLoading as pullsCountLoading'],+ reportListLogic({ tabKey: 'reports', listParams: INBOX_FLAT_TAB_LIST_PARAMS.reports }),+ ['count as reportsCount', 'countLoading as reportsCountLoading'],+ ],+ })),++ actions({+ dismissBanner: true,+ }),++ reducers({+ bannerDismissed: [+ false,+ {+ dismissBanner: () => true,+ },+ ],+ }),++ selectors({+ isSelfDrivingSetUp: [+ (s) => [s.enabledSourcesCount, s.enabledScoutsCount],+ (enabledSourcesCount, enabledScoutsCount): boolean => enabledSourcesCount + enabledScoutsCount > 0,+ ],+ // Both source + scout config loaders have settled, so the set-up verdict is trustworthy.+ isSetupLoaded: [+ (s) => [s.sourceConfigs, s.scoutConfigs],+ (sourceConfigs, scoutConfigs): boolean => sourceConfigs !== null && scoutConfigs !== null,+ ],+ // Counts are "resolved" once both limit=1 requests have returned, OR once neither is still+ // loading (so a failed count request can't strand the onboarding on the loading state – this+ // is only consulted after the configs have loaded, by which point the counts have started).+ areCountsResolved: [+ (s) => [s.pullsCount, s.reportsCount, s.pullsCountLoading, s.reportsCountLoading],+ (pullsCount, reportsCount, pullsCountLoading, reportsCountLoading): boolean =>+ (pullsCount !== null && reportsCount !== null) || (!pullsCountLoading && !reportsCountLoading),+ ],+ hasExistingWork: [+ (s) => [s.pullsCount, s.reportsCount],+ (pullsCount, reportsCount): boolean => (pullsCount ?? 0) + (reportsCount ?? 0) > 0,+ ],+ onboardingMode: [+ (s) => [s.isSetupLoaded, s.isSelfDrivingSetUp, s.areCountsResolved, s.hasExistingWork, s.bannerDismissed],+ (+ isSetupLoaded,+ isSelfDrivingSetUp,+ areCountsResolved,+ hasExistingWork,+ bannerDismissed+ ): InboxOnboardingMode =>+ computeOnboardingMode({+ isSetupLoaded,+ isSelfDrivingSetUp,+ areCountsResolved,+ hasExistingWork,+ bannerDismissed,+ }),+ ],+ }),+])diff --git a/frontend/src/scenes/max/Intro.tsx b/frontend/src/scenes/max/Intro.tsxindex 606944e76128..54c728542590 100644--- a/frontend/src/scenes/max/Intro.tsx+++ b/frontend/src/scenes/max/Intro.tsx@@ -1,14 +1,11 @@import { useValues } from 'kea'-import { useState } from 'react'-import { Logomark } from 'lib/brand/Logomark'+import { JumpingLogomark } from 'lib/brand/JumpingLogomark'import { AILiabilityNotice } from './components/AILiabilityNotice'import { MaxChangelog } from './components/MaxChangelog'import { maxLogic } from './maxLogic'-const LOGOMARK_AIRTIME_MS = 400 // Sync with --logomark-airtime in base.scss-export function Intro({forceHeadline,forceSubheadline,@@ -19,35 +16,10 @@ export function Intro({const { headline } = useValues(maxLogic)const headlineToUse = forceHeadline || headlineconst subheadlineToUse = forceSubheadline === null ? null : forceSubheadline || 'Build something people want.'- const [hedgehogLastJumped, setHedgehogLastJumped] = useState<number | null>(() => Date.now())- const [hedgehogJumpIteration, setHedgehogJumpIteration] = useState(0)-- const handleLogomarkClick = (): void => {- const now = Date.now()- if (hedgehogLastJumped && now - hedgehogLastJumped < LOGOMARK_AIRTIME_MS) {- return // Disallows interrupting the jump animation!- }- setHedgehogJumpIteration(hedgehogJumpIteration + 1)- setHedgehogLastJumped(null)- requestAnimationFrame(() => setHedgehogLastJumped(now))- }return (<>- <div- className={`flex *:h-full *:w-12 p-2 cursor-pointer select-none ${hedgehogLastJumped ? 'animate-logomark-jump' : ''}`}- // eslint-disable-next-line react/forbid-dom-props- style={- {- '--logomark-jump-magnitude': hedgehogJumpIteration- ? 1.5 ** ((hedgehogJumpIteration % 8) - 2)- : 1,- } as React.CSSProperties- }- onClick={handleLogomarkClick}- >- <Logomark />- </div>+ <JumpingLogomark className="flex *:h-full *:w-12 p-2" /><div className="text-center mb-1"><h2 className="text-xl @2xl/main-content:text-2xl font-bold mb-2 text-balance">{headlineToUse}</h2>{subheadlineToUse && (diff --git a/frontend/src/styles/base.scss b/frontend/src/styles/base.scssindex 6fb68a12d452..f0304d08765d 100644--- a/frontend/src/styles/base.scss+++ b/frontend/src/styles/base.scss@@ -2090,6 +2090,9 @@#fba000 83%,#0143cb 100%);++ // Deliberately gentle so the scroll reads as a slow shimmer, not a strobe.+ --rainbow-scroll-duration: 6s;}.rainbow-text,@@ -2101,12 +2104,12 @@}.rainbow-text.rainbow-text-animating {- animation: rainbow-scroll 3s linear infinite;+ animation: rainbow-scroll var(--rainbow-scroll-duration) linear infinite;}.rainbow-text-fading.rainbow-text-animating {animation:- rainbow-scroll 3s linear infinite,+ rainbow-scroll var(--rainbow-scroll-duration) linear infinite,rainbow-fade-in 300ms ease-out;}