: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(posthog-ai): show the task source in the today hover card and space feed (#109997)
Vojta Bartošaa56179d4af4
diff --git a/frontend/src/layout/today/TodaySessionHoverCard.tsx b/frontend/src/layout/today/TodaySessionHoverCard.tsxindex 97f8e173bd35..68139d086f6f 100644--- a/frontend/src/layout/today/TodaySessionHoverCard.tsx+++ b/frontend/src/layout/today/TodaySessionHoverCard.tsx@@ -130,7 +130,18 @@ export function TodaySessionHoverCard({<span title={updated.title}>{updated.text}</span></TodayHoverCardFact>)}- {preview.source && <TodayHoverCardFact label="Source">{preview.source}</TodayHoverCardFact>}+ {preview.source && (+ <TodayHoverCardFact label="Source">+ <span className="flex min-w-0 items-center gap-1.5">+ {preview.sourceIcon && (+ <span className="flex size-3 shrink-0 text-muted-foreground [&>svg]:size-full">+ {preview.sourceIcon}+ </span>+ )}+ <span className="truncate">{preview.source}</span>+ </span>+ </TodayHoverCardFact>+ )}</div></ItemContent>{author && (diff --git a/frontend/src/layout/today/todayPreviewCards.ts b/frontend/src/layout/today/todayPreviewCards.tsindex ba0c5d1fbad5..f68bbf49cd0b 100644--- a/frontend/src/layout/today/todayPreviewCards.ts+++ b/frontend/src/layout/today/todayPreviewCards.ts@@ -1,3 +1,4 @@+import { getOriginProductMeta } from 'products/posthog_ai/frontend/api/taskSource'import { ChannelDTOApi, PrStateEnumApi, TaskUserBasicInfoApi } from 'products/tasks/frontend/generated/api.schemas'import { SpacePresence } from 'products/tasks/frontend/spaces/spacePresence'import { TaskPullRequest } from 'products/tasks/frontend/spaces/taskPullRequests'@@ -24,6 +25,8 @@ export interface TodaySessionPreview {branch: string | null/** What filed the session, or null when a person made it by hand. */source: string | null+ /** The source product's icon, for the origins that have one. */+ sourceIcon: JSX.Element | nullauthor: TaskUserBasicInfoApi | nulltimestamp: string | nullmessage: string | null@@ -96,6 +99,7 @@ export function sessionPreview(branch: item.branch,source:item.originProduct && item.originProduct !== 'user_created' ? recentSourceLabel(item.originProduct) : null,+ sourceIcon: getOriginProductMeta(item.originProduct ?? undefined)?.icon ?? null,author: item.author,timestamp: item.timestamp,message: item.finalMessage,diff --git a/frontend/src/scenes/project-homepage/today/Today.stories.tsx b/frontend/src/scenes/project-homepage/today/Today.stories.tsxindex 4b151b510cf9..e395a0365bc2 100644--- a/frontend/src/scenes/project-homepage/today/Today.stories.tsx+++ b/frontend/src/scenes/project-homepage/today/Today.stories.tsx@@ -114,6 +114,7 @@ const RECENT_SESSIONS = [...PINNED_SESSIONS,{id: 'task-1',+ origin_product: 'slack',channel: 'space-checkout',title: 'Add a retry to the billing webhook',archived: false,@@ -136,6 +137,7 @@ const RECENT_SESSIONS = [},{id: 'task-3',+ origin_product: 'error_tracking',channel: 'space-checkout',title: 'Speed up the invoice export',archived: false,@@ -152,6 +154,7 @@ const RECENT_SESSIONS = [},{id: 'task-2',+ origin_product: 'signal_report',channel: 'space-checkout',title: 'Investigate the drop in trial starts',archived: false,diff --git a/products/posthog_ai/frontend/api/taskSource.ts b/products/posthog_ai/frontend/api/taskSource.tsnew file mode 100644index 000000000000..6ae9f7166973--- /dev/null+++ b/products/posthog_ai/frontend/api/taskSource.ts@@ -0,0 +1,10 @@+// The icon and label for the product that filed a task, for hosts that only need to name a task's source.+//+// Kept apart from `./primitives` on purpose: the app shell's sidebar imports it, and `./primitives` statically+// pulls the thread presenters and the product data-tool widgets into whatever chunk imports it.+//+// Part of the `products/posthog_ai/frontend/api/<module>` public surface — import from here, not from deep+// `../components/*` paths. See ../README.md for the tier model and ../AGENTS.md for the coupling rule.++export { getOriginProductMeta } from '../components/taskSourceMeta'+export type { OriginProductMeta } from '../components/taskSourceMeta'diff --git a/products/tasks/frontend/spaces/SpaceFeedCard.tsx b/products/tasks/frontend/spaces/SpaceFeedCard.tsxindex 4832407bc2f9..d20faaa99f8e 100644--- a/products/tasks/frontend/spaces/SpaceFeedCard.tsx+++ b/products/tasks/frontend/spaces/SpaceFeedCard.tsx@@ -29,6 +29,8 @@ import { TodaySessionRenameInput } from '~/layout/today/TodaySessionRenameInput'import { todaySpacesLogic } from '~/layout/today/todaySpacesLogic'import { sessionItem, sessionMenuTarget, shortTimeAgo } from '~/layout/today/todayWorkItems'+import { getOriginProductMeta } from 'products/posthog_ai/frontend/api/taskSource'+import { TaskListItemApi } from '../generated/api.schemas'import { SpaceFeedCardPrompt } from './SpaceFeedCardPrompt'import { spaceFeedPreview } from './spaceFeedPreview'@@ -80,6 +82,7 @@ export function SpaceFeedCard({ task, pinned, unread, repository }: SpaceFeedCarconst preview = spaceFeedPreview('description_preview' in task ? task.description_preview : task.description)const author = task.created_byconst authorName = author ? taskUserName(author) : null+ const source = getOriginProductMeta(item.originProduct ?? undefined)const card = (<Card@@ -131,8 +134,21 @@ export function SpaceFeedCard({ task, pinned, unread, repository }: SpaceFeedCar</div></div><SpaceFeedCardPrompt taskId={task.id} prompt={preview} />- {(repository || author || item.pullRequests.length > 0 || files.length > 0) && (+ {(source || repository || author || item.pullRequests.length > 0 || files.length > 0) && (<div className="mt-3 flex min-w-0 flex-wrap items-center gap-1.5">+ {source && (+ <Badge+ // No padding: the chip has no fill, so it lines up with the prompt text above it.+ className={cn(+ TASK_CHIP_CLASS,+ 'border-transparent bg-transparent px-0 text-muted-foreground'+ )}+ data-attr="today-space-feed-source"+ >+ <span className="flex size-3 shrink-0 [&>svg]:size-full">{source.icon}</span>+ {source.label}+ </Badge>+ )}{repository && (<BadgeclassName={cn(diff --git a/products/tasks/frontend/spaces/SpaceFeedListRow.tsx b/products/tasks/frontend/spaces/SpaceFeedListRow.tsxindex ea9623fd89a1..cba2906f28e7 100644--- a/products/tasks/frontend/spaces/SpaceFeedListRow.tsx+++ b/products/tasks/frontend/spaces/SpaceFeedListRow.tsx@@ -1,7 +1,7 @@import { useValues } from 'kea'import { useId } from 'react'-import { Badge, Spinner, Text } from '@posthog/quill'+import { Badge, Spinner, Text, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill'import { LinkPrimitive } from 'lib/lemon-ui/Link'import { urls } from 'scenes/urls'@@ -15,6 +15,8 @@ import { TodaySessionRenameInput } from '~/layout/today/TodaySessionRenameInput'import { todaySpacesLogic } from '~/layout/today/todaySpacesLogic'import { sessionItem, sessionMenuTarget, shortTimeAgo } from '~/layout/today/todayWorkItems'+import { getOriginProductMeta } from 'products/posthog_ai/frontend/api/taskSource'+import { TaskListItemApi } from '../generated/api.schemas'import { spaceFeedStatus } from './spaceFeedStatus'import { SpaceFeedStatusIcon } from './SpaceFeedStatusIcon'@@ -37,6 +39,7 @@ export function SpaceFeedListRow({ task, pinned, unread }: SpaceFeedListRowPropsconst [mainPullRequest] = item.pullRequestsconst status = spaceFeedStatus(task.latest_run, mainPullRequest && pullRequestStates[mainPullRequest.url])const author = task.created_by+ const source = getOriginProductMeta(item.originProduct ?? undefined)if (renaming?.sessionId === task.id && renaming.surface === 'feed') {return (@@ -68,6 +71,23 @@ export function SpaceFeedListRow({ task, pinned, unread }: SpaceFeedListRowPropsdata-attr="today-unread-feed-dot"/>)}+ {source && (+ <Tooltip>+ <TooltipTrigger+ render={+ <span+ role="img"+ aria-label={`Source: ${source.label}`}+ className="relative flex size-3.5 shrink-0 text-muted-foreground [&>svg]:size-full"+ data-attr="today-space-feed-source"+ />+ }+ >+ {source.icon}+ </TooltipTrigger>+ <TooltipContent>{`Source: ${source.label}`}</TooltipContent>+ </Tooltip>+ )}{status && (<Badge variant={status.variant} className="shrink-0">{status.running && <Spinner aria-hidden data-icon="inline-start" />}