Skip to content

: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.

fix(homepage): keep data widgets off the initial home load (#122072)

Paul D'Ambra73efde118427
diff --git a/frontend/bin/check-eager-graph.mjs b/frontend/bin/check-eager-graph.mjs
index 911be368c93c..076f11ec9cb8 100644
--- a/frontend/bin/check-eager-graph.mjs
+++ b/frontend/bin/check-eager-graph.mjs
@@ -167,6 +167,20 @@ const ROOTS = [
'src/queries/Query/Query.tsx',
],
},
+ {
+ root: [
+ AUTHENTICATED_SHELL,
+ 'src/scenes/project-homepage/ProjectHomepage.tsx',
+ 'src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx',
+ ],
+ label: 'AI-first home path',
+ budgetBytes: 9_400_000,
+ forbidden: [
+ 'products/posthog_ai/frontend/components/tool/widgets/VisualizationWidget.tsx',
+ 'products/posthog_ai/frontend/components/tool/widgets/RecordingsWidget.tsx',
+ 'src/queries/Query/Query.tsx',
+ ],
+ },
{
root: 'src/scenes/activity/explore/EventsScene.tsx',
label: 'events scene',
diff --git a/frontend/src/scenes/max/AGENTS.md b/frontend/src/scenes/max/AGENTS.md
index cff8c119a937..d4e35bb19bd2 100644
--- a/frontend/src/scenes/max/AGENTS.md
+++ b/frontend/src/scenes/max/AGENTS.md
@@ -62,7 +62,7 @@ recordings, notebook, query) live in `products/posthog_ai/frontend/components/to
and replay vision own their widget families under their respective `products/<product>/frontend` directories.
Error tracking contributes a declaration list to the central manifest, so its cards render on the sandbox path too.
Replay vision has no declaration yet, so its scan widget renders only on the LangGraph path until one is added.
-Max's LangGraph path consumes the heavier ones (`VisualizationWidget` / `RecordingsWidget`) through `api/primitives`,
+Max's LangGraph path consumes the heavier ones (`VisualizationWidget` / `RecordingsWidget`) through `api/dataWidgets`,
and error-tracking and replay-vision widgets directly from their owning products.
## 5. Where do I add X?
diff --git a/frontend/src/scenes/max/Thread.tsx b/frontend/src/scenes/max/Thread.tsx
index e6924c02ee09..ff7a392dcac9 100644
--- a/frontend/src/scenes/max/Thread.tsx
+++ b/frontend/src/scenes/max/Thread.tsx
@@ -65,6 +65,7 @@ import { DataVisualizationNode, InsightVizNode } from '~/queries/schema/schema-g
import { isDataVisualizationNode, isHogQLQuery } from '~/queries/utils'
import { PendingApproval, RecordingUniversalFilters, Region } from '~/types'
+import { RecordingsWidget } from 'products/posthog_ai/frontend/api/dataWidgets'
import {
AGENT_TOOL_APPLY_BACK_CONTEXT_ITEM,
getThinkingMessageFromResponse,
@@ -79,7 +80,6 @@ import {
MarkdownMessage,
MessageTemplate,
ReasoningAnswer,
- RecordingsWidget,
ThreadView,
TurnTrailerActions,
type TurnTrailer,
diff --git a/frontend/src/scenes/max/messages/UIPayloadAnswer.tsx b/frontend/src/scenes/max/messages/UIPayloadAnswer.tsx
index efe524211a78..93638a34627e 100644
--- a/frontend/src/scenes/max/messages/UIPayloadAnswer.tsx
+++ b/frontend/src/scenes/max/messages/UIPayloadAnswer.tsx
@@ -5,7 +5,8 @@ import { AssistantTool } from '~/queries/schema/schema-assistant-messages'
import { RecordingUniversalFilters } from '~/types'
import { ErrorTrackingFiltersWidget } from 'products/error_tracking/frontend/posthogAi/ErrorTrackingFiltersWidget'
-import { MessageTemplate, RecordingsWidget } from 'products/posthog_ai/frontend/api/primitives'
+import { RecordingsWidget } from 'products/posthog_ai/frontend/api/dataWidgets'
+import { MessageTemplate } from 'products/posthog_ai/frontend/api/primitives'
import { isDangerousOperationResponse, normalizeDangerousOperationResponse } from '../approvalOperationUtils'
import { DangerousOperationApprovalCard } from '../DangerousOperationApprovalCard'
diff --git a/frontend/src/scenes/max/messages/VisualizationArtifact.tsx b/frontend/src/scenes/max/messages/VisualizationArtifact.tsx
index 942980c72edc..c52df6a2ef3c 100644
--- a/frontend/src/scenes/max/messages/VisualizationArtifact.tsx
+++ b/frontend/src/scenes/max/messages/VisualizationArtifact.tsx
@@ -10,7 +10,7 @@ import { Scene } from 'scenes/sceneTypes'
import { ArtifactMessage, VisualizationArtifactContent } from '~/queries/schema/schema-assistant-messages'
-import { VisualizationWidget, getArtifactOpenTarget } from 'products/posthog_ai/frontend/api/primitives'
+import { VisualizationWidget, getArtifactOpenTarget } from 'products/posthog_ai/frontend/api/dataWidgets'
import { MessageStatus } from '../maxLogic'
diff --git a/products/posthog_ai/frontend/AGENTS.md b/products/posthog_ai/frontend/AGENTS.md
index 8dc57f8cc1b1..32027b081ee5 100644
--- a/products/posthog_ai/frontend/AGENTS.md
+++ b/products/posthog_ai/frontend/AGENTS.md
@@ -115,7 +115,7 @@ It must stay **free of the Max scene and conversation orchestration**. Do not im
`PermissionInput` isolates lazy loading and rendering errors with evidence fallbacks; approval controls
remain outside both boundaries. The error boundary resets for a new permission request.
Max's frozen LangGraph path consumes `VisualizationWidget` and `RecordingsWidget` through
- `api/primitives`, and the error-tracking and replay-vision widgets from their owning products.
+ `api/dataWidgets`, and the error-tracking and replay-vision widgets from their owning products.
- If Max needs something the surface doesn't express generically, **lift it to a generic prop/selector here
and have Max adapt** — never special-case Max in this directory. (The recordings "accept these filters"
bar is one such lift: `RecordingsWidget` takes an optional `onAcceptFilters` prop; Max's LangGraph path
diff --git a/products/posthog_ai/frontend/README.md b/products/posthog_ai/frontend/README.md
index 355321267561..beb4714c0c15 100644
--- a/products/posthog_ai/frontend/README.md
+++ b/products/posthog_ai/frontend/README.md
@@ -27,7 +27,8 @@ side-effectful tool registry (`api/tools`) and the markdown/virtualization-heavy
must not leak into a bundle that only needs a status helper from `api/logics`. A status badge that imports
a fat path drags presenters and the registry into its chunk; importing `api/logics` alone does not.
In the same way, an eager surface that only needs an input box imports `Composer` from `api/composer`,
-because `api/primitives` pulls the query and insight stack through its thread presenters.
+while chart and recording widgets use `api/dataWidgets`.
+This keeps the query and replay code out of an input-only surface.
There is deliberately **no root `index.ts` barrel** — a barrel that re-exports every tier would
re-introduce the exact bundling problem the split solves. Always import an `api/<module>`.
@@ -36,12 +37,12 @@ re-introduce the exact bundling problem the split solves. Always import an `api/
Pick the **lowest tier** that does the job.
-| Tier | Module | What's in it | Use when |
-| ------------------------------ | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| **1 — Prepackaged surfaces** | `api/readableRun` + `api/runSurface` + `api/runner` | `ReadonlyRunSurface` (lazy, code-split read-only embed); the `RunSurface` compound (`Root` + slots, eager) for custom layouts; `EmbeddedRunner` (lazy TaskTracker workspace for inline hosts) | "Just show a run" → `ReadonlyRunSurface` (inbox embeds). "Drive a run / custom layout" → `RunSurface` (tasks). "Embed the `/tasks` workspace" → `EmbeddedRunner` (Max). |
-| **2 — Compound primitives** | `api/primitives` + `api/composer` | `Thread` + atoms (`.Message/.Markdown/.Reasoning/.Failure/.Activity/.ToolCall`), `ThreadView`, `AttachedContextBar`, task navigation items and filters, `QueuedMessageList`, `RunLogSkeleton`, activity primitives + `RunActivity`, message presenters, permission/question/resource surfaces; `api/composer` holds `Composer.*` and the quill composer frame | Custom layout, shared navigation, or a bespoke/compact thread. An input box alone imports only `api/composer`. |
-| **3 — Headless logic + types** | `api/logics` + `api/types` | `runStreamLogic`, `runInteractionLogic`, `tasksLogic`, status helpers (`isTerminalRunStatus`, `INITIAL_PERMISSION_MODE`), thinking-message helpers, context injection (`attachedContextLogic`, `useAttachedContext`, `contextPickerLogic`), tool-stream subscriptions (`toolStreamEventsLogic`, `useToolStreamListener`); folded-thread, task, and tool types | Status badge, automation, context injection, task navigation, tool-event listeners — no presenters or registry. |
-| **4 — Extension seam** | `api/tools` | `toolRegistry`, `lookupToolRenderer`, `GenericMcpToolRenderer`, `DataToolRow`, `ToolActivity`, `FilePath`, diff helpers | Your product renders tool cards (insights, dashboards…). Declare them in your product list and include it in the central manifest. |
+| Tier | Module | What's in it | Use when |
+| ------------------------------ | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| **1 — Prepackaged surfaces** | `api/readableRun` + `api/runSurface` + `api/runner` | `ReadonlyRunSurface` (lazy, code-split read-only embed); the `RunSurface` compound (`Root` + slots, eager) for custom layouts; `EmbeddedRunner` (lazy TaskTracker workspace for inline hosts) | "Just show a run" → `ReadonlyRunSurface` (inbox embeds). "Drive a run / custom layout" → `RunSurface` (tasks). "Embed the `/tasks` workspace" → `EmbeddedRunner` (Max). |
+| **2 — Compound primitives** | `api/primitives` + `api/composer` + `api/dataWidgets` | `Thread` + atoms (`.Message/.Markdown/.Reasoning/.Failure/.Activity/.ToolCall`), `ThreadView`, `AttachedContextBar`, task navigation items and filters, `QueuedMessageList`, `RunLogSkeleton`, activity primitives + `RunActivity`, message presenters, permission/question/resource surfaces; `api/composer` holds `Composer.*` and the quill composer frame | Custom layout, shared navigation, or a bespoke/compact thread. An input box alone imports only `api/composer`. Chart and recording widgets use `api/dataWidgets`. |
+| **3 — Headless logic + types** | `api/logics` + `api/types` | `runStreamLogic`, `runInteractionLogic`, `tasksLogic`, status helpers (`isTerminalRunStatus`, `INITIAL_PERMISSION_MODE`), thinking-message helpers, context injection (`attachedContextLogic`, `useAttachedContext`, `contextPickerLogic`), tool-stream subscriptions (`toolStreamEventsLogic`, `useToolStreamListener`); folded-thread, task, and tool types | Status badge, automation, context injection, task navigation, tool-event listeners — no presenters or registry. |
+| **4 — Extension seam** | `api/tools` | `toolRegistry`, `lookupToolRenderer`, `GenericMcpToolRenderer`, `DataToolRow`, `ToolActivity`, `FilePath`, diff helpers | Your product renders tool cards (insights, dashboards…). Declare them in your product list and include it in the central manifest. |
The Tier 1 surfaces are built on `api/primitives` (Tier 2), which consumes the headless
`api/logics`/`api/types` (Tier 3). Going down a tier trades convenience for control and a smaller chunk.
diff --git a/products/posthog_ai/frontend/api/dataWidgets.ts b/products/posthog_ai/frontend/api/dataWidgets.ts
new file mode 100644
index 000000000000..efd3bcdcc484
--- /dev/null
+++ b/products/posthog_ai/frontend/api/dataWidgets.ts
@@ -0,0 +1,5 @@
+// Product data-tool widgets — the atomic PostHog-entity renderers Max's LangGraph path composes directly
+// (the sandbox path reaches them through the tool registry, not these exports).
+export { VisualizationWidget, getArtifactOpenTarget } from '../components/tool/widgets/VisualizationWidget'
+export type { VisualizationWidgetProps } from '../components/tool/widgets/VisualizationWidget'
+export { RecordingsWidget } from '../components/tool/widgets/RecordingsWidget'
diff --git a/products/posthog_ai/frontend/api/primitives.ts b/products/posthog_ai/frontend/api/primitives.ts
index 7a56f217cb50..bcc0afc6f65a 100644
--- a/products/posthog_ai/frontend/api/primitives.ts
+++ b/products/posthog_ai/frontend/api/primitives.ts
@@ -85,9 +85,3 @@ export { ContextUsageChip } from '../components/ContextUsageChip'
export { QuestionField, MultiFieldQuestion, isFieldValid } from '../components/QuestionField'
export { OptionSelector } from '../components/OptionSelector'
export type { Option } from '../components/OptionSelector'
-
-// Product data-tool widgets — the atomic PostHog-entity renderers Max's LangGraph path composes directly
-// (the sandbox path reaches them through the tool registry, not these exports).
-export { VisualizationWidget, getArtifactOpenTarget } from '../components/tool/widgets/VisualizationWidget'
-export type { VisualizationWidgetProps } from '../components/tool/widgets/VisualizationWidget'
-export { RecordingsWidget } from '../components/tool/widgets/RecordingsWidget'