:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(aio): correct onboarding install command and verification (#78394)
Marco Gancitano96ff660b5ec2
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex a01c863c893e..a761cedb1eb8 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -7679,9 +7679,13 @@ snapshots:scenes-other-login--sso-error--light:hash: v1.k794b7964.dcb9dbd028e9325ec079706aaf108c905d2d6116d8fcbef7482d48f370cda6a1.IpTMqWIuRh6xGrQ4TzU6wCvTIYdToc9T6wkqkOenjSYscenes-other-onboarding-legacy--ai-observability-sdk-install--dark:- hash: v1.k794b7964.bda729452fe657398c480b5294c7e56e7d3635b19abb4002709522f13f369305.LhnETlVSPxPSo_ngJjnaI12lyQMOsH0FpWWkQEq2KiM+ hash: v1.k794b7964.0c82a4b8b276a3f51b42dd3a20aed7672fbfb5f096e4bd9da51221b6eb52bbdc.iXUjftr_vTAULjZ_soSDjZ9o_RG2YPlJBCG4ZSuNTS0scenes-other-onboarding-legacy--ai-observability-sdk-install--light:- hash: v1.k794b7964.46dbb2e71065c10cf633c471fc611f466486f8d0d1d72531ac1aed35bcfbbad1.DdjSNZIoFu_7KeWb1YQt_dX4dlwDGlS7fh2nVl0OXpM+ hash: v1.k794b7964.c6c5baa13b6d17723b6022b01f3a235df0e49a93c92993eca8d498c2c4dfe9e5.a09diijoUqSgzkc5MHr912Pij2owQlUx5mrdebH4fsU+ scenes-other-onboarding-legacy--ai-observability-sdk-install-with-cloud-run-flag--dark:+ hash: v1.k794b7964.0c82a4b8b276a3f51b42dd3a20aed7672fbfb5f096e4bd9da51221b6eb52bbdc.mNBXA38xho8_capLIbeLCS22SJlBdDCCYmsl30jy3bI+ scenes-other-onboarding-legacy--ai-observability-sdk-install-with-cloud-run-flag--light:+ hash: v1.k794b7964.57d23129f793fa3865ca4b69934324fb3fe40f3a61b0117aca3078ab2994b6d8.dCLPekVRS1NAAYJDZx1vljuojZMNCbiNW2DXLnnRtfAscenes-other-onboarding-legacy--alerts--dark:hash: v1.k794b7964.c22b202da34ceea01a9dc7162520e35f2366b891dc31dfef3f4cc1c02a732925.NcL-srF2HqgOaQZS2T1bWylckrTCHkBSYe72zVWgpIwscenes-other-onboarding-legacy--alerts--light:@@ -7725,7 +7729,7 @@ snapshots:scenes-other-onboarding-legacy--workflows-custom-installation-instructions--dark:hash: v1.k794b7964.dd81a223dd76d082e354b4635025f2164f33d40c98ac905328517316e5b35d98.4HihmxNQLrg1bqWk64AX2to8IGHSIeUO2ntT8uD7hV8scenes-other-onboarding-legacy--workflows-custom-installation-instructions--light:- hash: v1.k794b7964.2e4c7a2a3622c774e52dca6381164f33c47e31e315e4a2809e08721b32bba1c5.PhnLd-CI_Bygrdk5gTu1nVy1chhblwOhJC0fP3ld7TA+ hash: v1.k794b7964.2094d2c351dde75375b61a60acc049fd4f8552892faa171e95083313ebb0f129.O3jVVJoEuyGgD2yLIdIwb-CdJyvIVne8HULh6y7LdvMscenes-other-onboarding-legacy-install-step--cloud-run-in-progress--dark:hash: v1.k794b7964.b5ee945088ebf73e06ff4e3a3f0b7f506e20b902df8f50aef779ac3b0e433ecd.xNlLf3OVO2wRHIaGxXcEivkhq2Wbyl1eIag4VtxIru8scenes-other-onboarding-legacy-install-step--cloud-run-in-progress--light:diff --git a/frontend/src/lib/components/CommandBlock/CommandBlock.tsx b/frontend/src/lib/components/CommandBlock/CommandBlock.tsxindex fce0a59f21f2..4d5e157966be 100644--- a/frontend/src/lib/components/CommandBlock/CommandBlock.tsx+++ b/frontend/src/lib/components/CommandBlock/CommandBlock.tsx@@ -44,14 +44,17 @@ interface CommandBlockProps {/** Skip the "Copied … to clipboard" toast. Set when this block lives inside another* long-lived toast that would otherwise get pushed around by the success info toast. */silentCopy?: boolean- /** Hide noise (`-y` flags and `@latest` version pins) from the displayed text to keep the- * block compact. The full `command` is still what gets copied. */+ /** Hide noise (`-y` flags, `@latest` version pins, `--project-id` targeting) from the+ * displayed text to keep the block compact. The full `command` is still what gets copied. */condensed?: boolean}-/** Strips display noise (`-y` flags, `@latest` pins) from a command; copy the original, show this. */+/** Strips display noise (`-y`, `@latest`, `--project-id=N`) from a command; copy the original, show this. */export function condenseCommand(command: string): string {- return command.replace(/ -y\b/g, '').replace(/@latest\b/g, '')+ return command+ .replace(/ -y\b/g, '')+ .replace(/@latest\b/g, '')+ .replace(/ --project-id=\S+/g, '')}export function CommandBlock({diff --git a/frontend/src/scenes/onboarding/Onboarding.stories.tsx b/frontend/src/scenes/onboarding/Onboarding.stories.tsxindex 663bb3a047a2..0a318c1d19e6 100644--- a/frontend/src/scenes/onboarding/Onboarding.stories.tsx+++ b/frontend/src/scenes/onboarding/Onboarding.stories.tsx@@ -2,6 +2,7 @@ import { Meta, StoryObj } from '@storybook/react'import { useActions, useMountedLogic } from 'kea'import { router } from 'kea-router'+import { FEATURE_FLAGS } from 'lib/constants'import { useDelayedOnMountEffect } from 'lib/hooks/useOnMountEffect'import { App } from 'scenes/App'import { availableOnboardingProducts } from 'scenes/onboarding/shared/utils'@@ -149,6 +150,30 @@ export const AIObservabilitySDKInstall: Story = {},}+// The cloud-run experiment arm enabled: a dedicated wizard program must keep its own command+// and never offer the cloud arm. (The active-run takeover scenario is pinned by+// WizardInstallStep.test.tsx — staging a run here would write the persisted handle to+// localStorage, which stories share, contaminating every story rendered after this one.)+export const AIObservabilitySDKInstallWithCloudRunFlag: Story = {+ render: () => {+ useMountedLogic(onboardingLogic)+ const { setProduct } = useActions(onboardingLogic)++ useDelayedOnMountEffect(() => {+ setProduct(availableOnboardingProducts[ProductKey.AI_OBSERVABILITY])+ router.actions.push(+ urls.onboarding({ productKey: ProductKey.AI_OBSERVABILITY, stepKey: OnboardingStepKey.INSTALL })+ )+ })++ return <App />+ },+ parameters: {+ featureFlags: { [FEATURE_FLAGS.ONBOARDING_WIZARD_CLOUD_RUN]: 'test' },+ testOptions: { waitForSelector: '[data-attr="sdk-continue"]' },+ },+}+// ==========================================// Product Configuration Steps// ==========================================diff --git a/frontend/src/scenes/onboarding/legacy/OnboardingBreadcrumbs.tsx b/frontend/src/scenes/onboarding/legacy/OnboardingBreadcrumbs.tsxindex 8eaa3e781b53..a12abcd831ef 100644--- a/frontend/src/scenes/onboarding/legacy/OnboardingBreadcrumbs.tsx+++ b/frontend/src/scenes/onboarding/legacy/OnboardingBreadcrumbs.tsx@@ -8,11 +8,8 @@ import { Link } from '@posthog/lemon-ui'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { availableOnboardingProducts } from 'scenes/onboarding/shared/utils'-import { OnboardingStepKey } from '~/types'-import { stepKeyToTitle } from './onboardingFlowUtils'import { onboardingLogic } from './onboardingLogic'-import { INSTALL_DEDUP_KEYS } from './types'export function OnboardingBreadcrumbs(): JSX.Element | null {const { flow, currentFlowStep } = useValues(onboardingLogic)@@ -37,13 +34,6 @@ export function OnboardingBreadcrumbs(): JSX.Element | null {if (step.label) {return step.label}- // The posthog-js install step is shared across products via dedup, so it gets- // a generic "Install" label rather than being titled after whichever product- // happens to be the dedup survivor (which would be misleading when it- // actually installs the SDK for several products at once).- if (step.stepKey === OnboardingStepKey.INSTALL && step.dedupKey === INSTALL_DEDUP_KEYS.POSTHOG_JS) {- return 'Install'- }const base = stepKeyToTitle(step.stepKey) ?? step.stepKeyif (stepKeyCounts[step.stepKey] > 1) {const productName =@@ -53,6 +43,7 @@ export function OnboardingBreadcrumbs(): JSX.Element | null {// as one phrase ("Install · Web Analytics" instead of "Install Web Analytics").// Product names use the registry's Title Case ("Product Analytics",// "AI observability") as-is — these are proper-noun product names.+ // A deduped step covers other products too; the step subtitle names the full set.return `${base} · ${productName}`}}diff --git a/frontend/src/scenes/onboarding/legacy/billing/FreeTierLimits.tsx b/frontend/src/scenes/onboarding/legacy/billing/FreeTierLimits.tsxindex 8a30dcf9a349..afc76b83b511 100644--- a/frontend/src/scenes/onboarding/legacy/billing/FreeTierLimits.tsx+++ b/frontend/src/scenes/onboarding/legacy/billing/FreeTierLimits.tsx@@ -7,6 +7,7 @@ type FreeTierLimit = {title: stringicon: stringcolor: string+ productType: stringunit: stringvalue: number}@@ -23,7 +24,12 @@ const FreeTierItem = ({ limit }: { limit: FreeTierLimit }): JSX.Element => {return (<div className="flex flex-col items-center w-36"><div className="flex gap-1 items-center">- {getProductIcon(limit.icon, { iconColor: limit.color, className: 'w-6 h-6' })}+ {getProductIcon(limit.icon, {+ iconColor: limit.color,+ className: 'w-6 h-6',+ // The productType mapping wins over billing icon_keys that ICON_MAP lacks.+ productType: limit.productType,+ })}</div><strong className="text-[15px] text-center leading-none mt-2 mb-1">{limit.title}</strong><div className="text-sm text-center text-success dark:text-green-400">@@ -47,6 +53,7 @@ export const FreeTierLimits: React.FC = (): JSX.Element => {p.icon_key ?? availableOnboardingProducts[p.type as keyof typeof availableOnboardingProducts]?.icon,color: availableOnboardingProducts[p.type as keyof typeof availableOnboardingProducts]?.iconColor,+ productType: p.type,unit: freePlan?.unit ?? '',value: freePlan?.free_allocation ?? 0,}diff --git a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardInstallStep/WizardInstallIntro.tsx b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardInstallStep/WizardInstallIntro.tsxindex b357abae5c9d..829472559b20 100644--- a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardInstallStep/WizardInstallIntro.tsx+++ b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardInstallStep/WizardInstallIntro.tsx@@ -1,10 +1,10 @@-export function WizardInstallIntro(): JSX.Element {+export function WizardInstallIntro({ description }: { description?: string } = {}): JSX.Element {return (<div className="text-center max-w-xl mx-auto space-y-3"><h2 className="text-2xl font-bold">Skip the install. Get 10–20 minutes back.</h2><p className="text-muted">- The wizard detects your framework, installs the right SDK, configures your environment variables, and- wires up event capture automatically.+ {description ??+ 'The wizard detects your framework, installs the right SDK, configures your environment variables, and wires up event capture automatically.'}</p><p className="text-muted text-xs">LLM inference is on us, no API key needed.</p></div>diff --git a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardInstallStep/WizardInstallStep.test.tsx b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardInstallStep/WizardInstallStep.test.tsxnew file mode 100644index 000000000000..43433200ef9d--- /dev/null+++ b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardInstallStep/WizardInstallStep.test.tsx@@ -0,0 +1,152 @@+import '@testing-library/jest-dom'++import { cleanup, render, screen } from '@testing-library/react'+import { Provider } from 'kea'++import { activeCloudRunLogic } from 'scenes/onboarding/shared/wizard-sync/activeCloudRunLogic'+import { projectLogic } from 'scenes/projectLogic'++import { useMocks } from '~/mocks/jest'+import { initKeaTests } from '~/test/init'++import { VERIFY_AI_EVENTS } from '../../hooks/useInstallationComplete'+import { VariantProps } from '../types'+import { WizardInstallStep } from './index'++// The run block's internals (session stream) are irrelevant here — the assertion is which+// branch renders, so a marker stub keeps jsdom out of SSE territory.+jest.mock('scenes/onboarding/shared/wizard-sync/WizardCloudRunBlock', () => ({+ WizardCloudRunBlock: () => <div data-attr="mock-cloud-run-block" />,+}))++// OnboardingStep pulls in half the app (support side panel, project tree). The stub keeps the+// contract that matters: the Continue button is driven by continueDisabledReason, which is+// computed by the real WizardInstallStep code under test.+jest.mock('../../../OnboardingStep', () => ({+ OnboardingStep: ({+ children,+ continueDisabledReason,+ actions,+ title,+ }: {+ children: React.ReactNode+ continueDisabledReason?: string+ actions?: React.ReactNode+ title: string+ }) => (+ <div>+ <h1>{title}</h1>+ {actions}+ {children}+ <button data-attr="mock-continue" aria-disabled={continueDisabledReason ? 'true' : undefined}>+ Continue+ </button>+ </div>+ ),+}))++// The realtime indicator is orthogonal here and drags in live-events deps.+jest.mock('../../RealtimeCheckIndicator', () => ({+ RealtimeCheckIndicator: () => <div data-attr="mock-realtime-check" />,+ AdblockWarning: () => null,+}))++// Manual-setup surfaces (behind a modal that stays closed) and the sync progress view — not under test.+jest.mock('../SDKGrid', () => ({ SDKGrid: () => null }))+jest.mock('../SDKInstructionsModal', () => ({ SDKInstructionsModal: () => null }))+jest.mock('scenes/onboarding/shared/wizard-sync/InstallationProgressView', () => ({+ InstallationProgressView: () => null,+}))++const AIO_PROPS: VariantProps = {+ sdkGridProps: {+ filteredSDKs: [],+ searchTerm: '',+ selectedTag: null,+ tags: [],+ onSDKClick: () => {},+ onSearchChange: () => {},+ onTagChange: () => {},+ currentTeam: null,+ installationComplete: false,+ showTopSkipButton: false,+ },+ sdkInstructionMap: {},+ adblockResult: 'ok' as VariantProps['adblockResult'],+ installationComplete: false,+ listeningForName: 'LLM generation',+ teamPropertyToVerify: VERIFY_AI_EVENTS,+ selectedSDK: null,+ installTitle: 'Install AI observability',+ wizardOverrides: {+ subcommand: 'ai-observability',+ description: 'Detects your LLM SDK and wires up tracing.',+ intro: 'The setup agent detects your LLM provider.',+ supports: [{ name: 'OpenAI' }, { name: 'Anthropic' }, { name: '+ 30 more' }],+ },+}++describe('WizardInstallStep with wizardOverrides', () => {+ let projectId: number++ beforeEach(() => {+ useMocks({+ get: {+ '/api/projects/:team_id/event_definitions': { results: [], count: 0 },+ '/api/projects/:project_id/tasks/active_wizard_run/': {+ task_id: 'task-from-earlier-step',+ run_id: 'run-from-earlier-step',+ status: 'running',+ started_at: '2026-08-06T00:00:00Z',+ },+ },+ post: {+ '/api/environments/:team_id/query': { results: [] },+ },+ })+ initKeaTests()+ projectLogic.mount()+ projectId = projectLogic.values.currentProjectId as number+ activeCloudRunLogic.mount()+ })++ afterEach(() => {+ activeCloudRunLogic.actions.clearActiveCloudRun()+ cleanup()+ })++ it('without an active cloud run: shows the ai-observability command and blocks Continue', async () => {+ render(+ <Provider>+ <WizardInstallStep {...AIO_PROPS} />+ </Provider>+ )++ expect(await screen.findByText((t) => t.includes('ai-observability') && t.includes('npx'))).toBeInTheDocument()+ expect(document.querySelector('[data-attr="mock-cloud-run-block"]')).toBeNull()++ expect(document.querySelector('[data-attr="mock-continue"]')).toHaveAttribute('aria-disabled', 'true')+ })++ it('ignores a cloud run queued on an earlier install step: command stays, Continue stays blocked', async () => {+ // The base-program run the user queued on the posthog-js install step of the same flow. It+ // must not replace the dedicated ai-observability command or satisfy the continue gate.+ activeCloudRunLogic.actions.setActiveCloudRun(+ 'task-from-earlier-step',+ 'run-from-earlier-step',+ '2026-08-06T00:00:00Z',+ projectId+ )++ render(+ <Provider>+ <WizardInstallStep {...AIO_PROPS} />+ </Provider>+ )++ expect(await screen.findByText((t) => t.includes('ai-observability') && t.includes('npx'))).toBeInTheDocument()+ expect(document.querySelector('[data-attr="mock-cloud-run-block"]')).toBeNull()++ expect(document.querySelector('[data-attr="mock-continue"]')).toHaveAttribute('aria-disabled', 'true')+ })+})diff --git a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardInstallStep/index.tsx b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardInstallStep/index.tsxindex 9007a53ed92c..07e47f856947 100644--- a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardInstallStep/index.tsx+++ b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardInstallStep/index.tsx@@ -12,23 +12,34 @@ import { useLocalWizardRunActive } from '../../../../shared/wizard-sync/hooks'import { InstallationProgressView } from '../../../../shared/wizard-sync/InstallationProgressView'import { WizardCommandBlock } from '../../../../shared/wizard-sync/WizardCommandBlock'import { WizardInstallOptions } from '../../../../shared/wizard-sync/WizardInstallOptions'+import { WizardFrameworkBadges } from '../../../../shared/wizard-sync/WizardModeShell'import { OnboardingStep } from '../../../OnboardingStep'import { AdblockWarning, RealtimeCheckIndicator } from '../../RealtimeCheckIndicator'import { SDKGrid } from '../SDKGrid'import { SDKInstructionsModal } from '../SDKInstructionsModal'-import { VariantProps } from '../types'+import { VariantProps, WizardOverrides } from '../types'import { wizardInstallStepLogic } from '../wizardInstallStepLogic'import { WizardInstallIntro } from './WizardInstallIntro'// The shared cloud/local switcher wrapped with legacy's own command block and instrumentation. An// active cloud run renders inside it (WizardCloudRunBlock pins to the run's progress), so the// failed-run "Run it yourself" fallback keeps working — the mode state must not unmount mid-recovery.-function LegacyInstallOptions(): JSX.Element {+function LegacyInstallOptions({ wizardOverrides }: { wizardOverrides?: WizardOverrides }): JSX.Element {const { reportSelfDrivingOnboardingInstallModeSelected } = useActions(onboardingEventUsageLogic)return (<WizardInstallOptionsonModeSelected={reportSelfDrivingOnboardingInstallModeSelected}- localBlock={<WizardCommandBlock />}+ // The cloud runner only executes the base integration program, not dedicated subcommands,+ // so a dedicated-program step neither offers a run nor lets one queued elsewhere take over.+ offerCloudRun={!wizardOverrides}+ ignoreActiveCloudRun={!!wizardOverrides}+ badges={wizardOverrides?.supports ? <WizardFrameworkBadges items={wizardOverrides.supports} /> : undefined}+ localBlock={+ <WizardCommandBlock+ subcommand={wizardOverrides?.subcommand}+ description={wizardOverrides?.description}+ />+ }/>)}@@ -54,7 +65,10 @@ export function WizardInstallStep(props: VariantProps): JSX.Element {function WizardInstallStepStatic(props: VariantProps): JSX.Element {// Deliberately not gated on the cloud-run flag: a persisted handle is proof the user started a// run while on the test arm, and a mid-experiment flag change must not strand an in-flight run.- const { activeCloudRun } = useValues(activeCloudRunLogic)+ const { activeCloudRun: persistedCloudRun } = useValues(activeCloudRunLogic)+ // A run queued on another step only executes the base program, so a dedicated-program step+ // (wizardOverrides) ignores it: its command stays visible and Continue stays gated.+ const activeCloudRun = props.wizardOverrides ? null : persistedCloudRun// A queued/running cloud run unblocks Continue just like a local takeover: the run keeps going// in the background (surfaced by the FAB) and installation events aren't required.const continueDisabledReason =@@ -66,9 +80,9 @@ function WizardInstallStepStatic(props: VariantProps): JSX.Element {props={props}>{/* The intro's terminal framing makes no sense while a run's progress is on screen. */}- {!activeCloudRun && <WizardInstallIntro />}+ {!activeCloudRun && <WizardInstallIntro description={props.wizardOverrides?.intro} />}<div className="max-w-xl mx-auto">- <LegacyInstallOptions />+ <LegacyInstallOptions wizardOverrides={props.wizardOverrides} /></div></WizardInstallShell>)@@ -76,8 +90,10 @@ function WizardInstallStepStatic(props: VariantProps): JSX.Element {function WizardInstallStepWithSync(props: VariantProps): JSX.Element {const isLocalRunActive = useLocalWizardRunActive()- // See WizardInstallStepStatic: an existing handle renders regardless of the experiment arm.- const { activeCloudRun } = useValues(activeCloudRunLogic)+ // See WizardInstallStepStatic: an existing handle renders regardless of the experiment arm,+ // but a dedicated-program step ignores it (the run only executes the base program).+ const { activeCloudRun: persistedCloudRun } = useValues(activeCloudRunLogic)+ const activeCloudRun = props.wizardOverrides ? null : persistedCloudRun// Once the wizard is in flight (cloud or local), trust it — installation events aren't required// to unblock Continue.const continueDisabledReason =@@ -93,7 +109,7 @@ function WizardInstallStepWithSync(props: VariantProps): JSX.Element {renders inside LegacyInstallOptions (WizardCloudRunBlock pins to it). */}{activeCloudRun ? (<div className="max-w-xl mx-auto">- <LegacyInstallOptions />+ <LegacyInstallOptions wizardOverrides={props.wizardOverrides} /></div>) : isLocalRunActive ? (<div className="max-w-xl mx-auto">@@ -101,9 +117,9 @@ function WizardInstallStepWithSync(props: VariantProps): JSX.Element {</div>) : (<>- <WizardInstallIntro />+ <WizardInstallIntro description={props.wizardOverrides?.intro} /><div className="max-w-xl mx-auto">- <LegacyInstallOptions />+ <LegacyInstallOptions wizardOverrides={props.wizardOverrides} /></div></>)}@@ -143,7 +159,8 @@ function WizardInstallShell({return (<OnboardingStep- title="Install"+ title={props.installTitle}+ subtitle={props.installSubtitle}stepKey={OnboardingStepKey.INSTALL}continueDisabledReason={continueDisabledReason}showSkip={showSkip}diff --git a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/index.tsx b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/index.tsxindex 58040468a214..f0d0cc2171c9 100644--- a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/index.tsx+++ b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/index.tsx@@ -4,6 +4,7 @@ import { useEffect, useRef, useState } from 'react'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { isMobile } from 'lib/utils/dom'+import { humanList } from 'lib/utils/strings'import { availableOnboardingProducts } from 'scenes/onboarding/shared/utils'import { teamLogic } from 'scenes/teamLogic'@@ -20,7 +21,7 @@ import { sdksLogic } from '../sdksLogic'import { MobileInstallHandoff } from './MobileInstallHandoff'import { SDKGrid } from './SDKGrid'import { SDKInstructionsModal } from './SDKInstructionsModal'-import { SDKGridProps, VariantProps } from './types'+import { SDKGridProps, VariantProps, WizardOverrides } from './types'import { WizardInstallStep } from './WizardInstallStep'interface OnboardingInstallStepProps {@@ -32,6 +33,7 @@ interface OnboardingInstallStepProps {/** When true, the realtime check indicator is hidden and Continue is always enabled. */hideInstallationCheck?: booleanheader?: React.ReactNode+ wizardOverrides?: WizardOverrides}/**@@ -46,6 +48,7 @@ export const OnboardingInstallStep: OnboardingStepComponentType<OnboardingInstalteamPropertyToVerify = 'ingested_event',hideInstallationCheck = false,header,+ wizardOverrides,}) => {const {setAvailableSDKInstructionsMap,@@ -60,14 +63,26 @@ export const OnboardingInstallStep: OnboardingStepComponentType<OnboardingInstalconst [mobileHandoffDismissed, setMobileHandoffDismissed] = useState(false)const linkOpenedCapturedRef = useRef(false)const { currentTeam } = useValues(teamLogic)- const { currentStepProductKey, currentFlowStep } = useValues(onboardingLogic)+ const { currentStepProductKey, currentFlowStep, flow } = useValues(onboardingLogic)const productName = currentStepProductKey? availableOnboardingProducts[currentStepProductKey as keyof typeof availableOnboardingProducts]?.name: undefined- // The shared posthog-js step gets a generic "Install" title — naming it after- // the dedup-survivor product would mislead users installing several at once.const isSdkInstallStep = currentFlowStep?.dedupKey === INSTALL_DEDUP_KEYS.POSTHOG_JS- const installTitle = isSdkInstallStep ? 'Install' : productName ? `Install ${productName}` : 'Install your SDK'+ // With several install steps in one flow, a bare "Install" reads as a duplicate, so the shared+ // posthog-js step is titled after its dedup survivor; the subtitle names the full covered set.+ const installStepCount = flow.filter((step) => step.stepKey === OnboardingStepKey.INSTALL).length+ const installTitle =+ isSdkInstallStep && installStepCount <= 1+ ? 'Install'+ : productName+ ? `Install ${productName}`+ : 'Install your SDK'+ // The dedup record is what this step actually covers; other products keep their own install step.+ const coveredNames = (currentFlowStep?.additionalProductKeys ?? [currentStepProductKey])+ .map((key) => availableOnboardingProducts[key as keyof typeof availableOnboardingProducts]?.name)+ .filter((name): name is string => !!name)+ const installSubtitle =+ isSdkInstallStep && coveredNames.length > 1 ? `One install covers ${humanList(coveredNames)}.` : undefinedconst installationCompleteFromTeam = useInstallationComplete(teamPropertyToVerify)const installationComplete = hideInstallationCheck || installationCompleteFromTeam@@ -147,6 +162,9 @@ export const OnboardingInstallStep: OnboardingStepComponentType<OnboardingInstalteamPropertyToVerify,selectedSDK,header,+ wizardOverrides,+ installTitle,+ installSubtitle,}const instructionsModal = selectedSDK && (diff --git a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/types.ts b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/types.tsindex 92a13fd73d7f..6053d89f1784 100644--- a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/types.ts+++ b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/types.ts@@ -1,3 +1,5 @@+import type { WizardBadgeItem } from 'scenes/onboarding/shared/wizard-sync/WizardModeShell'+import { type SDK, SDKInstructionsMap, SDKTag } from '~/types'import { type AdblockDetectionResult } from '../hooks/useAdblockDetection'@@ -16,6 +18,17 @@ export interface SDKGridProps {showTopSkipButton: boolean}+/** Points the wizard install step at a dedicated program (e.g. `ai-observability`) instead of the plain SDK install. */+export interface WizardOverrides {+ subcommand: string+ /** Replaces the "what this does" line under the command. */+ description: React.ReactNode+ /** Replaces the intro paragraph above the command block. */+ intro?: string+ /** Replaces the framework "Supports:" badges. */+ supports?: WizardBadgeItem[]+}+export interface VariantProps {sdkGridProps: SDKGridPropssdkInstructionMap: SDKInstructionsMap@@ -25,4 +38,8 @@ export interface VariantProps {teamPropertyToVerify: stringselectedSDK: SDK | nullheader?: React.ReactNode+ wizardOverrides?: WizardOverrides+ /** Step heading, e.g. "Install AI observability"; a lone install step stays a generic "Install". */+ installTitle: string+ installSubtitle?: string}diff --git a/frontend/src/scenes/onboarding/legacy/sdks/hooks/useInstallationComplete.tsx b/frontend/src/scenes/onboarding/legacy/sdks/hooks/useInstallationComplete.tsxindex 51582c673016..8602fabaa2b9 100644--- a/frontend/src/scenes/onboarding/legacy/sdks/hooks/useInstallationComplete.tsx+++ b/frontend/src/scenes/onboarding/legacy/sdks/hooks/useInstallationComplete.tsx@@ -6,17 +6,49 @@ import { teamLogic } from 'scenes/teamLogic'import type { TeamType } from '~/types'+import { pollRecentAIEvents } from 'products/ai_observability/frontend/utils/aiEvents'++/**+ * Sentinel for `teamPropertyToVerify`: poll for AI events instead of reading a Team boolean,+ * because ingestion flips no team flag for AI events (`ingested_event` goes green on any event).+ */+export const VERIFY_AI_EVENTS = '__ai_events__'++// Gentler than the 2s team-property poll because each miss can run a ClickHouse query.+const AI_EVENTS_POLL_MS = 5000+export const useInstallationComplete = (teamPropertyToVerify: string): boolean => {const { currentTeam } = useValues(teamLogic)const { loadCurrentTeam } = useActions(teamLogic)const [checking, setChecking] = useState(true)- const installationComplete = Boolean(currentTeam?.[teamPropertyToVerify as keyof TeamType])+ const [aiEventsSeen, setAiEventsSeen] = useState(false)+ const isAiEventsCheck = teamPropertyToVerify === VERIFY_AI_EVENTS+ const installationComplete = isAiEventsCheck+ ? aiEventsSeen+ : Boolean(currentTeam?.[teamPropertyToVerify as keyof TeamType])- useInterval(() => {- if (!installationComplete) {- loadCurrentTeam()+ useInterval(+ () => {+ if (installationComplete) {+ return+ }+ if (isAiEventsCheck) {+ if (currentTeam?.id) {+ void pollRecentAIEvents().then((seen) => seen && setAiEventsSeen(true))+ }+ } else {+ loadCurrentTeam()+ }+ },+ isAiEventsCheck ? AI_EVENTS_POLL_MS : 2000+ )++ // Immediate check so a returning user isn't stuck waiting for the first interval tick.+ useEffect(() => {+ if (isAiEventsCheck && !aiEventsSeen && currentTeam?.id) {+ void pollRecentAIEvents().then((seen) => seen && setAiEventsSeen(true))}- }, 2000)+ }, [isAiEventsCheck, aiEventsSeen, currentTeam?.id])useEffect(() => {if (checking && !installationComplete) {diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardCommandBlock.tsx b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardCommandBlock.tsxindex 6ac6968305e5..8e2ae4ed2325 100644--- a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardCommandBlock.tsx+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardCommandBlock.tsx@@ -36,6 +36,8 @@ export function WizardCommandBlock({decoration="rainbow"className="bg-bg-light border border-border hover:border-primary"onCopy={(key) => setCastKey(key)}+ // A subcommand pushes the displayed command past one line.+ condensed={!!subcommand}/><p className="text-xs text-muted mb-0">{description ?? (diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardInstallOptions.tsx b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardInstallOptions.tsxindex 7f163c4530b8..98386130cce1 100644--- a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardInstallOptions.tsx+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardInstallOptions.tsx@@ -28,6 +28,14 @@ export interface WizardInstallOptionsProps {* so offering it there would queue a run that can never succeed.*/offerCloudRun?: boolean+ /**+ * Treat a persisted cloud run as absent. A run queued on another step only executes the base+ * integration program, so a dedicated-program step must keep showing its own command instead+ * of the run's progress.+ */+ ignoreActiveCloudRun?: boolean+ /** Replaces the default framework badge row. */+ badges?: React.ReactNode}/**@@ -42,10 +50,13 @@ export function WizardInstallOptions({onQueued,onModeSelected,offerCloudRun = true,+ ignoreActiveCloudRun = false,+ badges: badgesOverride,}: WizardInstallOptionsProps): JSX.Element {const cloudRunEnabled = useFeatureFlag('ONBOARDING_WIZARD_CLOUD_RUN', 'test')const { isCloudOrDev } = useWizardCommand()- const { activeCloudRun } = useValues(activeCloudRunLogic)+ const { activeCloudRun: persistedCloudRun } = useValues(activeCloudRunLogic)+ const activeCloudRun = ignoreActiveCloudRun ? null : persistedCloudRunconst { clearActiveCloudRun } = useActions(activeCloudRunLogic)const [mode, setMode] = useState<WizardInstallMode>('cloud')@@ -65,11 +76,7 @@ export function WizardInstallOptions({// The frameworks are the same whichever way (and in whichever variant) the wizard runs, so the// badge list rides with the options everywhere. Self-hosted gets no wizard, so no badges either.- const badges = isCloudOrDev && (- <div className="pb-2">- <WizardFrameworkBadges />- </div>- )+ const badges = isCloudOrDev && <div className="pb-2">{badgesOverride ?? <WizardFrameworkBadges />}</div>if (!offerCloud) {// A persisted run outlives the experiment arm: keep rendering its progress (with the localdiff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardModeShell.tsx b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardModeShell.tsxindex 9c512b80e9d8..9b3b2dc042df 100644--- a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardModeShell.tsx+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardModeShell.tsx@@ -21,8 +21,14 @@ import { ReactRouterLogo } from '../logos/ReactRouterLogo'import svelteImage from '../logos/svelte.svg'import vueImage from '../logos/vue.svg'+/** One "Supports:" chip; icon-less items (e.g. "+ 30 more") render as text only. */+export interface WizardBadgeItem {+ name: string+ icon?: string | ComponentType+}+// Frameworks the wizard can set up — the same whichever way it runs, so both modes show them.-const WIZARD_FRAMEWORKS: { name: string; icon: string | ComponentType }[] = [+const WIZARD_FRAMEWORKS: WizardBadgeItem[] = [{ name: 'Next.js', icon: nextjsImage },{ name: 'React', icon: reactImage },{ name: 'Angular', icon: angularImage },@@ -41,22 +47,22 @@ const WIZARD_FRAMEWORKS: { name: string; icon: string | ComponentType }[] = [{ name: 'Python', icon: pythonImage },]-export function WizardFrameworkBadges(): JSX.Element {+export function WizardFrameworkBadges({ items = WIZARD_FRAMEWORKS }: { items?: WizardBadgeItem[] } = {}): JSX.Element {return (<div className="flex flex-wrap gap-1.5 items-center justify-center"><span className="text-xs text-muted">Supports:</span>- {WIZARD_FRAMEWORKS.map((fw) => (+ {items.map((fw) => (<spankey={fw.name}className="inline-flex items-center gap-1 text-xs text-muted bg-bg-light border border-border rounded px-1.5 py-0.5">{typeof fw.icon === 'string' ? (<img src={fw.icon} alt="" className="w-3 h-3 shrink-0" />- ) : (+ ) : fw.icon ? (<span className="inline-flex w-3 h-3 shrink-0 [&_svg]:!w-3 [&_svg]:!h-3"><fw.icon /></span>- )}+ ) : null}{fw.name}</span>))}diff --git a/products/ai_observability/frontend/onboarding/steps.tsx b/products/ai_observability/frontend/onboarding/steps.tsxindex 19039c158e62..67117810d289 100644--- a/products/ai_observability/frontend/onboarding/steps.tsx+++ b/products/ai_observability/frontend/onboarding/steps.tsx@@ -3,13 +3,40 @@ import {AIObservabilitySDKInstructions,AIObservabilitySDKTagOverrides,} from 'scenes/onboarding/legacy/sdks/ai-observability/AIObservabilitySDKInstructions'+import { VERIFY_AI_EVENTS } from 'scenes/onboarding/legacy/sdks/hooks/useInstallationComplete'import { OnboardingInstallStep } from 'scenes/onboarding/legacy/sdks/OnboardingInstallStep'import { type ProductOnboardingProvider } from 'scenes/onboarding/legacy/types'+import { AnthropicLogo } from 'scenes/onboarding/shared/logos/AnthropicLogo'+import geminiImage from 'scenes/onboarding/shared/logos/gemini.svg'+import { LangChainLogo } from 'scenes/onboarding/shared/logos/LangChainLogo'+import { OpenAILogo } from 'scenes/onboarding/shared/logos/OpenAILogo'+import { OpenRouterLogo } from 'scenes/onboarding/shared/logos/OpenRouterLogo'+import type { WizardBadgeItem } from 'scenes/onboarding/shared/wizard-sync/WizardModeShell'import { urls } from 'scenes/urls'import { ProductKey } from '~/queries/schema/schema-general'import { OnboardingStepKey } from '~/types'+// Headline picks from the ~40 variants of the context-mill ai-observability skill group.+const AIO_WIZARD_SUPPORTS: WizardBadgeItem[] = [+ { name: 'OpenAI', icon: OpenAILogo },+ { name: 'Anthropic', icon: AnthropicLogo },+ { name: 'Google Gemini', icon: geminiImage },+ { name: 'AWS Bedrock', icon: 'https://res.cloudinary.com/dmukukwp6/image/upload/bedrock_5c06698148.png' },+ { name: 'Azure OpenAI', icon: 'https://res.cloudinary.com/dmukukwp6/image/upload/azure_openai_884ba0124a.svg' },+ { name: 'LangChain', icon: LangChainLogo },+ { name: 'LlamaIndex', icon: 'https://res.cloudinary.com/dmukukwp6/image/upload/llamaindex_f831132d7c.svg' },+ { name: 'Vercel AI SDK', icon: 'https://res.cloudinary.com/dmukukwp6/image/upload/vercel_373fa70879.svg' },+ {+ name: 'LiteLLM',+ icon: 'https://res.cloudinary.com/dmukukwp6/image/upload/q_auto,f_auto/litellmicon_a2805d75e5.png',+ },+ { name: 'Ollama', icon: 'https://res.cloudinary.com/dmukukwp6/image/upload/ollama_ff56896a1f.svg' },+ { name: 'Mistral', icon: 'https://res.cloudinary.com/dmukukwp6/image/upload/mistral_551c75e2dd.svg' },+ { name: 'OpenRouter', icon: OpenRouterLogo },+ { name: '+ 30 more' },+]+export const aiObservabilityOnboarding: ProductOnboardingProvider = {steps: (ctx) => [{@@ -23,6 +50,14 @@ export const aiObservabilityOnboarding: ProductOnboardingProvider = {sdkInstructionMap={AIObservabilitySDKInstructions}sdkTagOverrides={AIObservabilitySDKTagOverrides}listeningForName="LLM generation"+ teamPropertyToVerify={VERIFY_AI_EVENTS}+ wizardOverrides={{+ subcommand: 'ai-observability',+ intro: 'The setup agent detects your LLM provider, installs the PostHog AI SDK, and instruments your AI calls automatically.',+ description:+ "Detects your LLM SDK and wires up tracing so generations, costs, and latency show up in AI observability. Commit the changes and open a PR when you're ready.",+ supports: AIO_WIZARD_SUPPORTS,+ }}/>),},diff --git a/products/ai_observability/frontend/utils/aiEvents.test.ts b/products/ai_observability/frontend/utils/aiEvents.test.tsindex 6a52e9bae801..44337b06e1a8 100644--- a/products/ai_observability/frontend/utils/aiEvents.test.ts+++ b/products/ai_observability/frontend/utils/aiEvents.test.ts@@ -4,7 +4,7 @@ import { dayjs } from 'lib/dayjs'import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'-import { hasRecentAIEvents } from './aiEvents'+import { hasRecentAIEvents, pollRecentAIEvents } from './aiEvents'describe('aiEventsUtils', () => {beforeEach(() => {@@ -206,4 +206,27 @@ describe('aiEventsUtils', () => {expect(result).toBe(false)})})++ describe('pollRecentAIEvents', () => {+ // One sequential test: the page-load cache is module state, so ordering within a single+ // test is the only way to exercise failure, dedupe, and cache without cross-test coupling.+ it('resolves false on failure, dedupes concurrent checks, then caches a hit for the page load', async () => {+ const listSpy = jest.spyOn(api.eventDefinitions, 'list').mockRejectedValueOnce(new Error('network down'))+ jest.spyOn(api, 'query').mockResolvedValue({ results: [] } as any)+ await expect(pollRecentAIEvents()).resolves.toBe(false)+ expect(listSpy).toHaveBeenCalledTimes(1)++ listSpy.mockResolvedValue({+ results: [{ id: '1', name: '$ai_generation', last_seen_at: dayjs().subtract(1, 'day').toISOString() }],+ count: 1,+ } as any)+ const [first, second] = await Promise.all([pollRecentAIEvents(), pollRecentAIEvents()])+ expect(first).toBe(true)+ expect(second).toBe(true)+ expect(listSpy).toHaveBeenCalledTimes(2)++ await expect(pollRecentAIEvents()).resolves.toBe(true)+ expect(listSpy).toHaveBeenCalledTimes(2)+ })+ })})diff --git a/products/ai_observability/frontend/utils/aiEvents.ts b/products/ai_observability/frontend/utils/aiEvents.tsindex dc7567bdb9fe..4ab57b801eba 100644--- a/products/ai_observability/frontend/utils/aiEvents.ts+++ b/products/ai_observability/frontend/utils/aiEvents.ts@@ -47,3 +47,33 @@ export async function hasRecentAIEvents(): Promise<boolean> {return (response.results?.length ?? 0) > 0}++let seenAiEvents = false+let inFlightAiEventsCheck: Promise<boolean> | null = null++async function runAiEventsCheck(): Promise<boolean> {+ try {+ if (await hasRecentAIEvents()) {+ seenAiEvents = true+ }+ return seenAiEvents+ } catch {+ // A transient API failure reads as "not seen yet"; the poll retries on its next tick.+ return false+ } finally {+ inFlightAiEventsCheck = null+ }+}++/**+ * Shares one in-flight check and caches a hit, so the several install-step components polling+ * at once run at most one ClickHouse probe per tick. The query runs against the current project,+ * and switching projects reloads the page, so the cache is honest for a whole page load.+ */+export function pollRecentAIEvents(): Promise<boolean> {+ if (seenAiEvents) {+ return Promise.resolve(true)+ }+ inFlightAiEventsCheck ??= runAiEventsCheck()+ return inFlightAiEventsCheck+}diff --git a/products/mcp_analytics/frontend/onboarding/MCPAnalyticsInstall.tsx b/products/mcp_analytics/frontend/onboarding/MCPAnalyticsInstall.tsxindex bccaae1fcf5d..4dc2a5d2ba46 100644--- a/products/mcp_analytics/frontend/onboarding/MCPAnalyticsInstall.tsx+++ b/products/mcp_analytics/frontend/onboarding/MCPAnalyticsInstall.tsx@@ -79,6 +79,7 @@ export function MCPAnalyticsInstallHero(): JSX.Element {size="md"decoration="rainbow"className="bg-bg-light border border-border hover:border-primary"+ condensed/><p className="text-xs text-muted mb-0">{currentTeam?.name ? (diff --git a/products/mcp_analytics/frontend/onboarding/steps.tsx b/products/mcp_analytics/frontend/onboarding/steps.tsxindex 9e6f60511a24..5c91ca032bc7 100644--- a/products/mcp_analytics/frontend/onboarding/steps.tsx+++ b/products/mcp_analytics/frontend/onboarding/steps.tsx@@ -4,6 +4,7 @@ import { useEffect } from 'react'import { onboardingLogic } from 'scenes/onboarding/legacy/onboardingLogic'import { OnboardingStep } from 'scenes/onboarding/legacy/OnboardingStep'import { type ProductOnboardingProvider } from 'scenes/onboarding/legacy/types'+import { availableOnboardingProducts } from 'scenes/onboarding/shared/utils'import { urls } from 'scenes/urls'import { ProductKey } from '~/queries/schema/schema-general'@@ -25,7 +26,11 @@ function MCPAnalyticsInstallStep(): JSX.Element {}, [onboardingState, completeOnboarding])return (- <OnboardingStep title="Install" stepKey={OnboardingStepKey.INSTALL} continueText="Go to dashboard">+ <OnboardingStep+ title={`Install ${availableOnboardingProducts[ProductKey.MCP_ANALYTICS].name}`}+ stepKey={OnboardingStepKey.INSTALL}+ continueText="Go to dashboard"+ ><div className="mt-6"><MCPAnalyticsInstallHero /></div>