Skip to content

Commit 6a879c8

Browse files
authored
Show a truncated prompt preview in channel feed rows
Instead of the generic "started a new task" body, feed rows now show a two-line preview of the user's original prompt (task.description, run through xmlToPlainText to resolve chip tags), matching how the optimistic pending row already previews the prompt. Falls back to the prior text when a task has no description. Adds LongPrompt and NoPrompt stories to cover truncation and the fallback. Generated-By: PostHog Code Task-Id: 4b3b11b7-5066-448f-a721-fe8532ce15d1
1 parent eaeb807 commit 6a879c8

2 files changed

Lines changed: 36 additions & 5 deletions

File tree

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

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ const task = (overrides: Partial<Task> = {}): Task => ({
2929
task_number: 1,
3030
slug: "task-1",
3131
title: "Add feedback modal to channels view",
32-
description: "",
32+
description:
33+
"Add a feedback modal to the channels view so people can share thoughts without leaving the feed",
3334
created_at: "2026-07-17T12:00:00.000Z",
3435
updated_at: "2026-07-17T12:00:00.000Z",
3536
origin_product: "user_created",
@@ -63,6 +64,8 @@ export const HumanEmailOnly: Story = {
6364
args: {
6465
task: task({
6566
created_by: user({ first_name: undefined, last_name: undefined }),
67+
title: "Make background color configurable",
68+
description: "Make the channel background color configurable in settings",
6669
}),
6770
children: <MockTaskCard title="Make background color configurable" />,
6871
},
@@ -73,14 +76,36 @@ export const AgentOrigin: Story = {
7376
task: task({
7477
origin_product: "slack",
7578
title: "Investigate signup drop-off",
79+
description: "Investigate the signup drop-off we saw over the weekend",
7680
}),
7781
children: <MockTaskCard title="Investigate signup drop-off" />,
7882
},
7983
};
8084

81-
export const NoStarter: Story = {
85+
export const LongPrompt: Story = {
86+
args: {
87+
task: task({
88+
description:
89+
"Rework the channel feed so each row reads as the person who started the task rather than the agent, show a preview of their prompt under the header, keep the task card below, and make sure long prompts truncate cleanly instead of pushing the card down the feed",
90+
}),
91+
children: <MockTaskCard title="Rework the channel feed attribution" />,
92+
},
93+
};
94+
95+
export const NoPrompt: Story = {
8296
args: {
83-
task: task({ created_by: null, title: "Untitled task" }),
97+
task: task({ description: "", title: "Untitled task" }),
8498
children: <MockTaskCard title="Untitled task" />,
8599
},
86100
};
101+
102+
export const NoStarter: Story = {
103+
args: {
104+
task: task({
105+
created_by: null,
106+
title: "Untitled task",
107+
description: "Summarize this week's shipped changes",
108+
}),
109+
children: <MockTaskCard title="Summarize this week's shipped changes" />,
110+
},
111+
};

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
RobotIcon,
66
} from "@phosphor-icons/react";
77
import { taskFeedRunStatus } from "@posthog/core/canvas/channelFeed";
8+
import { xmlToPlainText } from "@posthog/core/message-editor/content";
89
import {
910
Avatar,
1011
AvatarFallback,
@@ -430,6 +431,10 @@ export function TaskFeedRow({
430431
children?: ReactNode;
431432
}) {
432433
const starter = channelTaskStarter(task);
434+
const prompt = useMemo(
435+
() => xmlToPlainText(task.description ?? "").trim(),
436+
[task.description],
437+
);
433438

434439
return (
435440
<ThreadItem className="rounded-none py-1 pr-8 hover:bg-fill-hover/50">
@@ -454,8 +459,9 @@ export function TaskFeedRow({
454459
</ThreadItemTimestamp>
455460
</ThreadItemHeader>
456461

457-
<ThreadItemBody className="wrap-break-word">
458-
{starter ? "started a new task" : "A new task was started"}
462+
<ThreadItemBody className="wrap-break-word line-clamp-2 whitespace-pre-wrap">
463+
{prompt ||
464+
(starter ? "started a new task" : "A new task was started")}
459465
</ThreadItemBody>
460466

461467
{children}

0 commit comments

Comments
 (0)