:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(signals): add a manual setup path to the inbox takeover (#88687)
posthog[bot]27077a345b51
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 7832a73c6d59..e634d664b32d 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -6765,13 +6765,13 @@ snapshots:scenes-app-inbox-scene--installing-self-driving--light:hash: v1.k794b7964.44a79a0117f5a912252a4c7c7685fca78693fc92c9b5d06bba7e928913235663.DfHZQMzgqHbKBJAEZ3XBRpom-q0KbSRt_QYmOnJOCAQscenes-app-inbox-scene--self-driving-onboarding--dark:- hash: v1.k794b7964.7602d02fad26586f0a4773abe0fbe76ad39c625403c7648ec58ff711aa38d3a0.9ssGMF2bvYFiK299rvJqLc9mbtZk4SeJHRoWnZP3Ed8+ hash: v1.k794b7964.e72ae40c380837255da720cddfdd3d15f724ef89afc42c07a97574fe729564b1.g3GQWyt4tXpPNvsJQ6owZhCkszpZEyk_0LzugUf7V50scenes-app-inbox-scene--self-driving-onboarding--light:- hash: v1.k794b7964.1d33a5483b26e38bf27cd31127bb72823b17f7dbbb8589a0d9799248c3fd8d4e.VPilMfZl7QjFLuR1IpcAFSnkmf9gzb6qh5p0-rBoCpk+ hash: v1.k794b7964.e0339822d528a7dc7fa8d13f3d7f1938fc1512011fbdf44579eb8a1269d31d5d.7My7XZH6KRDGhuhHvLRyNAmGHONzRdE25B1pt0d_9v4scenes-app-inbox-scene--self-driving-onboarding-redesign--dark:- hash: v1.k794b7964.a9b064dbf70e2dff0e3147c17ed0d6b924faa2e2a1d3b7b3723e5683b9af10d0.TJpI5NRs856RifBeff4jnkxIvSFACvygFf-UKT9G9Yo+ hash: v1.k794b7964.6b7b2950c3a0df456074962aada4405283deea5158415e032f0b0f8f25e5dbc2.tm21mB5drTdEcJGDLgLSUiX8Rvel7_-Yt5GbSLLTwsAscenes-app-inbox-scene--self-driving-onboarding-redesign--light:- hash: v1.k794b7964.c2f7366b673e20e85513c454effae314d643958a3d2424e7902d572909f024fe.edek45zj8tVjVDjsqgddUJUnPKAHanQkzZwR5Ylr93Q+ hash: v1.k794b7964.5268ad52b39cdc5bb1d699e6a1a839a552ce397134d6773714e1f5a2d95994b6.FhF72MKwXItKEYkZGQPVBzIVP03-mAXJSlwfA5OlL8Iscenes-app-inbox-scene--self-driving-paused--dark:hash: v1.k794b7964.ffc5557c01bbfb5497cbbc60ddec9df93367eef9507d600b9ac37f436eb92985.8pdD_uKVmeemQVwO3E6g526Fq7681IhrC2PA5AKCaiYscenes-app-inbox-scene--self-driving-paused--light:diff --git a/products/signals/frontend/inbox/components/onboarding/InboxOnboarding.tsx b/products/signals/frontend/inbox/components/onboarding/InboxOnboarding.tsxindex 305168a1c0f7..1db47cc71b69 100644--- a/products/signals/frontend/inbox/components/onboarding/InboxOnboarding.tsx+++ b/products/signals/frontend/inbox/components/onboarding/InboxOnboarding.tsx@@ -16,6 +16,7 @@ import {} from '../../inboxAnalytics'import { inboxOnboardingLogic } from '../../logics/inboxOnboardingLogic'import { PullRequestPreview, ReportPreview } from './InboxOnboardingPreviews'+import { ManualSetupAction } from './ManualSetupAction'/** 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'@@ -142,7 +143,7 @@ function CommandCard(): JSX.Element {<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.+ Run it in your project's repo, or set it up yourself below.</p></div><SelfDrivingCommand size="md" surface="takeover" />@@ -156,6 +157,7 @@ function CommandCard(): JSX.Element {</li>))}</ul>+ <ManualSetupAction variant="control" className="border-t border-primary pt-3" /></div>)}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxWelcomeRedesign.tsx b/products/signals/frontend/inbox/components/onboarding/InboxWelcomeRedesign.tsxindex 495d467ca003..c1717015fc7e 100644--- a/products/signals/frontend/inbox/components/onboarding/InboxWelcomeRedesign.tsx+++ b/products/signals/frontend/inbox/components/onboarding/InboxWelcomeRedesign.tsx@@ -11,6 +11,7 @@ import { copyToClipboard } from 'lib/utils/copyToClipboard'import { captureInboxWelcomeCommandCopied, captureInboxWelcomeViewed } from '../../inboxAnalytics'import { SELF_DRIVING_WIZARD_COMMAND } from './InboxOnboarding'+import { ManualSetupAction } from './ManualSetupAction'/** How long the copy button reads "Copied" before flipping back. */const COPIED_RESET_MS = 1600@@ -191,6 +192,7 @@ export function InboxWelcomeRedesign(): JSX.Element {Run it in your repo. That's the whole setup: it connects GitHub and picks the signal sources andscouts to watch. PRs start landing in this inbox.</p>+ <ManualSetupAction variant="redesign" className="mt-7 items-center text-center" /></div></div><div className="px-6 md:px-12">diff --git a/products/signals/frontend/inbox/components/onboarding/ManualSetupAction.tsx b/products/signals/frontend/inbox/components/onboarding/ManualSetupAction.tsxnew file mode 100644index 000000000000..f9d7a154c6b0--- /dev/null+++ b/products/signals/frontend/inbox/components/onboarding/ManualSetupAction.tsx@@ -0,0 +1,41 @@+import { useActions } from 'kea'++import { LemonButton } from '@posthog/lemon-ui'++import { InboxWelcomeVariant } from '../../inboxAnalytics'+import { inboxOnboardingLogic } from '../../logics/inboxOnboardingLogic'++/**+ * The takeover's escape hatch: skip the setup agent and turn sources and scouts on by hand.+ *+ * Both welcome arms render it, from here rather than each writing their own, so the label and the+ * helper line cannot drift between the arms of a live experiment. `variant` says which arm the+ * press came from; the parent places the block with `className`.+ */+export function ManualSetupAction({+ variant,+ className,+}: {+ variant: InboxWelcomeVariant+ className?: string+}): JSX.Element {+ const { requestManualSetup } = useActions(inboxOnboardingLogic)++ return (+ <div className={`flex flex-col gap-2 ${className ?? ''}`}>+ <LemonButton+ type="secondary"+ // pinned: autocapture data-attr - dashboards and test selectors match on this string+ data-attr="inbox-welcome-set-up-manually"+ className="w-fit"+ onClick={() => requestManualSetup(variant)}+ >+ 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.+ </p>+ </div>+ )+}diff --git a/products/signals/frontend/inbox/inboxAnalytics.ts b/products/signals/frontend/inbox/inboxAnalytics.tsindex 701f6ac4df71..308065c9b342 100644--- a/products/signals/frontend/inbox/inboxAnalytics.ts+++ b/products/signals/frontend/inbox/inboxAnalytics.ts@@ -13,10 +13,13 @@ import { SignalReport, SignalReportActionability, SignalReportPriority, SignalRu*/export const INBOX_CLIENT = 'cloud' as const+// pinned: analytics event names - dashboards, funnels, and alerts read these strings, and the+// desktop app sends the same ones, so renaming one splits its series in two.export const INBOX_EVENTS = {VIEWED: 'Inbox viewed',WELCOME_VIEWED: 'Inbox welcome viewed',WELCOME_COMMAND_COPIED: 'Inbox welcome command copied',+ WELCOME_MANUAL_SETUP_CLICKED: 'Inbox welcome manual setup clicked',PANEL_VIEWED: 'Inbox panel viewed',QUERY_CHANGED: 'Inbox query changed',REPORTS_IMPRESSED: 'Inbox reports impressed',@@ -251,6 +254,19 @@ export function captureInboxWelcomeCommandCopied(params: {})}+/**+ * The takeover's "Set up manually" escape hatch was pressed. Sits next to+ * {@link captureInboxWelcomeCommandCopied} as the other exit from the welcome page, so the two+ * together say how a team chose to set self-driving up. Without it a manual setup is invisible:+ * the wizard copy never fires, and the sources and scouts that follow look like they came from+ * nowhere. `variant` mirrors the welcome experiment arm, so the split is readable per arm.+ */+export function captureInboxWelcomeManualSetupClicked(params: { variant: InboxWelcomeVariant }): void {+ captureInboxEvent(INBOX_EVENTS.WELCOME_MANUAL_SETUP_CLICKED, {+ variant: params.variant,+ })+}+/*** The report list settled for the first time in a tab mount. `report_count` / `total_count` describe* the active tab's list only (and `report_count` is capped at the loaded page), so the headlinediff --git a/products/signals/frontend/inbox/logics/inboxOnboardingLogic.test.ts b/products/signals/frontend/inbox/logics/inboxOnboardingLogic.test.tsindex f55edddfe1b4..251ebe7b0087 100644--- a/products/signals/frontend/inbox/logics/inboxOnboardingLogic.test.ts+++ b/products/signals/frontend/inbox/logics/inboxOnboardingLogic.test.ts@@ -22,6 +22,7 @@ describe('inboxOnboardingLogic', () => {isWizardRunning: false,isWizardStateResolved: true,isRefetching: false,+ manualSetupRequested: false,}it.each<[string, Partial<OnboardingModeInputs>, InboxOnboardingDecision]>([@@ -124,6 +125,26 @@ describe('inboxOnboardingLogic', () => {{ isRefetching: true, hasExistingWork: true },{ mode: 'banner', reason: null },],+ // "Set up manually" opens the Configuration and Scouts tabs the takeover was covering,+ // so the whole prompt stands down for the session.+ [+ 'manual setup requested, would otherwise take over',+ { manualSetupRequested: true },+ { mode: 'none', reason: 'manual_setup' },+ ],+ // Enabling a source or scout from there is the real end state, so `already_set_up` wins+ // and the takeover can never come back, session flag or not.+ [+ 'manual setup requested, now set up',+ { manualSetupRequested: true, isSelfDrivingSetUp: true },+ { mode: 'none', reason: 'already_set_up' },+ ],+ // A run in flight still outranks it: the progress widget is the more accurate story.+ [+ 'manual setup requested, wizard running',+ { manualSetupRequested: true, isWizardRunning: true },+ { mode: 'none', reason: 'wizard_running' },+ ],])('%s', (_label, overrides, expected) => {expect(computeOnboardingDecision({ ...base, ...overrides })).toEqual(expected)})diff --git a/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts b/products/signals/frontend/inbox/logics/inboxOnboardingLogic.tsindex 3a359a06836f..dd218fd735c3 100644--- a/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts+++ b/products/signals/frontend/inbox/logics/inboxOnboardingLogic.ts@@ -1,4 +1,5 @@import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'+import { router } from 'kea-router'import { subscriptions } from 'kea-subscriptions'import { FEATURE_FLAGS } from 'lib/constants'@@ -6,12 +7,17 @@ import { FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'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 } from '../inboxAnalytics'+import {+ InboxWelcomeVariant,+ captureInboxOnboardingDecided,+ captureInboxWelcomeManualSetupClicked,+} from '../inboxAnalytics'import { signalSourcesLogic } from '../signalSourcesLogic'-import type { SignalSourceConfig } from '../types'+import { INBOX_CONFIG_TAB_KEY, type SignalSourceConfig } from '../types'import { INBOX_FLAT_TAB_LIST_PARAMS, reportListLogic } from './reportListLogic'import { scoutFleetLogic } from './scoutFleetLogic'@@ -38,14 +44,52 @@ export type InboxOnboardingMode = 'takeover' | 'banner' | 'none' | 'pending'export type InboxSettledUiState = 'takeover' | 'inbox'/** localStorage key for the per-team last-settled UI state (see `lastSettledUiStateByTeam`). */+// pinned: browser storage key - a rename orphans what every user already stored, so the inbox+// forgets which UI it painted last visit and falls back to the skeleton on their next one.export const INBOX_LAST_UI_STATE_STORAGE_KEY = 'inbox-onboarding-last-ui-state'+/** sessionStorage key for the per-team "Set up manually" choice (see `manualSetupRequestedByTeam`). */+// pinned: browser storage key - a rename drops the choice mid-session, so the takeover returns+// for someone who already pressed "Set up manually".+export const INBOX_MANUAL_SETUP_STORAGE_KEY = 'inbox-onboarding-manual-setup'++/**+ * Teams that asked to set self-driving up by hand, read back at mount.+ *+ * The store is sessionStorage, not localStorage, because the takeover is the only prompt to run+ * the setup agent: a suppression that never expires costs a team who clicked once and enabled+ * nothing every later chance to see it. It must still survive a reload, because the button's own+ * copy sends the user off to connect GitHub, so leaving the inbox and coming back is part of the+ * flow it starts. It is keyed by team because switching project reloads the app in the same tab+ * and sessionStorage outlives that reload, so an unkeyed flag would carry one project's choice+ * into every other project.+ */+function readManualSetupTeams(): Record<string, boolean> {+ try {+ const raw = window.sessionStorage.getItem(INBOX_MANUAL_SETUP_STORAGE_KEY)+ const parsed = raw ? JSON.parse(raw) : null+ return typeof parsed === 'object' && parsed !== null ? parsed : {}+ } catch {+ // sessionStorage can be unavailable (privacy mode), and a hand-edited value can be+ // unparseable. Either way the takeover shows, which is the safe direction to fail.+ return {}+ }+}++function writeManualSetupTeams(teams: Record<string, boolean>): void {+ try {+ window.sessionStorage.setItem(INBOX_MANUAL_SETUP_STORAGE_KEY, JSON.stringify(teams))+ } catch {+ // Unwritable storage costs the choice its reload survival, nothing else.+ }+}+/*** Why the onboarding is not showing. `null` whenever it is.*- * `'wizard_running'` is the only deliberate suppression; every other value is an input the decision- * is still waiting on, or a user who does not need onboarding at all. Carried into telemetry so a- * withheld prompt is distinguishable from an absent one.+ * `'wizard_running'` and `'manual_setup'` are the deliberate suppressions; every other value is an+ * input the decision is still waiting on, or a user who does not need onboarding at all. Carried+ * into telemetry so a withheld prompt is distinguishable from an absent one.*/export type InboxOnboardingSuppressionReason =| 'wizard_running'@@ -55,6 +99,7 @@ export type InboxOnboardingSuppressionReason =| 'counts_loading'| 'refetching'| 'banner_dismissed'+ | 'manual_setup'| nullexport interface InboxOnboardingDecision {@@ -118,6 +163,9 @@ export interface OnboardingModeInputs {/** A config/count refetch is in flight, so the loaded values may be about to change (e.g. the* wizard just finished, or the user returned to the tab). */isRefetching: boolean+ /** The user chose "Set up manually" on the takeover this session, so they are configuring the+ * project by hand and the prompt to run the setup agent is not what they asked for. */+ manualSetupRequested: boolean}/**@@ -143,6 +191,7 @@ export function computeOnboardingDecision({isWizardRunning,isWizardStateResolved,isRefetching,+ manualSetupRequested,}: OnboardingModeInputs): InboxOnboardingDecision {// A run in flight is setup in progress: sources and scouts land as it goes, so telling the user// to go and run the wizard would contradict the progress widget already showing it running.@@ -154,6 +203,13 @@ export function computeOnboardingDecision({if (isSetupLoaded && isSelfDrivingSetUp) {return { mode: 'none', reason: 'already_set_up' }}+ // The user asked for the Configuration and Scouts tabs instead of the setup agent, so hold the+ // whole prompt back: the takeover covers those tabs, and the banner would nag about a decision+ // they already made. It is checked after `already_set_up` so the reported reason stays the more+ // specific one once a source or scout is actually enabled.+ if (manualSetupRequested) {+ return { mode: 'none', reason: 'manual_setup' }+ }// Work already in the inbox rules the takeover out: the only remaining outcomes (banner /// none) both render the normal inbox, so show it now rather than holding a skeleton. The// non-blocking banner joins once the config and wizard checks settle.@@ -238,6 +294,8 @@ export interface inboxOnboardingLogicValues {isWizardStateResolved: booleanlastSettledUiState: InboxSettledUiState | nulllastSettledUiStateByTeam: Record<string, InboxSettledUiState>+ manualSetupRequested: boolean+ manualSetupRequestedByTeam: Record<string, boolean>onboardingDecision: InboxOnboardingDecisiononboardingMode: InboxOnboardingModeresolvedOnboardingMode: InboxOnboardingMode@@ -262,6 +320,9 @@ export interface inboxOnboardingLogicActions {refreshSetupState: () => {value: true}+ requestManualSetup: (variant: InboxWelcomeVariant) => {+ variant: InboxWelcomeVariant+ }setLastSettledUiState: (teamId: number,uiState: InboxSettledUiState@@ -269,6 +330,9 @@ export interface inboxOnboardingLogicActions {teamId: numberuiState: InboxSettledUiState}+ setManualSetupRequested: (teamId: number) => {+ teamId: number+ }}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -300,6 +364,10 @@ export interface inboxOnboardingLogicMeta {pullsCountLoading: boolean,reportsCountLoading: boolean) => boolean+ manualSetupRequested: (+ manualSetupRequestedByTeam: Record<string, boolean>,+ currentTeamId: number | null+ ) => booleanonboardingDecision: (isSetupLoaded: boolean,isSelfDrivingSetUp: boolean,@@ -308,7 +376,8 @@ export interface inboxOnboardingLogicMeta {bannerDismissed: boolean,isWizardRunning: boolean,isWizardStateResolved: boolean,- isRefetching: boolean+ isRefetching: boolean,+ manualSetupRequested: boolean) => InboxOnboardingDecisionresolvedOnboardingMode: (onboardingDecision: InboxOnboardingDecision) => InboxOnboardingModelastSettledUiState: (@@ -388,9 +457,12 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([expireWizardVerdictWait: true,setLastSettledUiState: (teamId: number, uiState: InboxSettledUiState) => ({ teamId, uiState }),refreshSetupState: true,+ /** "Set up manually" was pressed on the takeover. `variant` is the welcome arm it came from. */+ requestManualSetup: (variant: InboxWelcomeVariant) => ({ variant }),+ setManualSetupRequested: (teamId: number) => ({ teamId }),}),- listeners(({ actions }) => ({+ listeners(({ actions, values }) => ({// Re-pull everything the verdict is computed from. Fired when the wizard run ends and when// the user returns to a tab whose verdict still says "not set up".refreshSetupState: () => {@@ -399,6 +471,20 @@ 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: ({ variant }) => {+ captureInboxWelcomeManualSetupClicked({ variant })+ if (values.currentTeamId != null) {+ actions.setManualSetupRequested(values.currentTeamId)+ }+ router.actions.push(urls.inbox(INBOX_CONFIG_TAB_KEY))+ },+ // Listeners run after the reducer, so this writes the map the choice is already in.+ setManualSetupRequested: () => {+ writeManualSetupTeams(values.manualSetupRequestedByTeam)+ },})),reducers({@@ -424,6 +510,14 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([state[teamId] === uiState ? state : { ...state, [teamId]: uiState },},],+ // Keyed by team for the same reason, and seeded from sessionStorage so the choice survives+ // a reload of the inbox without outliving the tab (see `readManualSetupTeams`).+ manualSetupRequestedByTeam: [+ readManualSetupTeams(),+ {+ setManualSetupRequested: (state, { teamId }) => (state[teamId] ? state : { ...state, [teamId]: true }),+ },+ ],}),selectors({@@ -489,6 +583,11 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([reportsCountLoading: boolean): boolean => sourceConfigsLoading || scoutConfigsLoading || pullsCountLoading || reportsCountLoading,],+ manualSetupRequested: [+ (s) => [s.manualSetupRequestedByTeam, s.currentTeamId],+ (manualSetupRequestedByTeam: Record<string, boolean>, currentTeamId: number | null): boolean =>+ currentTeamId != null ? (manualSetupRequestedByTeam[currentTeamId] ?? false) : false,+ ],// The verdict from live inputs alone, with the input it is still waiting on. Kept separate// from `onboardingMode` so neither the cache writer nor the telemetry below ever reports a// guess that itself came from the cache.@@ -502,6 +601,7 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([s.isWizardRunning,s.isWizardStateResolved,s.isRefetching,+ s.manualSetupRequested,],(isSetupLoaded: boolean,@@ -511,7 +611,8 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([bannerDismissed: boolean,isWizardRunning: boolean,isWizardStateResolved: boolean,- isRefetching: boolean+ isRefetching: boolean,+ manualSetupRequested: boolean): InboxOnboardingDecision =>computeOnboardingDecision({isSetupLoaded,@@ -522,6 +623,7 @@ export const inboxOnboardingLogic = kea<inboxOnboardingLogicType>([isWizardRunning,isWizardStateResolved,isRefetching,+ manualSetupRequested,}),],resolvedOnboardingMode: [