: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(desktop): show the Self-driving welcome takeover in the reports inbox (#92955)
posthog[bot]d3f479be4ae2
diff --git a/products/desktop/packages/ui/src/features/inbox/AGENTS.md b/products/desktop/packages/ui/src/features/inbox/AGENTS.mdindex 3c66f733ca9e..e75072681569 100644--- a/products/desktop/packages/ui/src/features/inbox/AGENTS.md+++ b/products/desktop/packages/ui/src/features/inbox/AGENTS.md@@ -128,6 +128,8 @@ Responder setup lives in `features/agents/components/AgentsView.tsx`, which mounOnboarding/setup should be task-backed when it starts work. Do not model it as a static checklist if the intended behavior is to launch an agent task.+An empty Reports view has two distinct causes, and they need different copy: nothing configured yet, versus configured with nothing found. `useSelfDrivingSetupStatus` (`hooks/useSelfDrivingSetupStatus.ts`) reads enabled signal source and scout counts to tell them apart. `ReportsInboxView` only sets `showConfigureAgentsEmptyState` when the inbox is empty with no active filters, so a genuinely quiet but configured project still gets "Nothing to review", not the welcome copy again. The welcome state's CTA links to this same configuration surface; it does not duplicate setup logic.+## UI ArchitectureThe current UI is single-column, route-based, and card/list oriented. Do not reintroduce the old split-pane list/detail layout.diff --git a/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.test.tsx b/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.test.tsxindex 54961ec0b287..475799a0717f 100644--- a/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.test.tsx+++ b/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.test.tsx@@ -7,7 +7,8 @@ import { beforeEach, describe, expect, it, vi } from "vitest";const mocks = vi.hoisted(() => ({activeReports: [] as SignalReport[],- sourceConfigs: [{ enabled: true }] as { enabled: boolean }[],+ setupStatusLoading: false,+ setupConfigured: true,navigateToAgents: vi.fn(),navigateToInboxReportDetail: vi.fn(),prefetchReport: vi.fn(),@@ -122,11 +123,10 @@ vi.mock("@posthog/ui/features/inbox/hooks/useInboxSectionCounts", () => ({}),}));-vi.mock("@posthog/ui/features/inbox/hooks/useSignalSourceConfigs", () => ({- useSignalSourceConfigs: () => ({- data: mocks.sourceConfigs,- isPending: false,- isSuccess: true,+vi.mock("@posthog/ui/features/inbox/hooks/useSelfDrivingSetupStatus", () => ({+ useSelfDrivingSetupStatus: () => ({+ isLoading: mocks.setupStatusLoading,+ isConfigured: mocks.setupConfigured,}),}));@@ -219,7 +219,8 @@ describe("ReportsInboxView", () => {beforeEach(() => {vi.clearAllMocks();mocks.activeReports = [];- mocks.sourceConfigs = [{ enabled: true }];+ mocks.setupStatusLoading = false;+ mocks.setupConfigured = true;mocks.searchQuery = "checkout";mocks.triageFocusEnabled = false;mocks.triageProps = null;@@ -259,15 +260,23 @@ describe("ReportsInboxView", () => {});it("offers agent configuration when no reports or agents exist", async () => {- mocks.sourceConfigs = [];+ mocks.setupConfigured = false;render(<ReportsInboxView />);- expect(screen.getByText("Nothing to review")).toBeTruthy();+ expect(screen.getByText("Ship fixes while you sleep")).toBeTruthy();expect(screen.getAllByText("Configure agents")).toHaveLength(1);await userEvent.click(screen.getByText("Configure agents"));expect(mocks.navigateToAgents).toHaveBeenCalledOnce();});+ it("shows the plain empty state instead of the welcome when something is configured", () => {+ mocks.setupConfigured = true;+ render(<ReportsInboxView />);++ expect(screen.getByText("Nothing to review")).toBeTruthy();+ expect(screen.queryByText("Ship fixes while you sleep")).toBeNull();+ });+it("opens a report on the first click without preloading its route", async () => {mocks.activeReports = [activeReport("first-report", "First report")];mocks.searchQuery = "";diff --git a/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.tsx b/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.tsxindex 03a6ea4e325b..7b023b0be2b5 100644--- a/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.tsx+++ b/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxView.tsx@@ -14,7 +14,7 @@ import { ReportsInboxViewPresentation } from "@posthog/ui/features/inbox/componeimport { ReportTriageFocus } from "@posthog/ui/features/inbox/components/ReportTriageFocus";import { useInboxAllReports } from "@posthog/ui/features/inbox/hooks/useInboxAllReports";import { useInboxTriageOrigin } from "@posthog/ui/features/inbox/hooks/useInboxBackTarget";-import { useSignalSourceConfigs } from "@posthog/ui/features/inbox/hooks/useSignalSourceConfigs";+import { useSelfDrivingSetupStatus } from "@posthog/ui/features/inbox/hooks/useSelfDrivingSetupStatus";import { useTrackReportsInboxViewed } from "@posthog/ui/features/inbox/hooks/useTrackReportsInboxViewed";import {DEFAULT_INBOX_REPORT_STATE_FILTER,@@ -91,7 +91,7 @@ export function ReportsInboxView(): React.JSX.Element {sortDirection,} = reviewAndMergeQuery;const triageFocusEnabled = useTriageFocusEnabled();- const sourceConfigs = useSignalSourceConfigs();+ const setupStatus = useSelfDrivingSetupStatus();const triageOrigin = useInboxTriageOrigin();const navigate = useNavigate();const [focusMode, setFocusMode] = useState(() => triageOrigin !== null);@@ -293,12 +293,12 @@ export function ReportsInboxView(): React.JSX.Element {const isEmpty = isSuccess && reportCount === 0;const isAgentConfigurationLoading =- isEmpty && !hasActiveFilters && sourceConfigs.isPending;+ isEmpty && !hasActiveFilters && setupStatus.isLoading;const showConfigureAgentsEmptyState =isEmpty &&!hasActiveFilters &&- sourceConfigs.isSuccess &&- !sourceConfigs.data?.some((config) => config.enabled);+ !setupStatus.isLoading &&+ !setupStatus.isConfigured;return (<ReportsInboxViewPresentationdiff --git a/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxViewPresentation.tsx b/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxViewPresentation.tsxindex abf54ea8b05c..6f08e7162f65 100644--- a/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxViewPresentation.tsx+++ b/products/desktop/packages/ui/src/features/inbox/components/ReportsInboxViewPresentation.tsx@@ -2,6 +2,7 @@ import {EnvelopeSimpleIcon,FunnelIcon,ListChecksIcon,+ SparkleIcon,} from "@phosphor-icons/react";import {Button,@@ -156,21 +157,27 @@ export function ReportsInboxViewPresentation({<Empty className="mx-auto max-w-md flex-none border-0 py-12"><EmptyHeader><EmptyMedia variant="icon">- {hasActiveFilters ? (+ {showConfigureAgentsEmptyState ? (+ <SparkleIcon size={24} />+ ) : hasActiveFilters ? (<FunnelIcon size={24} />) : (<EnvelopeSimpleIcon size={24} />)}</EmptyMedia><EmptyTitle>- {hasActiveFilters- ? "No reports match your filters"- : "Nothing to review"}+ {showConfigureAgentsEmptyState+ ? "Ship fixes while you sleep"+ : hasActiveFilters+ ? "No reports match your filters"+ : "Nothing to review"}</EmptyTitle><EmptyDescription>- {hasActiveFilters- ? "Clear the filters to check for hidden reports."- : "Reports show up here as your agents find things worth acting on."}+ {showConfigureAgentsEmptyState+ ? "PostHog watches your session replays, errors, and Slack, then opens a pull request when it finds something worth fixing. Connect a source to get started."+ : hasActiveFilters+ ? "Clear the filters to check for hidden reports."+ : "Reports show up here as your agents find things worth acting on."}</EmptyDescription></EmptyHeader>{(hasActiveFilters || showConfigureAgentsEmptyState) && (diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/useSelfDrivingSetupStatus.test.ts b/products/desktop/packages/ui/src/features/inbox/hooks/useSelfDrivingSetupStatus.test.tsnew file mode 100644index 000000000000..d7188e3c148a--- /dev/null+++ b/products/desktop/packages/ui/src/features/inbox/hooks/useSelfDrivingSetupStatus.test.ts@@ -0,0 +1,55 @@+import { renderHook } from "@testing-library/react";+import { describe, expect, it, vi } from "vitest";++const mocks = vi.hoisted(() => ({+ sourceConfigs: undefined as { enabled: boolean }[] | undefined,+ sourcesLoading: false,+ scoutConfigs: undefined as { enabled: boolean }[] | undefined,+ scoutsLoading: false,+}));++vi.mock("@posthog/ui/features/inbox/hooks/useSignalSourceConfigs", () => ({+ useSignalSourceConfigs: () => ({+ data: mocks.sourceConfigs,+ isLoading: mocks.sourcesLoading,+ }),+}));++vi.mock("@posthog/ui/features/scouts/hooks/useScoutConfigs", () => ({+ useScoutConfigs: () => ({+ data: mocks.scoutConfigs,+ isLoading: mocks.scoutsLoading,+ }),+}));++import { useSelfDrivingSetupStatus } from "./useSelfDrivingSetupStatus";++describe("useSelfDrivingSetupStatus", () => {+ it.each([+ ["no sources or scouts", [], [], false],+ ["only a disabled source", [{ enabled: false }], [], false],+ ["an enabled source", [{ enabled: true }], [], true],+ ["only an enabled scout", [], [{ enabled: true }], true],+ ] as const)(+ "reports isConfigured=%s for %s",+ (_label, sourceConfigs, scoutConfigs, expected) => {+ mocks.sourceConfigs = [...sourceConfigs];+ mocks.scoutConfigs = [...scoutConfigs];++ const { result } = renderHook(() => useSelfDrivingSetupStatus());++ expect(result.current.isConfigured).toBe(expected);+ },+ );++ it("stays loading until both queries settle", () => {+ mocks.sourceConfigs = undefined;+ mocks.scoutConfigs = undefined;+ mocks.sourcesLoading = true;+ mocks.scoutsLoading = false;++ const { result } = renderHook(() => useSelfDrivingSetupStatus());++ expect(result.current.isLoading).toBe(true);+ });+});diff --git a/products/desktop/packages/ui/src/features/inbox/hooks/useSelfDrivingSetupStatus.ts b/products/desktop/packages/ui/src/features/inbox/hooks/useSelfDrivingSetupStatus.tsnew file mode 100644index 000000000000..fac89456abb9--- /dev/null+++ b/products/desktop/packages/ui/src/features/inbox/hooks/useSelfDrivingSetupStatus.ts@@ -0,0 +1,29 @@+import { useSignalSourceConfigs } from "@posthog/ui/features/inbox/hooks/useSignalSourceConfigs";+import { useScoutConfigs } from "@posthog/ui/features/scouts/hooks/useScoutConfigs";++export interface SelfDrivingSetupStatus {+ isLoading: boolean;+ /** At least one signal source or scout is enabled. */+ isConfigured: boolean;+}++/**+ * Whether Self-driving has anything to watch yet. Mirrors the web inbox's+ * `isSelfDrivingSetUp` check (enabled sources + enabled scouts > 0), so the+ * two surfaces agree on when a project still needs the welcome takeover.+ */+export function useSelfDrivingSetupStatus(): SelfDrivingSetupStatus {+ const { data: sourceConfigs, isLoading: sourcesLoading } =+ useSignalSourceConfigs();+ const { data: scoutConfigs, isLoading: scoutsLoading } = useScoutConfigs();++ const enabledSourceCount =+ sourceConfigs?.filter((config) => config.enabled).length ?? 0;+ const enabledScoutCount =+ scoutConfigs?.filter((config) => config.enabled).length ?? 0;++ return {+ isLoading: sourcesLoading || scoutsLoading,+ isConfigured: enabledSourceCount + enabledScoutCount > 0,+ };+}