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.

feat(posthog_ai): remove the PostHog resources used bar (#96462)

Georgiy Tarasov80a8bbc9f604
diff --git a/frontend/src/scenes/max/Thread.tsx b/frontend/src/scenes/max/Thread.tsx
index 8443d1613624..bf166efcf38b 100644
--- a/frontend/src/scenes/max/Thread.tsx
+++ b/frontend/src/scenes/max/Thread.tsx
@@ -81,7 +81,6 @@ import {
ReasoningAnswer,
RecordingsWidget,
ReplayVisionScanWidget,
- ResourcesBar,
ThreadView,
TurnFeedbackActions,
type TurnTrailer,
@@ -407,7 +406,6 @@ export function SandboxComposerSurfaces(): JSX.Element | null {
props={{ streamKey: sandboxConversationKey, conversationId: sandboxConversationKey }}
>
<div className="w-full max-w-180 self-center mx-auto">
- <ResourcesBar />
<ContextUsageBar />
</div>
</BindLogic>
diff --git a/products/posthog_ai/README.md b/products/posthog_ai/README.md
index cb3ea3c7cfc3..aeead7323621 100644
--- a/products/posthog_ai/README.md
+++ b/products/posthog_ai/README.md
@@ -146,7 +146,7 @@ The built-in PostHog widgets (insights, dashboards, recordings, error tracking,
## Seam 5 (advanced) — build a custom UI on the run primitives
-The same facade exposes the machinery for rendering and driving an agent run yourself: `ReadonlyRunSurface` (lazy read-only embed), the `RunSurface` compound (`Root` plus `.Thread` / `.Composer` / `.Resources` / `.ContextUsage` slots), `EmbeddedRunner` (the whole `/tasks` product inline), and the Tier 2 primitives — `Thread` atoms, `Composer.*`, permission and question surfaces — over `runStreamLogic` and `runInteractionLogic`.
+The same facade exposes the machinery for rendering and driving an agent run yourself: `ReadonlyRunSurface` (lazy read-only embed), the `RunSurface` compound (`Root` plus `.Thread` / `.Composer` / `.ContextUsage` slots), `EmbeddedRunner` (the whole `/tasks` product inline), and the Tier 2 primitives — `Thread` atoms, `Composer.*`, permission and question surfaces — over `runStreamLogic` and `runInteractionLogic`.
**Avoid this unless you know exactly what you're doing.** Seams 1–4 are what a product integration needs. This one means owning stream binding, composer and queue state, permission routing, and the eager-vs-lazy choice that decides whether your surface doubles someone's bundle. There is no default layout, so you compose one.
diff --git a/products/posthog_ai/frontend/AGENTS.md b/products/posthog_ai/frontend/AGENTS.md
index d3e2bd80d2c9..3deb3b373780 100644
--- a/products/posthog_ai/frontend/AGENTS.md
+++ b/products/posthog_ai/frontend/AGENTS.md
@@ -21,7 +21,7 @@ import rule, and copy-paste recipes live in the consumer-facing [`README.md`](./
| Tier | Module | What's in it |
| ------------------------------ | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **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 product for inline hosts) |
-| **2 — Compound primitives** | `api/primitives` | `Thread` + atoms, `ThreadView`, `Composer.*`, `QueuedMessageList`, `RunLogSkeleton`, activity primitives + `RunActivity`, message presenters, permission/question/resource surfaces |
+| **2 — Compound primitives** | `api/primitives` | `Thread` + atoms, `ThreadView`, `Composer.*`, `QueuedMessageList`, `RunLogSkeleton`, activity primitives + `RunActivity`, message presenters, permission/question surfaces |
| **3 — Headless logic + types** | `api/logics` + `api/types` | `runStreamLogic`, `runInteractionLogic`, status + thinking helpers; folded-thread + tool types |
| **4 — Extension seam** | `api/tools` | `toolRegistry`, `registerToolRenderers`, `lookupToolRenderer`, `GenericMcpToolRenderer`, `DataToolRow`, `ToolActivity`, `FilePath`, diff helpers |
@@ -40,18 +40,18 @@ reached through an `api/<module>` entry; add new exports to the relevant tier mo
The headline exports per module:
- **`api/readableRun`** — **`ReadonlyRunSurface`**, the lazy, code-split read-only embed: calling
- `<ReadonlyRunSurface .../>` renders the run thread (and, for a live run, the meta bars) behind a
+ `<ReadonlyRunSurface .../>` renders the run thread (with the context-usage footer for a live run) behind a
`RunLogSkeleton` Suspense fallback — no composer, no approval prompt. The heavy chunk (the `RunSurface`
compound — stream logic, virtualized thread, tool/diff renderers) is reached only through its dynamic
`import()`, so importing this light module never statically pulls the impl. This is the form every **embed**
uses (the inbox detail views), where the surface is a secondary panel worth splitting out. It streams fresh
frames while running when `interaction='live'`, and replays the snapshot once when `'read-only'`.
-- **`api/runSurface`** — the **`RunSurface`** compound (`Root` + the `.Thread/.Composer/.Resources/.ContextUsage`
+- **`api/runSurface`** — the **`RunSurface`** compound (`Root` + the `.Thread/.Composer/.ContextUsage`
slots), **eager**, for consumers that build a **custom layout**. `RunSurface.Root` binds the stream logic and
bootstraps the run; the slots compose into whatever layout the surface needs. `RunSurface.Composer` is the
input-region slot — it owns prompt-vs-composer precedence (a pending approval/question replaces the composer)
and the null-bootstrap gate, and takes the composer UI as `children`; omit it for no input region. The meta
- slots (`.Resources`/`.ContextUsage`) self-bind and self-hide when empty. There is **no default layout** — the
+ slot (`.ContextUsage`) self-binds and self-hides when empty. There is **no default layout** — the
prepackaged read-only embed (`ReadonlyRunSurface`) is one concrete composition; the runner scene
(`scenes/TaskTracker/TaskRunChat`) composes its own live-composer layout. Because the compound is eager, import
it only from an already route-split scene (the `/tasks` runner) or another lazily-loaded layout module — a
@@ -68,7 +68,7 @@ The headline exports per module:
`value`/`onChange`/`onSubmit`), **`RunLogSkeleton`** (the shared "run log is loading" loader — the
`ReadonlyRunSurface` Suspense fallback and the `RunSurface` bootstrap fallback, also used by the runner
scene), activity primitives, message
- presenters, and the permission/question/resource surfaces.
+ presenters, and the permission/question surfaces.
- **`api/logics`** — **`runStreamLogic`** (SSE stream + thread projection, see §3),
**`runInteractionLogic`** (Max-agnostic follow-up/queue facade), status helpers
(`isTerminalRunStatus`, `INITIAL_PERMISSION_MODE`), thinking-message helpers,
@@ -223,13 +223,13 @@ api/ # public API facade — the contract (import api/<module>, n
readableRun.ts # Tier 1: ReadonlyRunSurface (lazy read-only embed)
runSurface.ts # Tier 1: RunSurface compound (Root + slots, eager) for custom layouts
runner.ts # Tier 1: EmbeddedRunner (lazy TaskTracker product) for inline hosts
- primitives.ts # Tier 2: Composer, Thread + atoms, ThreadView, QueuedMessageList, presenters, perm/question/resource
+ primitives.ts # Tier 2: Composer, Thread + atoms, ThreadView, QueuedMessageList, presenters, perm/question
logics.ts # Tier 3: runStreamLogic, runInteractionLogic, context store + hooks, tool-event bus (headless)
types.ts # Tier 3: folded-thread + tool domain types, AttachedContextItem, ToolStreamEvent (pure types)
tools.ts # Tier 4: toolRegistry + registerToolRenderers seam (side-effectful — isolated)
components/ # RunSurfaceImpl (the RunSurface compound, heavy chunk); ReadonlyRunSurfaceImpl (prepackaged
# read-only layout) + ReadonlyRunSurface (its lazy wrapper, replaces the old RunViewer.tsx);
- # RunLogSkeleton (shared loader), Thread, Composer, perm/question/resource surfaces, activity, tool/;
+ # RunLogSkeleton (shared loader), Thread, Composer, perm/question surfaces, activity, tool/;
# AttachedContextProvider (render-null context injection wrapper)
composer/ # the Composer compound; AttachedContextBar (@-picker + context chips)
tool/ # tool registry + renderers (built-ins, generic MCP, EditDiffRenderer, diff/exec utils)
diff --git a/products/posthog_ai/frontend/README.md b/products/posthog_ai/frontend/README.md
index acef9a9a1f64..f3b9dd6048f9 100644
--- a/products/posthog_ai/frontend/README.md
+++ b/products/posthog_ai/frontend/README.md
@@ -61,7 +61,7 @@ import { ReadonlyRunSurface } from 'products/posthog_ai/frontend/api/readableRun
;<ReadonlyRunSurface taskId={task.id} runId={run.id} interaction="read-only" />
```
-The prepackaged, lazy read-only surface: thread (plus the meta bars for a live run), no composer and no
+The prepackaged, lazy read-only surface: thread (with the context-usage footer for a live run), no composer and no
approval prompt. It streams fresh frames while running when `interaction='live'`, and replays the snapshot
once when `'read-only'`. This is what all three inbox embeds drop in.
@@ -84,7 +84,6 @@ const { cancelRun } = useActions(runInteractionLogic(props))
<div className="flex-1 min-h-0">
<RunSurface.Thread />
</div>
- <RunSurface.Resources />
<RunSurface.Composer>
<Composer.Root
value={draft}
@@ -113,10 +112,10 @@ submit again.
### Custom layout via the `RunSurface` compound
`RunSurface.Root` (Tier 1, `api/runSurface`) binds the stream logic and bootstraps the run; the slots
-(`.Thread/.Composer/.Resources/.ContextUsage`) compose into any layout — there is no default. Omit
+(`.Thread/.Composer/.ContextUsage`) compose into any layout — there is no default. Omit
`RunSurface.Composer` for a no-input surface (that's exactly what `ReadonlyRunSurface` does); render it with
composer children for an interactive one. For something even more bespoke, drop to the Tier 2 primitives
-(`ThreadView`, `ResourcesBar`, `Composer.*`, `ContextUsageBar`) and bind `runStreamLogic` yourself.
+(`ThreadView`, `Composer.*`, `ContextUsageBar`) and bind `runStreamLogic` yourself.
### Optimistically open a run before it exists
diff --git a/products/posthog_ai/frontend/api/primitives.ts b/products/posthog_ai/frontend/api/primitives.ts
index 2f7b3aa5132e..bd437a219ac4 100644
--- a/products/posthog_ai/frontend/api/primitives.ts
+++ b/products/posthog_ai/frontend/api/primitives.ts
@@ -85,7 +85,6 @@ export type { DebugLogsMenuProps } from '../components/DebugLogsMenu'
export { PermissionInput } from '../components/PermissionInput'
export { QuestionInput } from '../components/QuestionInput'
export { parseSandboxQuestions } from '../policy/questionUtils'
-export { ResourcesBar } from '../components/ResourcesBar'
export { ContextUsageBar } from '../components/ContextUsageBar'
export { QuestionField, MultiFieldQuestion, isFieldValid } from '../components/QuestionField'
export { OptionSelector } from '../components/OptionSelector'
diff --git a/products/posthog_ai/frontend/api/readableRun.ts b/products/posthog_ai/frontend/api/readableRun.ts
index ff94d9979de4..e46341794f02 100644
--- a/products/posthog_ai/frontend/api/readableRun.ts
+++ b/products/posthog_ai/frontend/api/readableRun.ts
@@ -1,5 +1,5 @@
// Tier 1 — prepackaged read-only run surface. `ReadonlyRunSurface` (`<ReadonlyRunSurface .../>`) is the lazy,
-// code-split embeddable for "just show a run": it renders the run thread (and, for a live run, the meta bars)
+// code-split embeddable for "just show a run": it renders the run thread (with the context-usage footer for a live run)
// behind a `RunLogSkeleton` fallback — no composer, no approval prompt. This is the common embed (the inbox
// detail views). It streams fresh frames while running when `interaction='live'`, and replays the snapshot
// once when `interaction='read-only'`.
diff --git a/products/posthog_ai/frontend/api/runSurface.ts b/products/posthog_ai/frontend/api/runSurface.ts
index d7ead3c31c12..efba1314d59b 100644
--- a/products/posthog_ai/frontend/api/runSurface.ts
+++ b/products/posthog_ai/frontend/api/runSurface.ts
@@ -1,7 +1,7 @@
-// Tier 1 — the `RunSurface` compound (`Root` + the `.Thread/.Composer/.Resources/.ContextUsage` slots) for
+// Tier 1 — the `RunSurface` compound (`Root` + the `.Thread/.Composer/.ContextUsage` slots) for
// consumers that build a custom run layout: `RunSurface.Root` binds the stream logic and bootstraps the run;
-// the slots compose into whatever layout the surface needs (a live composer for tasks; the meta bars for an
-// embed). There is no default layout — for the common no-input read-only embed, use `ReadonlyRunSurface`
+// the slots compose into whatever layout the surface needs (a live composer for tasks; the context-usage bar
+// for an embed). There is no default layout — for the common no-input read-only embed, use `ReadonlyRunSurface`
// (./readableRun) instead.
//
// EAGER, not lazy: this statically pulls the heavy compound (stream logic, virtualized thread, tool/diff
diff --git a/products/posthog_ai/frontend/components/ReadonlyRunSurface.tsx b/products/posthog_ai/frontend/components/ReadonlyRunSurface.tsx
index 54f6073bb283..322a7f8b75d1 100644
--- a/products/posthog_ai/frontend/components/ReadonlyRunSurface.tsx
+++ b/products/posthog_ai/frontend/components/ReadonlyRunSurface.tsx
@@ -16,7 +16,7 @@ const Lazy = lazyWithRetry(() => import('./ReadonlyRunSurfaceImpl'))
/**
* Prepackaged read-only run surface, code-split behind a `RunLogSkeleton` fallback. This is the common
* embed: the inbox detail views (`ArtefactTaskRun` / `AgentRunDetail` / `ReportTasksSection`) drop it in.
- * It renders the run thread (and, for a live run, the meta bars) with no composer and no approval prompt;
+ * It renders the run thread (with the context-usage footer for a live run) with no composer and no approval prompt;
* see `ReadonlyRunSurfaceImpl` for the layout. For a custom layout, compose the `RunSurface` compound
* directly (api/runSurface).
*/
diff --git a/products/posthog_ai/frontend/components/ReadonlyRunSurfaceImpl.test.tsx b/products/posthog_ai/frontend/components/ReadonlyRunSurfaceImpl.test.tsx
index 4fd2cd1c40c3..4ea071f87d2c 100644
--- a/products/posthog_ai/frontend/components/ReadonlyRunSurfaceImpl.test.tsx
+++ b/products/posthog_ai/frontend/components/ReadonlyRunSurfaceImpl.test.tsx
@@ -24,7 +24,6 @@ jest.mock('../logics/runStreamLogic', () => ({
jest.mock('../logics/taskLogic', () => ({ taskLogic: jest.fn(() => ({ __mock: 'taskLogic' })) }))
jest.mock('./ThreadView', () => ({ ThreadView: () => <div data-attr="thread" /> }))
-jest.mock('./ResourcesBar', () => ({ ResourcesBar: () => <div data-attr="resources" /> }))
jest.mock('./ContextUsageBar', () => ({ ContextUsageBar: () => <div data-attr="context" /> }))
jest.mock('./PermissionInput', () => ({ PermissionInput: () => <div data-attr="permission" /> }))
jest.mock('./QuestionInput', () => ({ QuestionInput: () => <div data-attr="question" /> }))
@@ -58,17 +57,15 @@ describe('ReadonlyRunSurfaceImpl', () => {
it('renders only the thread in read-only mode — no meta bars, composer, or prompt', () => {
render(<ReadonlyRunSurfaceImpl taskId="task-1" runId="run-1" interaction="read-only" />)
expect(screen.getByTestId('thread')).toBeInTheDocument()
- expect(screen.queryByTestId('resources')).not.toBeInTheDocument()
expect(screen.queryByTestId('context')).not.toBeInTheDocument()
expect(screen.queryByTestId('composer')).not.toBeInTheDocument()
expect(screen.queryByTestId('permission')).not.toBeInTheDocument()
expect(screen.queryByTestId('question')).not.toBeInTheDocument()
})
- it('renders the thread plus the resources bar for a live run, but never a composer or approval prompt', () => {
+ it('renders the thread for a live run, but never a composer or approval prompt', () => {
render(<ReadonlyRunSurfaceImpl taskId="task-1" runId="run-1" interaction="live" />)
expect(screen.getByTestId('thread')).toBeInTheDocument()
- expect(screen.getByTestId('resources')).toBeInTheDocument()
// Context usage now rides the thread footer (inside ThreadView), not a standalone bar.
expect(screen.queryByTestId('context')).not.toBeInTheDocument()
expect(screen.queryByTestId('composer')).not.toBeInTheDocument()
diff --git a/products/posthog_ai/frontend/components/ReadonlyRunSurfaceImpl.tsx b/products/posthog_ai/frontend/components/ReadonlyRunSurfaceImpl.tsx
index cef6c620769c..b9d81ebc6d8d 100644
--- a/products/posthog_ai/frontend/components/ReadonlyRunSurfaceImpl.tsx
+++ b/products/posthog_ai/frontend/components/ReadonlyRunSurfaceImpl.tsx
@@ -44,7 +44,6 @@ export default function ReadonlyRunSurfaceImpl({
<div className="flex-1 min-h-0">
<RunSurface.Thread listClassName={threadListClassName} rowClassName={threadRowClassName} />
</div>
- <RunSurface.Resources />
</div>
)}
</RunSurface.Root>
diff --git a/products/posthog_ai/frontend/components/ResourcesBar.tsx b/products/posthog_ai/frontend/components/ResourcesBar.tsx
deleted file mode 100644
index d598142ac7d7..000000000000
--- a/products/posthog_ai/frontend/components/ResourcesBar.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import { useValues } from 'kea'
-
-import { Tooltip } from '@posthog/lemon-ui'
-
-import { runStreamLogic } from '../logics/runStreamLogic'
-import { resolveProductMeta } from '../messages/posthogProducts'
-
-/**
- * Persistent "PostHog resources used" bar for sandbox conversations. Reads the session-cumulative
- * `resourcesUsed` list (unioned by id across the whole conversation) and renders one chip per
- * product the agent grounded an answer in. Hidden when empty. Each chip is a product icon plus a
- * Sentence-cased label; unknown ids degrade to the wire label and a generic icon.
- */
-export function ResourcesBar(): JSX.Element | null {
- const { resourcesUsed } = useValues(runStreamLogic)
-
- if (resourcesUsed.length === 0) {
- return null
- }
-
- return (
- <div className="flex flex-wrap items-center gap-1.5 px-3" data-attr="max-sandbox-resources-bar">
- <span className="text-xs text-muted mr-0.5">PostHog resources used:</span>
- {resourcesUsed.map((product) => {
- const { label, Icon } = resolveProductMeta(product.id, product.label)
- return (
- <Tooltip key={product.id} title={label}>
- <span className="inline-flex items-center gap-1 rounded border bg-surface-primary px-1.5 py-0.5 text-xs">
- <Icon className="size-3.5 shrink-0" />
- <span>{label}</span>
- </span>
- </Tooltip>
- )
- })}
- </div>
- )
-}
diff --git a/products/posthog_ai/frontend/components/RunSurfaceImpl.test.tsx b/products/posthog_ai/frontend/components/RunSurfaceImpl.test.tsx
index 1aed474d4e74..f35138ac6e28 100644
--- a/products/posthog_ai/frontend/components/RunSurfaceImpl.test.tsx
+++ b/products/posthog_ai/frontend/components/RunSurfaceImpl.test.tsx
@@ -27,7 +27,6 @@ jest.mock('../logics/runStreamLogic', () => ({
jest.mock('../logics/taskLogic', () => ({ taskLogic: jest.fn(() => ({ __mock: 'taskLogic' })) }))
jest.mock('./ThreadView', () => ({ ThreadView: () => <div data-attr="thread" /> }))
-jest.mock('./ResourcesBar', () => ({ ResourcesBar: () => <div data-attr="resources" /> }))
jest.mock('./ContextUsageBar', () => ({ ContextUsageBar: () => <div data-attr="context" /> }))
jest.mock('./PermissionInput', () => ({ PermissionInput: () => <div data-attr="permission" /> }))
jest.mock('./QuestionInput', () => ({ QuestionInput: () => <div data-attr="question" /> }))
diff --git a/products/posthog_ai/frontend/components/RunSurfaceImpl.tsx b/products/posthog_ai/frontend/components/RunSurfaceImpl.tsx
index 33f136b358e2..e6d9f0f1d924 100644
--- a/products/posthog_ai/frontend/components/RunSurfaceImpl.tsx
+++ b/products/posthog_ai/frontend/components/RunSurfaceImpl.tsx
@@ -11,7 +11,6 @@ import { ContextUsageBar } from './ContextUsageBar'
import { FeedbackPromptTrailer } from './FeedbackPromptTrailer'
import { PermissionInput } from './PermissionInput'
import { QuestionInput } from './QuestionInput'
-import { ResourcesBar } from './ResourcesBar'
import { RunLogSkeleton } from './RunLogSkeleton'
import { ThreadView } from './ThreadView'
import { TurnFeedbackActions } from './TurnFeedbackActions'
@@ -42,7 +41,7 @@ export interface RunSurfaceProps {
}
// `RunSurface.Root` binds a `runStreamLogic` instance and bootstraps the run; the slot components
-// (`RunSurface.Thread/.Composer/.Resources/.ContextUsage`) read the bound logic via selectors and the
+// (`RunSurface.Thread/.Composer/.ContextUsage`) read the bound logic via selectors and the
// run wiring from this context. Consumers compose the slots into a custom layout — there is no default
// layout; the prepackaged read-only embed lives in `ReadonlyRunSurfaceImpl`. State stays in the logic;
// the slots are presentational and the composer UI is supplied by the consumer as children.
@@ -221,7 +220,7 @@ function RunSurfaceThread({
if (showSkeleton) {
return <RunLogSkeleton className={className} listClassName={listClassName} rowClassName={rowClassName} />
}
- // Context usage rides the thread footer for live runs (the meta bars are live-only), but never for a
+ // Context usage rides the thread footer for live runs, but never for a
// scout run. An error surfaces as a `handleStreamError` item folded into the thread, so it renders here too.
// Turn feedback follows the same gate: only interactive, non-scout surfaces collect ratings.
return (
@@ -289,15 +288,14 @@ function RunSurfaceComposer({
/**
* Compound run surface. `RunSurface.Root` binds the stream logic, bootstraps the run, and provides context;
- * the slots (`RunSurface.Thread/.Composer/.Resources/.ContextUsage`) compose into a custom layout — there is
+ * the slots (`RunSurface.Thread/.Composer/.ContextUsage`) compose into a custom layout — there is
* no default layout. `RunSurface.Composer` owns the prompt-vs-composer precedence and takes the composer UI
- * as children; the meta slots (`.Resources`/`.ContextUsage`) self-bind and self-hide when empty. For the
+ * as children; the meta slot (`.ContextUsage`) self-binds and self-hides when empty. For the
* common no-input embed, prefer the prepackaged `ReadonlyRunSurface` (api/readableRun).
*/
export const RunSurface = Object.assign(RunSurfaceRoot, {
Root: RunSurfaceRoot,
Thread: RunSurfaceThread,
Composer: RunSurfaceComposer,
- Resources: ResourcesBar,
ContextUsage: ContextUsageBar,
})
diff --git a/products/posthog_ai/frontend/logics/runStreamLogic.test.ts b/products/posthog_ai/frontend/logics/runStreamLogic.test.ts
index 79c27bf1cb32..48d993f0403d 100644
--- a/products/posthog_ai/frontend/logics/runStreamLogic.test.ts
+++ b/products/posthog_ai/frontend/logics/runStreamLogic.test.ts
@@ -22,7 +22,6 @@ import {
MAX_CUMULATIVE_RECONNECT_ATTEMPTS,
MAX_HISTORY_FETCH_ATTEMPTS,
MAX_SSE_RECONNECT_ATTEMPTS,
- mergeResourceProducts,
mergeRunArtifacts,
parsePermissionRequestFrame,
reconnectDelayMs,
@@ -2529,62 +2528,6 @@ describe('runStreamLogic', () => {
})
})
- describe('mergeResourceProducts', () => {
- it('unions by id, preserves first-seen order, and tolerates empty/idless input', () => {
- const first = mergeResourceProducts([], [{ id: 'product_analytics', label: 'Product analytics' }])
- expect(first).toEqual([{ id: 'product_analytics', label: 'Product analytics' }])
-
- const second = mergeResourceProducts(first, [
- { id: 'product_analytics', label: 'dup' },
- { id: 'session_replay', label: 'Session replay' },
- { label: 'no id' },
- { id: '' },
- ])
- expect(second.map((p) => p.id)).toEqual(['product_analytics', 'session_replay'])
- // First-seen label wins for an id already present.
- expect(second[0].label).toEqual('Product analytics')
- })
- })
-
- describe('_posthog/resources_used handling', () => {
- it('unions products into resourcesUsed by id in first-seen order', async () => {
- await expectLogic(logic, () => {
- logic.actions.ingestAcpFrame(
- notification('_posthog/resources_used', {
- products: [
- { id: 'product_analytics', label: 'Product analytics' },
- { id: 'session_replay', label: 'Session replay' },
- ],
- })
- )
- logic.actions.ingestAcpFrame(
- notification('_posthog/resources_used', {
- products: [
- { id: 'session_replay', label: 'Session replay' },
- { id: 'sql', label: 'SQL' },
- ],
- })
- )
- }).toFinishAllListeners()
-
- expect(logic.values.resourcesUsed.map((p) => p.id)).toEqual(['product_analytics', 'session_replay', 'sql'])
- })
-
- it('survives bootstrap replay without double-counting (same frame twice → one entry set)', async () => {
- const frame = notification('_posthog/resources_used', {
- products: [{ id: 'product_analytics', label: 'Product analytics' }],
- })
- jest.spyOn(api.tasks.runs, 'getLogEntries').mockResolvedValue([frame as any, frame as any])
- jest.spyOn(api.tasks.runs, 'get').mockResolvedValue({ status: 'in_progress' } as any)
-
- logic.actions.bootstrapRun({ taskId: 'task-1', runId: 'run-1' })
- await flushPromises()
-
- // Content-dedup drops the identical replay; the union would dedup by id regardless.
- expect(logic.values.resourcesUsed.map((p) => p.id)).toEqual(['product_analytics'])
- })
- })
-
describe('_posthog/usage_update handling', () => {
it('folds the Codex split frames (used + cost, then breakdown) into contextUsage', async () => {
await expectLogic(logic, () => {
@@ -2799,16 +2742,12 @@ describe('runStreamLogic', () => {
})
describe('reset clears notification state', () => {
- it('clears resourcesUsed, contextUsage, and sdkSession on reset', async () => {
+ it('clears contextUsage and sdkSession on reset', async () => {
await expectLogic(logic, () => {
- logic.actions.ingestAcpFrame(
- notification('_posthog/resources_used', { products: [{ id: 'sql', label: 'SQL' }] })
- )
logic.actions.ingestAcpFrame(notification('_posthog/usage_update', { used: { inputTokens: 1 } }))
logic.actions.ingestAcpFrame(notification('_posthog/sdk_session', { adapter: 'codex' }))
}).toFinishAllListeners()
- expect(logic.values.resourcesUsed).toHaveLength(1)
expect(logic.values.contextUsage).not.toBeNull()
expect(logic.values.sdkSession).not.toBeNull()
@@ -2816,21 +2755,9 @@ describe('runStreamLogic', () => {
logic.actions.reset()
}).toFinishAllListeners()
- expect(logic.values.resourcesUsed).toEqual([])
expect(logic.values.contextUsage).toBeNull()
expect(logic.values.sdkSession).toBeNull()
})
-
- it('keeps resourcesUsed across markTurnComplete (accumulates over the session)', async () => {
- await expectLogic(logic, () => {
- logic.actions.ingestAcpFrame(
- notification('_posthog/resources_used', { products: [{ id: 'sql', label: 'SQL' }] })
- )
- logic.actions.markTurnComplete()
- }).toFinishAllListeners()
-
- expect(logic.values.resourcesUsed.map((p) => p.id)).toEqual(['sql'])
- })
})
describe('mixed notification replay', () => {
diff --git a/products/posthog_ai/frontend/logics/runStreamLogic.ts b/products/posthog_ai/frontend/logics/runStreamLogic.ts
index 8264faa90972..4c14fa69f469 100644
--- a/products/posthog_ai/frontend/logics/runStreamLogic.ts
+++ b/products/posthog_ai/frontend/logics/runStreamLogic.ts
@@ -39,7 +39,6 @@ import {
import type {
ContextUsage,
PermissionRequestRecord,
- ResourceProduct,
RunArtifacts,
RunLifecycleEvent,
ProgressStatus,
@@ -408,32 +407,11 @@ function normalizeHistory(entries: unknown[], runId: string, resumed: boolean):
})
}
-/**
- * Union incoming resource products into the accumulated list by `id`, preserving first-seen order.
- * Pure — mirrors the reference `accumulateSessionResources`. Products without an `id` are skipped.
- */
-export function mergeResourceProducts(
- existing: ResourceProduct[],
- incoming: { id?: string; label?: string }[]
-): ResourceProduct[] {
- const seen = new Set(existing.map((p) => p.id))
- const next = [...existing]
- for (const product of incoming) {
- if (typeof product.id !== 'string' || product.id === '' || seen.has(product.id)) {
- continue
- }
- seen.add(product.id)
- next.push({ id: product.id, label: product.label })
- }
- return next
-}
-
const RUN_ARTIFACT_KEYS = ['prUrl', 'branch', 'baseBranch', 'repo'] as const
/**
* Latest-wins fold of git artifacts onto the accumulated snapshot — a non-empty string overwrites,
- * undefined/empty values are ignored (so a later frame that omits a field never clears it). Mirrors
- * the `mergeResourceProducts` accumulation pattern.
+ * undefined/empty values are ignored (so a later frame that omits a field never clears it).
*/
export function mergeRunArtifacts(existing: RunArtifacts, partial: Partial<RunArtifacts>): RunArtifacts {
const next: RunArtifacts = { ...existing }
@@ -1460,7 +1438,6 @@ export interface runStreamLogicValues {
permissionResponseRequestIds: Set<string>
reconnectAttempt: number
resolvedPermissionRequestIds: Set<string>
- resourcesUsed: ResourceProduct[]
respondingToPermission: boolean
runArtifacts: RunArtifacts
runConnectionState: RunConnectionState | null
@@ -1590,17 +1567,6 @@ export interface runStreamLogicActions {
markTurnStarted: () => {
value: true
}
- mergeResourcesUsed: (
- products: {
- id?: string
- label?: string
- }[]
- ) => {
- products: {
- id?: string | undefined
- label?: string | undefined
- }[]
- }
mergeRunArtifacts: (partial: Partial<RunArtifacts>) => {
partial: Partial<RunArtifacts>
}
@@ -1931,8 +1897,6 @@ export const runStreamLogic = kea<runStreamLogicType>([
pushErrorItem: (errorMessage: string, variant: 'error' | 'crash' = 'error') => ({ errorMessage, variant }),
/** Echoes a `/clear` boundary the backend just recorded against a finished run, which has no stream to send it back. */
pushConversationCleared: true,
- /** Union the products an answer was grounded in — accumulates across the whole session. */
- mergeResourcesUsed: (products: { id?: string; label?: string }[]) => ({ products }),
/** Latest-wins merge of git artifacts (PR url / branch / base / repo) a run exposes. */
mergeRunArtifacts: (partial: Partial<RunArtifacts>) => ({ partial }),
/** Latest-wins context-usage snapshot fold (token/cost/breakdown or numeric aggregate). */
@@ -2225,15 +2189,6 @@ export const runStreamLogic = kea<runStreamLogicType>([
reset: () => false,
},
],
- // Products the agent grounded answers in, unioned by id (first-seen order) across the whole
- // session. NOT cleared on markTurnComplete — the bar accumulates; only a reset clears it.
- resourcesUsed: [
- [] as ResourceProduct[],
- {
- mergeResourcesUsed: (state, { products }) => mergeResourceProducts(state, products),
- reset: () => [],
- },
- ],
// Git artifacts a coding run exposes (PR url, working branch, base branch, repo), accumulated
// latest-wins from the bootstrap run fetch and live task_run_state frames. The pre/post-turn
// coding UI reads this and self-hides while empty, so a pure-analytics conversation shows
@@ -3442,11 +3397,6 @@ export const runStreamLogic = kea<runStreamLogicType>([
}
return
}
- // The agent reports, per turn, which PostHog products an answer was grounded in.
- if (isPosthogNotification(notification, '_posthog/resources_used')) {
- actions.mergeResourcesUsed(notification.params?.products ?? [])
- return
- }
// Token usage + cost + context-window breakdown. The numeric used/size aggregate that
// drives the percentage ring arrives separately on a session/update (handled below).
if (isPosthogNotification(notification, '_posthog/usage_update')) {
diff --git a/products/posthog_ai/frontend/messages/posthogProducts.ts b/products/posthog_ai/frontend/messages/posthogProducts.ts
deleted file mode 100644
index 5f37c3a260ad..000000000000
--- a/products/posthog_ai/frontend/messages/posthogProducts.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * PostHog product taxonomy for the sandbox resources bar. Ported from the agent's
- * `POSTHOG_PRODUCTS` (ids + labels are authoritative there) with icons sourced from
- * `@posthog/icons` (plus the in-house SQL icon). The `_posthog/resources_used` wire frame already carries `{id, label}`, so this
- * map is the icon source plus a fallback label for any id the wire omits. Labels are NOT a
- * mechanical sentence-casing of the id (e.g. `llm_analytics → "AI observability"`,
- * `cdp → "Data pipelines"`, acronyms stay all-caps), so they are copied verbatim.
- */
-import { ComponentType } from 'react'
-
-import {
- IconAI,
- IconCursor,
- IconDatabase,
- IconFlask,
- IconGraph,
- IconLogomark,
- IconMessage,
- IconPlug,
- IconPulse,
- IconRewind,
- IconServer,
- IconToggle,
- IconWarning,
-} from '@posthog/icons'
-
-import { IconBracketsChart } from 'lib/lemon-ui/icons'
-
-export type PostHogProductId =
- | 'product_analytics'
- | 'web_analytics'
- | 'feature_flags'
- | 'experiments'
- | 'error_tracking'
- | 'session_replay'
- | 'surveys'
- | 'llm_analytics'
- | 'data_warehouse'
- | 'cdp'
- | 'logs'
- | 'apm'
- | 'sql'
- | 'posthog'
-
-export interface PostHogProductMeta {
- label: string
- // wide enough for both @posthog/icons components and lemon-ui LemonIcons
- Icon: ComponentType<{ className?: string }>
-}
-
-export const POSTHOG_PRODUCTS: Record<PostHogProductId, PostHogProductMeta> = {
- product_analytics: { label: 'Product analytics', Icon: IconGraph },
- web_analytics: { label: 'Web analytics', Icon: IconPulse },
- feature_flags: { label: 'Feature flags', Icon: IconToggle },
- experiments: { label: 'Experiments', Icon: IconFlask },
- error_tracking: { label: 'Error tracking', Icon: IconWarning },
- session_replay: { label: 'Session replay', Icon: IconRewind },
- surveys: { label: 'Surveys', Icon: IconMessage },
- llm_analytics: { label: 'AI observability', Icon: IconAI },
- data_warehouse: { label: 'Data warehouse', Icon: IconDatabase },
- cdp: { label: 'Data pipelines', Icon: IconPlug },
- logs: { label: 'Logs', Icon: IconServer },
- apm: { label: 'APM', Icon: IconCursor },
- sql: { label: 'SQL', Icon: IconBracketsChart },
- posthog: { label: 'PostHog', Icon: IconLogomark },
-}
-
-/** Fallback icon for ids absent from the taxonomy — degrade gracefully rather than disappearing. */
-export const FALLBACK_PRODUCT_ICON = IconLogomark
-
-/** Resolve a product id to its icon + display label, tolerating unknown ids (uses the wire label). */
-export function resolveProductMeta(id: string, wireLabel?: string): PostHogProductMeta {
- const known = POSTHOG_PRODUCTS[id as PostHogProductId]
- if (known) {
- return { label: wireLabel || known.label, Icon: known.Icon }
- }
- return { label: wireLabel || id, Icon: FALLBACK_PRODUCT_ICON }
-}
diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunChat.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunChat.tsx
index 1fb41274833b..ea70f6239e47 100644
--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunChat.tsx
+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunChat.tsx
@@ -142,7 +142,6 @@ function TaskRunChatContent({
{/* Stay live (stream keeps flowing) but omit the composer entirely for a read-only viewer. */}
{!readOnly && (
<RunSurface.Composer isStopping={!!cancellationState}>
- <RunSurface.Resources />
{/* The composer owns the per-keystroke draft in an isolated child so typing never re-renders
the thread/virtualizer rendered as its sibling above — that cascade is what made the input lag. */}
<LiveComposer logicProps={logicProps} textAreaRef={textAreaRef} autoFocus={autoFocus} />
diff --git a/products/posthog_ai/frontend/types/streamTypes.ts b/products/posthog_ai/frontend/types/streamTypes.ts
index baf51d642a3f..7f862f5bf62e 100644
--- a/products/posthog_ai/frontend/types/streamTypes.ts
+++ b/products/posthog_ai/frontend/types/streamTypes.ts
@@ -173,14 +173,6 @@ export interface ThreadItem {
debugLevel?: string
}
-/** One PostHog product the agent grounded an answer in, accumulated across the whole session. */
-export interface ResourceProduct {
- /** Wire product id, e.g. 'product_analytics'. The local taxonomy maps it to an icon + label. */
- id: string
- /** Wire-supplied label; falls back to the local taxonomy label when absent. */
- label?: string
-}
-
/**
* Latest-wins context-usage snapshot for the footer ring. `used`/`size` (numeric token counts)
* drive the percentage and arrive on the `session/update` aggregate; `tokens`/`cost`/`breakdown`