Skip to content

Commit c88c609

Browse files
authored
fix(canvas): show only team messages in thread sidebar on full task view
The channel task detail route renders the thread sidebar next to TaskDetail, which already hosts the agent session. The sidebar's timeline interleaved agent turns and user→agent prompts with the team conversation, so expanding a task from the channel-home thread left the same agent comms duplicated in both panes. Add a showAgentComms prop (default true) to ThreadPanel/ThreadSidebar that drops agent turns and prompts from the timeline and hides the agent status line. The full task view passes false, so its sidebar shows only the human-to-human thread. The channel-home sidebar is unchanged. Generated-By: PostHog Code Task-Id: c44f7e31-52a1-404e-8eda-0d21860bf272
1 parent d55d24e commit c88c609

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,13 +482,15 @@ function ThreadConversation({
482482
onToggleCollapsed,
483483
onOpenFull,
484484
showTaskSummary,
485+
showAgentComms,
485486
}: {
486487
task: Task;
487488
channelId: string;
488489
onClose?: () => void;
489490
onToggleCollapsed?: () => void;
490491
onOpenFull?: () => void;
491492
showTaskSummary: boolean;
493+
showAgentComms: boolean;
492494
}) {
493495
const taskId = task.id;
494496
const client = useOptionalAuthenticatedClient();
@@ -557,8 +559,8 @@ function ThreadConversation({
557559
const timeline = useMemo(
558560
() =>
559561
buildThreadTimeline({
560-
prompts: promptMsgs,
561-
agentMessages: agentMsgs,
562+
prompts: showAgentComms ? promptMsgs : [],
563+
agentMessages: showAgentComms ? agentMsgs : [],
562564
humanMessages: messages.map((message) => ({
563565
id: message.id,
564566
content: message.content,
@@ -567,7 +569,7 @@ function ThreadConversation({
567569
value: message,
568570
})),
569571
}),
570-
[promptMsgs, messages, agentMsgs],
572+
[promptMsgs, messages, agentMsgs, showAgentComms],
571573
);
572574

573575
const lastAgentId = agentMsgs[agentMsgs.length - 1]?.id;
@@ -680,7 +682,9 @@ function ThreadConversation({
680682
/>
681683
</div>
682684

683-
{agentStatus && <AgentStatusLine status={agentStatus} />}
685+
{showAgentComms && agentStatus && (
686+
<AgentStatusLine status={agentStatus} />
687+
)}
684688

685689
<ThreadReplyComposer
686690
draft={draft}
@@ -704,6 +708,7 @@ export function ThreadPanel({
704708
onToggleCollapsed,
705709
onOpenFull,
706710
showTaskSummary = true,
711+
showAgentComms = true,
707712
}: {
708713
taskId: string;
709714
channelId: string;
@@ -713,6 +718,7 @@ export function ThreadPanel({
713718
onToggleCollapsed?: () => void;
714719
onOpenFull?: () => void;
715720
showTaskSummary?: boolean;
721+
showAgentComms?: boolean;
716722
}) {
717723
const { data: fetchedTask } = useQuery({
718724
...taskDetailQuery(taskId),
@@ -747,6 +753,7 @@ export function ThreadPanel({
747753
onToggleCollapsed={onToggleCollapsed}
748754
onOpenFull={onOpenFull}
749755
showTaskSummary={showTaskSummary}
756+
showAgentComms={showAgentComms}
750757
/>
751758
);
752759
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export function ThreadSidebar({
1717
onClose,
1818
onOpenFull,
1919
showTaskSummary,
20+
showAgentComms = true,
2021
}: {
2122
taskId: string;
2223
channelId: string;
@@ -25,6 +26,8 @@ export function ThreadSidebar({
2526
onClose?: () => void;
2627
onOpenFull?: () => void;
2728
showTaskSummary?: boolean;
29+
/** Show agent turns/prompts and the agent status line. Off on the full task view, where the agent session already lives next to the thread. */
30+
showAgentComms?: boolean;
2831
}) {
2932
const collapsed = useThreadPanelStore((s) => s.collapsed);
3033
const width = useThreadPanelStore((s) => s.width);
@@ -49,6 +52,7 @@ export function ThreadSidebar({
4952
task={task}
5053
collapsed
5154
onToggleCollapsed={() => toggleCollapsed(false)}
55+
showAgentComms={showAgentComms}
5256
/>
5357
);
5458
}
@@ -70,6 +74,7 @@ export function ThreadSidebar({
7074
onToggleCollapsed={() => toggleCollapsed(true)}
7175
onOpenFull={onOpenFull}
7276
showTaskSummary={showTaskSummary}
77+
showAgentComms={showAgentComms}
7378
/>
7479
</ResizableSidebar>
7580
);

packages/ui/src/router/routes/website/$channelId/tasks/$taskId.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ function ChannelTaskDetailRoute() {
7373
channelId={channelId}
7474
task={task}
7575
showTaskSummary={false}
76+
showAgentComms={false}
7677
/>
7778
</div>
7879
);

0 commit comments

Comments
 (0)