Skip to content

Commit 13322a1

Browse files
authored
Attribute channel task rows to the human who started them
Channel feed task rows rendered every message as "PostHog" with a robot avatar and an "Agent" badge, then repeated the starter's name inline in the body ("@name started a new task"). This made the feed hard to scan and misattributed human-initiated tasks to the agent. Channel-started tasks (origin_product === "user_created") now show the starter as the sender: their initials in the avatar, their display name as the author, no "Agent" badge, and a plain "started a new task" body. Tasks from other origins (Slack, automations) keep the agent attribution so genuine agent-authored messages remain distinguishable at a glance. Mirrors the existing SystemFeedRow author-vs-agent pattern in the same file. Generated-By: PostHog Code Task-Id: 4b3b11b7-5066-448f-a721-fe8532ce15d1
1 parent 3d788e3 commit 13322a1

1 file changed

Lines changed: 12 additions & 18 deletions

File tree

packages/ui/src/features/canvas/components/ChannelFeedView.tsx

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import { formatRelativeTimeShort, getLocalDayDiff } from "@posthog/shared";
4040
import type { Task, TaskRunStatus } from "@posthog/shared/domain-types";
4141
import { getUserInitials } from "@posthog/ui/features/auth/userInitials";
4242
import { TaskTabIcon } from "@posthog/ui/features/browser-tabs/TaskTabIcon";
43-
import { mentionChipClass } from "@posthog/ui/features/canvas/components/MentionText";
4443
import type { ChannelFeedSystemMessage } from "@posthog/ui/features/canvas/hooks/useChannelFeedMessages";
4544
import { useChannelTaskData } from "@posthog/ui/features/canvas/hooks/useChannelTaskData";
4645
import { useTaskThread } from "@posthog/ui/features/canvas/hooks/useTaskThread";
@@ -424,20 +423,28 @@ const FeedItem = memo(function FeedItem({
424423
onOpenTask: (task: Task) => void;
425424
onOpenThread: (task: Task) => void;
426425
}) {
426+
// Only attribute channel-started tasks to a human: other origins (Slack,
427+
// automations) carry a created_by who didn't start it here, so those stay
428+
// agent-attributed to leave room for genuine agent-authored messages.
429+
const starter =
430+
task.origin_product === "user_created" ? task.created_by : null;
431+
427432
return (
428433
<ThreadItem className="rounded-none py-1 pr-8 hover:bg-fill-hover/50">
429434
<ThreadItemGutter>
430435
<Avatar>
431436
<AvatarFallback>
432-
<RobotIcon size={16} />
437+
{starter ? getUserInitials(starter) : <RobotIcon size={16} />}
433438
</AvatarFallback>
434439
</Avatar>
435440
</ThreadItemGutter>
436441

437442
<ThreadItemContent className="min-w-0">
438443
<ThreadItemHeader>
439-
<ThreadItemAuthor>PostHog</ThreadItemAuthor>
440-
<Badge variant="info">Agent</Badge>
444+
<ThreadItemAuthor>
445+
{starter ? userDisplayName(starter) : "PostHog"}
446+
</ThreadItemAuthor>
447+
{!starter && <Badge variant="info">Agent</Badge>}
441448
<ThreadItemTimestamp
442449
dateTime={new Date(task.created_at).toISOString()}
443450
>
@@ -446,20 +453,7 @@ const FeedItem = memo(function FeedItem({
446453
</ThreadItemHeader>
447454

448455
<ThreadItemBody className="wrap-break-word">
449-
{/* Only attribute channel-started tasks: other origins (Slack,
450-
automations) carry a created_by who didn't start it here. */}
451-
{task.origin_product === "user_created" && task.created_by ? (
452-
<>
453-
{/* Mention-styled but rendered inert: the starter shouldn't be
454-
notified about their own task. */}
455-
<span className={mentionChipClass}>
456-
@{userDisplayName(task.created_by)}
457-
</span>{" "}
458-
started a new task
459-
</>
460-
) : (
461-
"A new task was started"
462-
)}
456+
{starter ? "started a new task" : "A new task was started"}
463457
</ThreadItemBody>
464458

465459
<TaskCard

0 commit comments

Comments
 (0)