: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(today): show who is working on a session and desktop's row weight (#110096)
Shy Alter27a1e7dd8617
diff --git a/frontend/src/layout/today/TodayListAppearanceDialog.tsx b/frontend/src/layout/today/TodayListAppearanceDialog.tsxindex 88ce51531723..67b3ed6fe900 100644--- a/frontend/src/layout/today/TodayListAppearanceDialog.tsx+++ b/frontend/src/layout/today/TodayListAppearanceDialog.tsx@@ -86,6 +86,7 @@ export function TodayListAppearanceDialog(): JSX.Element {to={urls.ai()}active={false}dataAttr="today-list-appearance-preview-row"+ weight="regular"details={listItemDetails({...values,diff --git a/frontend/src/layout/today/TodaySessionBadges.tsx b/frontend/src/layout/today/TodaySessionBadges.tsxindex 782eaa67e8c9..a41578ed5198 100644--- a/frontend/src/layout/today/TodaySessionBadges.tsx+++ b/frontend/src/layout/today/TodaySessionBadges.tsx@@ -4,9 +4,10 @@ import { Avatar, AvatarFallback, AvatarGroup, Tooltip, TooltipContent, TooltipTrimport { IconSlack } from 'lib/lemon-ui/icons'import { LinkPrimitive } from 'lib/lemon-ui/Link'-import { PrStateEnumApi } from 'products/tasks/frontend/generated/api.schemas'+import { PrStateEnumApi, TaskUserBasicInfoApi } from 'products/tasks/frontend/generated/api.schemas'import { pullRequestLinkLabel, pullRequestStateMeta } from 'products/tasks/frontend/spaces/TaskPullRequestChip'import { TaskPullRequest } from 'products/tasks/frontend/spaces/taskPullRequests'+import { TaskUserAvatar, taskUserName } from 'products/tasks/frontend/spaces/TaskUserAvatar'import { recentSourceLabel } from './todayRecentFilters'import { TodaySessionBadge } from './todayWorkItems'@@ -20,8 +21,50 @@ interface TodaySessionBadgesProps {pinned: boolean}-/** A session row's trailing stack, like PostHog Desktop: the pin, the source, then the pull request colored by its state. */+/** A session row's trailing stack, like PostHog Desktop: who is working on it, the pin, the source, then the pull request colored by its state. */export function TodaySessionBadges({ badges, pullRequestState, pinned }: TodaySessionBadgesProps): JSX.Element {+ const author = badges.find((badge) => badge.kind === 'author')+ const stacked = badges.filter((badge) => badge.kind !== 'author')+ return (+ <>+ {author && <AuthorBadge author={author.author} live={author.live} />}+ {(pinned || stacked.length > 0) && (+ <StackedBadges badges={stacked} pullRequestState={pullRequestState} pinned={pinned} />+ )}+ </>+ )+}++function AuthorBadge({ author, live }: { author: TaskUserBasicInfoApi; live: boolean }): JSX.Element {+ const name = taskUserName(author)+ const label = live ? `${name} is working on this` : `${name} was here recently`+ return (+ <Tooltip>+ <TooltipTrigger+ delay={200}+ render={+ <span+ role="img"+ aria-label={label}+ className="relative flex shrink-0"+ data-attr="today-session-author"+ />+ }+ >+ <TaskUserAvatar user={author} />+ <span+ className={cn(+ 'absolute right-0 bottom-0 size-1.5 rounded-full ring-1 ring-background',+ live ? 'bg-primary' : 'bg-muted-foreground'+ )}+ />+ </TooltipTrigger>+ <TooltipContent>{label}</TooltipContent>+ </Tooltip>+ )+}++function StackedBadges({ badges, pullRequestState, pinned }: TodaySessionBadgesProps): JSX.Element {return (<AvatarGroup stacked reverse size="xs" className="shrink-0">{pinned && (@@ -55,6 +98,8 @@ export function TodaySessionBadges({ badges, pullRequestState, pinned }: TodaySe<IconLaptop className="size-2.5 text-muted-foreground" /></IconBadge>)+ default:+ return null}})}</AvatarGroup>diff --git a/frontend/src/layout/today/TodaySessionRow.tsx b/frontend/src/layout/today/TodaySessionRow.tsxindex 647acbad5057..f386d037bb1a 100644--- a/frontend/src/layout/today/TodaySessionRow.tsx+++ b/frontend/src/layout/today/TodaySessionRow.tsx@@ -54,9 +54,9 @@ export function TodaySessionRow({)const details = useMemo(() => sessionDetails(item, fields, spaceNames), [item, fields, spaceNames])- const badges = useMemo(() => sessionBadges(item), [item])- const [pullRequest] = item.pullRequestsconst pinBadge = pinned && showPinBadge+ const badges = useMemo(() => sessionBadges(item, userId, { pinned: pinBadge }), [item, userId, pinBadge])+ const [pullRequest] = item.pullRequestsconst badgeCount = badges.length + (pinBadge ? 1 : 0)if (renaming?.sessionId === item.id && renaming.surface === surface) {@@ -80,6 +80,7 @@ export function TodaySessionRow({) : null}badgeCount={badgeCount >= 3 ? 3 : badgeCount === 2 ? 2 : 1}+ weight="regular"tickerselected={selected}onClickCapture={onSelectClick}diff --git a/frontend/src/layout/today/TodaySpacesRow.tsx b/frontend/src/layout/today/TodaySpacesRow.tsxindex 12127071d88e..e2788eb22c1a 100644--- a/frontend/src/layout/today/TodaySpacesRow.tsx+++ b/frontend/src/layout/today/TodaySpacesRow.tsx@@ -21,6 +21,7 @@ interface TodaySpacesRowProps {/** How many icon-sized slots `badge` takes, so the label truncates before them. */badgeCount?: 1 | 2 | 3unread?: boolean+ weight?: 'regular' | 'medium'/** Fade a long label and scroll it on hover instead of cutting it with an ellipsis. */ticker?: boolean/** Part of a multi-session selection, so the row takes Desktop's selected tint. */@@ -40,6 +41,7 @@ export function TodaySpacesRow({badge,badgeCount = 1,unread = false,+ weight = 'medium',ticker = false,selected = false,onClickCapture,@@ -70,7 +72,8 @@ export function TodaySpacesRow({}onBlur={ticker ? () => setKeyboardFocused(false) : undefined}className={cn(- 'min-w-0 text-xs font-medium text-foreground',+ 'min-w-0 text-xs text-foreground',+ weight === 'medium' && 'font-medium',// Desktop's two-line row: the second line outgrows the fixed row height, so padding stands in for it.details.length > 0 && 'h-auto py-1',// Like Desktop, the open row takes a stronger tint than the other selected rows.@@ -97,14 +100,11 @@ export function TodaySpacesRow({</span><span className="flex min-w-0 flex-1 flex-col">{ticker ? (- <TodayOverflowText- reveal={hovered || keyboardFocused}- className={cn(unread && 'font-semibold')}- >+ <TodayOverflowText reveal={hovered || keyboardFocused} className={cn(unread && 'font-bold')}>{label}</TodayOverflowText>) : (- <span className={cn('min-w-0 truncate', unread && 'font-semibold')}>{label}</span>+ <span className={cn('min-w-0 truncate', unread && 'font-bold')}>{label}</span>)}{details.length > 0 && (<span className="truncate text-xxs text-muted-foreground">diff --git a/frontend/src/layout/today/todayWorkItems.test.ts b/frontend/src/layout/today/todayWorkItems.test.tsindex 8f6389910f33..c68aff407b55 100644--- a/frontend/src/layout/today/todayWorkItems.test.ts+++ b/frontend/src/layout/today/todayWorkItems.test.ts@@ -225,34 +225,81 @@ describe('todayWorkItems', () => {expect(activeCloudRunId(item)).toBe(runId)})- it.each<[string, string, string, Record<string, unknown>, string[]]>([+ it.each<[string, string, string, Record<string, unknown>, Record<string, unknown>, boolean, string[]]>([['the Slack source before the pull request','slack','cloud',{ pr_url: 'https://github.com/a/b/pull/1' },+ {},+ false,['source:slack', 'pullRequest'],],- ['the source of another product', 'error_tracking', 'cloud', {}, ['source:error_tracking']],- ['nothing for a session someone started', 'user_created', 'cloud', {}, []],- ['Local when nothing else shows', 'user_created', 'local', {}, ['local']],+ ['the source of another product', 'error_tracking', 'cloud', {}, {}, false, ['source:error_tracking']],+ ['nothing for a session someone started', 'user_created', 'cloud', {}, {}, false, []],+ ['Local when nothing else shows', 'user_created', 'local', {}, {}, false, ['local']],['only the pull request for a local run that has one','user_created','local',{ pr_url: 'https://github.com/a/b/pull/1' },+ {},+ false,['pullRequest'],],- ])('shows %s as session badges', (_name, origin, environment, output, expected) => {+ [+ 'the live face of someone else working on it, before Local',+ 'user_created',+ 'local',+ {},+ { created_by: { id: 8, email: '[email protected]' }, last_activity_at: '2026-03-10T11:59:00Z' },+ false,+ ['author:live', 'local'],+ ],+ [+ 'no face on your own session',+ 'user_created',+ 'cloud',+ {},+ { created_by: { id: ME, email: '[email protected]' }, last_activity_at: '2026-03-10T11:59:00Z' },+ false,+ [],+ ],+ [+ 'no face once the other person has gone quiet',+ 'user_created',+ 'cloud',+ {},+ { created_by: { id: 8, email: '[email protected]' }, last_activity_at: '2026-03-10T09:00:00Z' },+ false,+ [],+ ],+ [+ 'the recent face, without the source when the pin would make four',+ 'slack',+ 'cloud',+ { pr_url: 'https://github.com/a/b/pull/1' },+ { created_by: { id: 8, email: '[email protected]' }, last_activity_at: '2026-03-10T11:00:00Z' },+ true,+ ['author:recent', 'pullRequest'],+ ],+ ])('shows %s as session badges', (_name, origin, environment, output, overrides, pinned, expected) => {const item = sessionItem({id: 's',title: 'Session',origin_product: origin,latest_run: { environment, output },+ ...overrides,} as unknown as TaskListItemApi)expect(- sessionBadges(item).map((badge) => (badge.kind === 'source' ? `source:${badge.source}` : badge.kind))+ sessionBadges(item, ME, { pinned, now: Date.parse('2026-03-10T12:00:00Z') }).map((badge) =>+ badge.kind === 'source'+ ? `source:${badge.source}`+ : badge.kind === 'author'+ ? `author:${badge.live ? 'live' : 'recent'}`+ : badge.kind+ )).toEqual(expected)})diff --git a/frontend/src/layout/today/todayWorkItems.ts b/frontend/src/layout/today/todayWorkItems.tsindex b6f34e7866ec..aa3bf01863b0 100644--- a/frontend/src/layout/today/todayWorkItems.ts+++ b/frontend/src/layout/today/todayWorkItems.ts@@ -9,6 +9,7 @@ import {TaskRunDetailDTOApi,TaskUserBasicInfoApi,} from 'products/tasks/frontend/generated/api.schemas'+import { presenceTier } from 'products/tasks/frontend/spaces/spacePresence'import { TaskPullRequest, taskPullRequests } from 'products/tasks/frontend/spaces/taskPullRequests'import { taskUserName } from 'products/tasks/frontend/spaces/TaskUserAvatar'@@ -46,6 +47,7 @@ export interface TodayWorkGroup {}export type TodaySessionBadge =+ | { kind: 'author'; author: TaskUserBasicInfoApi; live: boolean }| { kind: 'source'; source: string }| { kind: 'pullRequest'; pullRequest: TaskPullRequest }| { kind: 'local' }@@ -61,6 +63,8 @@ const BADGE_SOURCES = new Set(['task_analysis',])+const MAX_ROW_BADGES = 3+const FINISHED_RUN_STATUSES = new Set(['completed', 'failed', 'cancelled'])const ACTIVE_RUN_STATUSES = new Set(['not_started', 'queued', 'in_progress'])@@ -163,7 +167,11 @@ export function chatItem(conversation: ConversationDetail): TodayWorkItem {}}-export function sessionBadges(item: TodayWorkItem): TodaySessionBadge[] {+export function sessionBadges(+ item: TodayWorkItem,+ userId: number | null | undefined,+ { pinned = false, now = Date.now() }: { pinned?: boolean; now?: number } = {}+): TodaySessionBadge[] {const badges: TodaySessionBadge[] = []if (item.originProduct && BADGE_SOURCES.has(item.originProduct)) {badges.push({ kind: 'source', source: item.originProduct })@@ -175,6 +183,14 @@ export function sessionBadges(item: TodayWorkItem): TodaySessionBadge[] {if (badges.length === 0 && item.runEnvironment === 'local') {badges.push({ kind: 'local' })}+ const activityAt = item.timestamp ? Date.parse(item.timestamp) : Number.NaN+ const tier = Number.isNaN(activityAt) ? 'idle' : presenceTier(activityAt, now)+ if (item.author && item.createdById !== userId && tier !== 'idle') {+ badges.unshift({ kind: 'author', author: item.author, live: tier === 'live' })+ }+ if (badges.length + (pinned ? 1 : 0) > MAX_ROW_BADGES) {+ return badges.filter((badge) => badge.kind !== 'source')+ }return badges}