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(tasks): match the task title icon to the run environment (#106453)

Vojta Bartošf0380659d9be
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 463a0ff65caf..b6aee24948c0 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -11708,6 +11708,10 @@ snapshots:
hash: v1.k794b7964.d4169f92563f1a61588ba823f6be7392267558bfbb86124b6e53ec9b18056418.iKEx9vQEw72HqX58dUDsyxmsH-qtEXIeb6MqQMByB8Y
scenes-app-tasks--ai-task-selected--light:
hash: v1.k794b7964.e0a6374da2da7262d08d1992bea3898259837679f5676f4330400d27559ac5d2.68EwF3z0RoO2K9aUGYr1XiQ_dRiNa6XtreqmKjXsfVg
+ scenes-app-tasks--cloud-task-selected--dark:
+ hash: v1.k794b7964.43949ecd391d896158383c255c88db2141b340fbd58f93849550f8474772c98c.73jTyE13P_BrAYaxpfekunmwxSV2Vgm43Ht3gth2QNg
+ scenes-app-tasks--cloud-task-selected--light:
+ hash: v1.k794b7964.55d4a76eafe772911f2d3aa43363f0a4f3a09fe6b791d17ab041c33869d45d16.gniKz4VTPvIxV1ivUZxennv6AmcTsx2UDsIwrTwUHL4
scenes-app-tasks--composer--dark:
hash: v1.k794b7964.7eef9b267cd20f210bf5f20c395acbd04f412df23a4e5591fb5513ffd82334e8.IPg6Br9tL3KbGN-SdYcgmmoT8ftICA72iN4UafDeT_8
scenes-app-tasks--composer--light:
diff --git a/products/posthog_ai/frontend/components/TaskEnvironmentIcon.tsx b/products/posthog_ai/frontend/components/TaskEnvironmentIcon.tsx
new file mode 100644
index 000000000000..f0198408dbbe
--- /dev/null
+++ b/products/posthog_ai/frontend/components/TaskEnvironmentIcon.tsx
@@ -0,0 +1,13 @@
+import { IconCloud, IconLaptop, IconListCheck } from '@posthog/icons'
+
+import { TaskRunEnvironment } from '../types/taskTypes'
+
+export function TaskEnvironmentIcon({ environment }: { environment?: TaskRunEnvironment }): JSX.Element {
+ if (environment === TaskRunEnvironment.CLOUD) {
+ return <IconCloud />
+ }
+ if (environment === TaskRunEnvironment.LOCAL) {
+ return <IconLaptop />
+ }
+ return <IconListCheck />
+}
diff --git a/products/posthog_ai/frontend/components/navigation/TaskListItem.tsx b/products/posthog_ai/frontend/components/navigation/TaskListItem.tsx
index 471f306ddddd..b61db98382b0 100644
--- a/products/posthog_ai/frontend/components/navigation/TaskListItem.tsx
+++ b/products/posthog_ai/frontend/components/navigation/TaskListItem.tsx
@@ -1,6 +1,6 @@
import { useActions } from 'kea'
-import { IconArchive, IconCloud, IconLaptop, IconListCheck } from '@posthog/icons'
+import { IconArchive } from '@posthog/icons'
import { Tooltip } from '@posthog/lemon-ui'
import { dayjs } from 'lib/dayjs'
@@ -14,6 +14,7 @@ import { urls } from 'scenes/urls'
import { tasksLogic } from '../../logics/tasksLogic'
import { TaskRunEnvironment } from '../../types/taskTypes'
import type { Task } from '../../types/taskTypes'
+import { TaskEnvironmentIcon } from '../TaskEnvironmentIcon'
import { TaskRunLivenessDot } from '../TaskRunLivenessDot'
function compactTimeAgo(iso: string): string {
@@ -35,13 +36,7 @@ function TaskTypeIcon({ task }: { task: Task }): JSX.Element {
return (
<Tooltip title={environment ? label : 'Task'} placement="right">
<span className="flex size-4 text-secondary opacity-50 group-hover:opacity-100 transition-all duration-50">
- {environment === TaskRunEnvironment.CLOUD ? (
- <IconCloud />
- ) : environment === TaskRunEnvironment.LOCAL ? (
- <IconLaptop />
- ) : (
- <IconListCheck />
- )}
+ <TaskEnvironmentIcon environment={environment} />
</span>
</Tooltip>
)
diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/TaskTracker.stories.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/TaskTracker.stories.tsx
index 5592ca423ee1..14e9f757e0df 100644
--- a/products/posthog_ai/frontend/scenes/TaskTracker/TaskTracker.stories.tsx
+++ b/products/posthog_ai/frontend/scenes/TaskTracker/TaskTracker.stories.tsx
@@ -57,6 +57,8 @@ function mockRun(
}
}
+const TASK_1_RUN = mockRun('task-1', TaskRunStatus.COMPLETED, '2024-01-15T09:30:00Z', '2024-01-15T09:48:00Z')
+
const TASKS: Task[] = [
{
id: 'task-1',
@@ -71,7 +73,7 @@ const TASKS: Task[] = [
signal_report: null,
json_schema: null,
internal: false,
- latest_run: mockRun('task-1', TaskRunStatus.COMPLETED, '2024-01-15T09:30:00Z', '2024-01-15T09:48:00Z'),
+ latest_run: TASK_1_RUN,
created_at: '2024-01-15T09:25:00Z',
updated_at: '2024-01-15T09:48:00Z',
created_by: CREATED_BY,
@@ -220,6 +222,45 @@ export const AiTaskSelected: Story = {
},
}
+export const CloudTaskSelected: Story = {
+ parameters: {
+ pageUrl: taskDetailUrl('task-1'),
+ },
+ decorators: [
+ mswDecorator({
+ get: {
+ '/api/projects/:team_id/tasks/task-1/': TASKS[0],
+ '/api/projects/:team_id/tasks/task-1/runs/': {
+ count: 1,
+ next: null,
+ previous: null,
+ results: [TASK_1_RUN],
+ },
+ '/api/projects/:team_id/tasks/task-1/runs/run-task-1/': TASK_1_RUN,
+ '/api/projects/:team_id/tasks/task-1/runs/run-task-1/logs': () =>
+ new HttpResponse(
+ JSON.stringify({
+ type: 'notification',
+ notification: {
+ method: 'session/update',
+ params: {
+ update: {
+ sessionUpdate: 'agent_message',
+ messageId: 'task-1-msg',
+ content: {
+ type: 'text',
+ text: 'Added a CSV export to the retention graph insight menu.',
+ },
+ },
+ },
+ },
+ })
+ ),
+ },
+ }),
+ ],
+}
+
export const NewTask: Story = {
parameters: {
pageUrl: taskNewUrl(),
diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx
index 21a6d0600fb4..0e45c6bdfadf 100644
--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx
+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunSceneShell.tsx
@@ -19,6 +19,7 @@ import {
import type { TaskRunDetailDTOApi } from 'products/tasks/frontend/generated/api.schemas'
+import { TaskEnvironmentIcon } from '../../../components/TaskEnvironmentIcon'
import type { Task } from '../../../types/taskTypes'
import { TaskDebugLogsPanelToggle } from './TaskDebugLogsPanelToggle'
import { TaskPanelSkeleton, TaskRunMetadataSkeleton } from './taskDetailSkeletons'
@@ -127,7 +128,10 @@ export function TaskRunSceneShell({
className="-mt-2"
name={task?.title || 'Task'}
description={null}
- resourceType={{ type: 'task' }}
+ resourceType={{
+ type: 'task',
+ forceIcon: <TaskEnvironmentIcon environment={task?.latest_run?.environment} />,
+ }}
isLoading={isHeaderLoading}
canEdit={false}
forceBackTo={