: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(desktop): collapse thread tool calls by default (#76640)
Adam Leithd527ef045c55
diff --git a/products/desktop/packages/ui/src/features/message-editor/components/PromptInput.tsx b/products/desktop/packages/ui/src/features/message-editor/components/PromptInput.tsxindex 46a08b2286a2..f8511405c50f 100644--- a/products/desktop/packages/ui/src/features/message-editor/components/PromptInput.tsx+++ b/products/desktop/packages/ui/src/features/message-editor/components/PromptInput.tsx@@ -411,6 +411,7 @@ export const PromptInput = forwardRef<EditorHandle, PromptInputProps>(onClick={handleSubmitClick}disabled={submitBlocked}aria-label="Send message"+ className="rounded-xs"{...(tourTarget && { "data-tour": `${tourTarget}-submit` })}><ArrowUp size={14} weight="bold" />@@ -513,7 +514,7 @@ export const PromptInput = forwardRef<EditorHandle, PromptInputProps>(<EditorContent editor={editor} /></div>{submitButton && (- <span className="absolute right-2 bottom-1">{submitButton}</span>+ <span className="absolute right-1 bottom-1">{submitButton}</span>)}</div></InputGroup>diff --git a/products/desktop/packages/ui/src/features/sessions/components/SessionView.tsx b/products/desktop/packages/ui/src/features/sessions/components/SessionView.tsxindex 64e8075cf199..e72e54817496 100644--- a/products/desktop/packages/ui/src/features/sessions/components/SessionView.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/SessionView.tsx@@ -133,7 +133,17 @@ const DEFAULT_ERROR_MESSAGE =* every panel width rather than only once the panel is wide enough for the* full column. Padding on the capped box instead of around it would eat into* `CHAT_CONTENT_MAX_WIDTH` and leave the composer narrower than the messages.+ *+ * The gutter is a percentage of this box, and the thread's equivalent box sits+ * inside a scroller whose `scrollbar-gutter: stable` has already taken the+ * scrollbar's width off it. Without matching that reservation here the composer+ * centers on a wider box and its column lands half a scrollbar to the right of+ * the messages. Reserving it the same way keeps the browser's own measurement+ * as the single source of truth; a hard-coded width would drift per platform.*/+/** Widest ring the composer paints outside its border box (quill's 3px focus outline). */+const OUTLINE_BLEED = 4;+function ComposerWidth({compact,children,@@ -146,7 +156,19 @@ function ComposerWidth({}return (- <Box style={{ paddingInline: CHAT_CONTENT_PADDING_INLINE }}>+ <Box+ style={{+ paddingInline: CHAT_CONTENT_PADDING_INLINE,+ overflow: "hidden",+ scrollbarGutter: "stable",+ // The composer's focus outline paints outside its border box, and this+ // box's top edge sits flush against it, so the clip would slice the+ // ring's top off. Buy it room and take the room back out of the layout.+ // (The sides have the gutter, and the capped box's `pb-2` covers below.)+ paddingBlockStart: OUTLINE_BLEED,+ marginBlockStart: -OUTLINE_BLEED,+ }}+ ><BoxclassName="mx-auto pb-2"style={{ maxWidth: CHAT_CONTENT_MAX_WIDTH }}diff --git a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatThread.tsx b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatThread.tsxindex 8cf3210c9e58..d2597660d3e5 100644--- a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatThread.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatThread.tsx@@ -145,6 +145,12 @@ function isToolCallItem(item: ConversationItem): item is SessionUpdateItem {);}+function isSessionUpdateItem(+ item: ConversationItem,+): item is SessionUpdateItem {+ return item.type === "session_update";+}+/*** Session-updates that `SessionUpdateView` always renders as `null`. They produce no row, so they* must not break a contiguous tool run.@@ -176,22 +182,42 @@ function isInvisibleItem(item: ConversationItem): boolean {return false;}+/**+ * A thought joins a tool run instead of breaking it. Between two calls it is the agent narrating+ * the stretch of work the run already stands for, so folding it in keeps one row for one stretch —+ * the group's body still lists it in order, and the row's own label follows it while it streams.+ * Prose to the user (`agent_message_chunk`) still breaks the run: that is said *to* you, not about+ * the work.+ */+function isThoughtItem(item: ConversationItem): boolean {+ return (+ item.type === "session_update" &&+ item.update.sessionUpdate === "agent_thought_chunk"+ );+}+/*** Collapse each contiguous run of ≥2 tool-call updates into a single `ToolGroupItem`. A run is- * broken by any *visible* non-tool item (prose, thought, status) so groups follow reading order;- * invisible updates (see {@link INVISIBLE_UPDATES}) are transparent and don't split a run. A lone- * tool call passes through untouched — it stays a single marker, matching the legacy thread.+ * broken by any *visible* non-tool, non-thought item (prose, status) so groups follow reading+ * order; invisible updates (see {@link INVISIBLE_UPDATES}) are transparent and don't split a run.+ * A lone tool call passes through untouched — it stays a single marker, matching the legacy thread,+ * and so do the thoughts around it: thoughts ride along a run, they never make one.*/function groupToolRuns(items: ConversationItem[]): ThreadItem[] {const out: ThreadItem[] = [];- // The buffer holds the active run: tool items plus any invisible items interleaved with them.+ // The buffer holds the active run in order: tools, the thoughts between them, and any invisible+ // items interleaved with either.let buffer: ConversationItem[] = [];let toolCount = 0;const flush = () => {if (toolCount >= 2) {- const tools = buffer.filter(isToolCallItem);- out.push({ type: "tool_group", id: tools[0].id, tools });+ out.push({+ type: "tool_group",+ // The run's first tool call, so the id is stable as thoughts append around it.+ id: buffer.filter(isToolCallItem)[0].id,+ items: buffer.filter(isSessionUpdateItem),+ });} else {out.push(...buffer);}@@ -203,8 +229,8 @@ function groupToolRuns(items: ConversationItem[]): ThreadItem[] {if (isToolCallItem(item)) {buffer.push(item);toolCount++;- } else if (isInvisibleItem(item)) {- // Don't break the run; carry it along (it renders nothing wherever it lands).+ } else if (isInvisibleItem(item) || isThoughtItem(item)) {+ // Don't break the run; carry it along in order.buffer.push(item);} else {flush();@@ -595,12 +621,12 @@ function ThreadItemBody({keyboardFocused?: boolean;}) {if (item.type === "tool_group") {- const context = item.tools[0]?.turnContext;+ const context = item.items[0]?.turnContext;const turnStreaming =!!context && !context.turnComplete && !context.turnCancelled;return (<ToolGroup- tools={item.tools}+ items={item.items}mayStillGrow={isTrailing && turnStreaming}/>);diff --git a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ToolGroup.test.tsx b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ToolGroup.test.tsxindex 6aca2a905848..21ecfcd49051 100644--- a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ToolGroup.test.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ToolGroup.test.tsx@@ -7,13 +7,15 @@ import { Container } from "inversify";import { describe, expect, it } from "vitest";import { ToolGroup } from "./ToolGroup";+type SessionUpdateItem = Extract<ConversationItem, { type: "session_update" }>;+function subagentItem(id: string,options: {status?: "completed" | "in_progress";turnComplete?: boolean;} = {},-): Extract<ConversationItem, { type: "session_update" }> {+): SessionUpdateItem {return {type: "session_update",id,@@ -31,44 +33,81 @@ function subagentItem(turnCancelled: false,turnComplete: options.turnComplete ?? true,},- } as Extract<ConversationItem, { type: "session_update" }>;+ } as SessionUpdateItem;+}++function thoughtItem(+ id: string,+ options: { thoughtComplete: boolean; turnComplete?: boolean },+): SessionUpdateItem {+ return {+ type: "session_update",+ id,+ update: {+ sessionUpdate: "agent_thought_chunk",+ content: { type: "text", text: "weighing the options" },+ },+ thoughtComplete: options.thoughtComplete,+ turnContext: {+ toolCalls: new Map(),+ childItems: new Map(),+ turnCancelled: false,+ turnComplete: options.turnComplete ?? true,+ },+ } as SessionUpdateItem;+}++function renderGroup(items: SessionUpdateItem[]) {+ return render(+ <ServiceProvider container={new Container()}>+ <Theme>+ <ToolGroup items={items} />+ </Theme>+ </ServiceProvider>,+ );}describe("ToolGroup", () => {- it("labels Codex spawn batches as subagents", () => {- render(- <ServiceProvider container={new Container()}>- <Theme>- <ToolGroup- tools={[subagentItem("spawn-1"), subagentItem("spawn-2")]}- />- </Theme>- </ServiceProvider>,- );+ const running = { status: "in_progress", turnComplete: false } as const;- expect(screen.getByText("Used Subagents")).toBeInTheDocument();+ // The row is one line standing in for a whole run, so what that line says is the contract: what+ // is happening while it runs, what it did once it settles.+ it.each([+ {+ name: "tallies the run once it settles",+ items: [subagentItem("spawn-1"), subagentItem("spawn-2")],+ expected: "2 subagents",+ },+ {+ name: "names the current tool while the run is active",+ items: [+ subagentItem("spawn-1", running),+ subagentItem("spawn-2", running),+ ],+ expected: "Subagents",+ },+ {+ name: "reads as thinking while a trailing thought streams",+ items: [+ subagentItem("spawn-1", running),+ subagentItem("spawn-2", running),+ thoughtItem("thought-1", {+ thoughtComplete: false,+ turnComplete: false,+ }),+ ],+ expected: "Thinking…",+ },+ ])("$name", ({ items, expected }) => {+ renderGroup(items);+ expect(screen.getByText(expected)).toBeInTheDocument();});- it("labels unresolved Codex spawn batches as active subagents", () => {- render(- <ServiceProvider container={new Container()}>- <Theme>- <ToolGroup- tools={[- subagentItem("spawn-1", {- status: "in_progress",- turnComplete: false,- }),- subagentItem("spawn-2", {- status: "in_progress",- turnComplete: false,- }),- ]}- />- </Theme>- </ServiceProvider>,+ it("starts collapsed", () => {+ renderGroup([subagentItem("spawn-1"), subagentItem("spawn-2")]);+ expect(screen.getAllByRole("button")[0]).toHaveAttribute(+ "aria-expanded",+ "false",);-- expect(screen.getByText("Using Subagents")).toBeInTheDocument();});});diff --git a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ToolGroup.tsx b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ToolGroup.tsxindex 8053eaa6cb11..78090fcf7b9f 100644--- a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ToolGroup.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ToolGroup.tsx@@ -1,4 +1,3 @@-import { Wrench } from "@phosphor-icons/react";import {ChatMarker,ChatMarkerContent,@@ -8,28 +7,32 @@ import {} from "@posthog/quill";import { readAgentToolName } from "@posthog/shared";import type { ToolCall } from "@posthog/ui/features/sessions/types";-import { memo } from "react";+import { AnimatePresence, motion, useReducedMotion } from "framer-motion";+import { memo, useMemo } from "react";import type { ConversationItem } from "../buildConversationItems";+import { summarize } from "../new-thread/buildThreadGroups";import { grouping } from "../new-thread/conversationThreadConfig";import { SessionUpdateView } from "../session-update/SessionUpdateView";import { iconForToolCall } from "../session-update/toolCallUtils";-/** A contiguous run (≥2) of `tool_call` session-updates from one assistant turn. */+type SessionUpdateItem = Extract<ConversationItem, { type: "session_update" }>;++/** A contiguous run of one assistant turn's work: ≥2 `tool_call` updates plus the thoughts between them. */export type ToolGroupItem = {type: "tool_group";id: string;- tools: Extract<ConversationItem, { type: "session_update" }>[];+ /** Everything in the run, in order — what the body lists and what the summary counts. */+ items: SessionUpdateItem[];};/** Pull the resolved ToolCall + agent tool name from a `tool_call` session-update item. */-function resolveTool(item: ToolGroupItem["tools"][number]): {+function resolveTool(item: SessionUpdateItem): {toolCall: ToolCall;toolName?: string;} {- const update = item.update as Extract<- ConversationItem,- { type: "session_update" }- >["update"] & { toolCallId?: string };+ const update = item.update as SessionUpdateItem["update"] & {+ toolCallId?: string;+ };const mapped = update.toolCallId? item.turnContext.toolCalls.get(update.toolCallId): undefined;@@ -47,7 +50,7 @@ function resolveTool(item: ToolGroupItem["tools"][number]): {}/** Identity used to decide if a group is "all the same tool". */-function toolKey(item: ToolGroupItem["tools"][number]): string {+function toolKey(item: SessionUpdateItem): string {const { toolCall, toolName } = resolveTool(item);return toolName ?? toolCall.kind ?? "tool";}@@ -63,7 +66,7 @@ function friendlyName(key: string): string {return spaced.charAt(0).toUpperCase() + spaced.slice(1).toLowerCase();}-export function isToolActive(item: ToolGroupItem["tools"][number]): boolean {+export function isToolActive(item: SessionUpdateItem): boolean {const { toolCall } = resolveTool(item);const incomplete =toolCall.status === "pending" || toolCall.status === "in_progress";@@ -74,48 +77,89 @@ export function isToolActive(item: ToolGroupItem["tools"][number]): boolean {);}+/** True while the run's last item is a thought still streaming — the agent is mid-reasoning. */+function isThinking(items: SessionUpdateItem[]): boolean {+ const last = items.at(-1);+ return (+ last?.update.sessionUpdate === "agent_thought_chunk" &&+ last.thoughtComplete === false+ );+}++/** Cross-fade between successive labels, so the row reads as one thing changing, not a new row. */+const LABEL_MOTION = {+ initial: { opacity: 0 },+ animate: { opacity: 1 },+ exit: { opacity: 0 },+ transition: { duration: 0.18, ease: "easeOut" as const },+};+/**- * Summary `ChatMarker` for a batch of consecutive tool calls. The trigger row reads as natural- * language — "Using Toolsearch" while a tool is still running, "Used Toolsearch" once done, or- * "Used N tools" when the batch mixes tools — with a single representative leading icon. The- * collapsible body holds each tool's own marker via `SessionUpdateView` (which dispatches through- * `ToolCallBlock` → `ToolRow` → `ChatMarker`).+ * One row standing in for a whole stretch of work: the tool calls and the thoughts between them.*- * Expanded by default while the turn is still running (live visibility), collapsed once complete.+ * While it runs the row narrates — spinner plus whatever is happening right now (the current tool,+ * or "Thinking…" while the agent reasons between calls), cross-fading as that changes. Once the run+ * settles it collapses to what it did ("Ran 3 commands, read a file"), tallied by the same+ * `summarize` the legacy view uses. Opening it lists every step in order via `SessionUpdateView`.*/export const ToolGroup = memo(function ToolGroup({- tools,+ items,mayStillGrow = false,}: {- tools: ToolGroupItem["tools"];+ items: SessionUpdateItem[];/*** True when this run is the turn's trailing content and the turn is still- * streaming — more tool calls may append to it. Keeps the label on "Using"- * through the gaps between calls (every tool settled, next one not yet- * issued), where the group's own status alone would flip it to "Used"- * mid-turn and read as stalled.+ * streaming — more tool calls may append to it. Keeps the label live through+ * the gaps between calls (every tool settled, next one not yet issued), where+ * the group's own status alone would flip it to the done summary mid-turn and+ * read as stalled.*/mayStillGrow?: boolean;}) {- const turnComplete = tools[0]?.turnContext.turnComplete ?? false;- const isActive = tools.some(isToolActive) || mayStillGrow;+ const reduceMotion = useReducedMotion();+ // Derived, not passed: two arrays that have to agree can stop agreeing.+ const tools = useMemo(+ () => items.filter((item) => item.update.sessionUpdate === "tool_call"),+ [items],+ );+ const thinking = isThinking(items);+ const isActive = tools.some(isToolActive) || thinking || mayStillGrow;- // Uniform when every tool in the run shares the same name/kind — then we can name it.- const keys = tools.map(toolKey);- const uniform = keys.every((k) => k === keys[0]);+ // Grouping only ever builds a run around ≥2 tool calls, but the component is exported, so a+ // thought-only run resolves to no current tool rather than throwing on `undefined`.+ const currentItem =+ [...tools].reverse().find(isToolActive) ?? tools[tools.length - 1];+ const current = currentItem ? resolveTool(currentItem) : null;+ const currentName = currentItem ? friendlyName(toolKey(currentItem)) : null;+ const currentContext =+ current?.toolCall.title &&+ currentName &&+ current.toolCall.title.toLocaleLowerCase() !==+ currentName.toLocaleLowerCase()+ ? current.toolCall.title+ : null;+ const LeadIcon = current+ ? iconForToolCall(current.toolCall, current.toolName)+ : null;- const verb = isActive ? "Using" : "Used";- const object = uniform ? friendlyName(keys[0]) : `${tools.length} tools`;+ // A settled run reads as a tally of what happened. One with nothing countable keeps the live+ // shape rather than falling back to summarize's "Worked". Memoized because the trailing group+ // re-renders per streamed token, and this walks the whole run.+ const summary = useMemo(() => summarize(items), [items]);+ const showSummary = !isActive && summary.hasCountableWork;- const first = resolveTool(tools[0]);- const LeadIcon = uniform- ? iconForToolCall(first.toolCall, first.toolName)- : Wrench;+ // Keyed so a change swaps the label through the cross-fade. Thinking is its own key, so a run+ // that returns to the same tool after a thought still animates the change.+ const labelKey = showSummary+ ? `done:${summary.doneLabel}`+ : thinking || !currentName+ ? "thinking"+ : `tool:${currentName}:${currentContext ?? ""}`;return (<ChatMarker- defaultOpen={!turnComplete}- body={tools.map((item) => (+ defaultOpen={false}+ body={items.map((item) => (<SessionUpdateViewkey={item.id}item={item.update}@@ -126,13 +170,54 @@ export const ToolGroup = memo(function ToolGroup({thoughtComplete={item.thoughtComplete}/>))}- className="opacity-50 hover:opacity-100"+ // Matches ToolRow: aligned to the text column, no hover fill, inset ring,+ // and open looks the same as hover.+ className={cn(+ "mx-0 px-0 opacity-50 hover:bg-transparent hover:opacity-100 focus-visible:bg-transparent",+ "data-panel-open:bg-transparent data-panel-open:opacity-100",+ // The installed quill parks the chevron with `margin-inline-start: auto`;+ // unset it so it sits against the text it opens. Newer quill already+ // hugs, at which point this is inert.+ "[&>svg:last-child]:ms-0",+ "focus-visible:shadow-none focus-visible:ring-(--ring)/50 focus-visible:ring-2 focus-visible:ring-inset",+ )}>- <ChatMarkerIcon>{isActive ? <Spinner /> : <LeadIcon />}</ChatMarkerIcon>+ <ChatMarkerIcon>+ {isActive || !LeadIcon ? <Spinner /> : <LeadIcon />}+ </ChatMarkerIcon><ChatMarkerContent- className={cn("text-muted-foreground text-sm", isActive && "shimmer")}+ className={cn(+ "flex min-w-0 items-center gap-1.5 overflow-hidden text-muted-foreground text-sm",+ isActive && "shimmer",+ )}>- {verb} {object}+ {/* `mode="wait"` so the outgoing label clears before the next fades in — overlapping them+ on one line reads as a flicker rather than a change. */}+ <AnimatePresence mode="wait" initial={false}>+ <motion.span+ key={labelKey}+ className="flex min-w-0 items-center gap-1.5"+ initial={reduceMotion ? false : LABEL_MOTION.initial}+ animate={reduceMotion ? undefined : LABEL_MOTION.animate}+ exit={reduceMotion ? undefined : LABEL_MOTION.exit}+ transition={reduceMotion ? undefined : LABEL_MOTION.transition}+ >+ {showSummary ? (+ <span className="truncate">{summary.doneLabel}</span>+ ) : thinking || !currentName ? (+ <span className="shrink-0 font-medium">Thinking…</span>+ ) : (+ <>+ <span className="shrink-0 font-medium">{currentName}</span>+ {currentContext ? (+ <span className="truncate text-muted-foreground/70">+ {currentContext}+ </span>+ ) : null}+ </>+ )}+ </motion.span>+ </AnimatePresence></ChatMarkerContent></ChatMarker>);diff --git a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/threadVirtualization.test.ts b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/threadVirtualization.test.tsindex 73178cf47073..bde5e6795470 100644--- a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/threadVirtualization.test.ts+++ b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/threadVirtualization.test.ts@@ -42,7 +42,7 @@ function sessionUpdate(}function toolGroup(id: string, tools: SessionUpdateItem[]): ToolGroupItem {- return { type: "tool_group", id, tools };+ return { type: "tool_group", id, items: tools };}function agentTurn(diff --git a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/threadVirtualization.ts b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/threadVirtualization.tsindex 5375b512e919..f8142edd0f41 100644--- a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/threadVirtualization.ts+++ b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/threadVirtualization.ts@@ -89,14 +89,14 @@ export interface FlatThreadRow {}/**- * Completion time of an agent turn, taken from its last session-update item (tool groups count- * by their last tool). Undefined while the turn is still streaming — the timestamp only appears+ * Completion time of an agent turn, taken from its last session-update item (a tool group counts+ * by the last step in its run). Undefined while the turn is still streaming — the timestamp only appears* once the whole turn is done.*/export function completedTurnTimestamp(turn: AgentTurn): number | undefined {for (let i = turn.items.length - 1; i >= 0; i--) {const item = turn.items[i];- const last = item.type === "tool_group" ? item.tools.at(-1) : item;+ const last = item.type === "tool_group" ? item.items.at(-1) : item;if (last?.type !== "session_update") continue;return last.turnContext.turnComplete ? last.timestamp : undefined;}diff --git a/products/desktop/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.ts b/products/desktop/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.tsindex ea0375987273..50e0d7d312b3 100644--- a/products/desktop/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.ts+++ b/products/desktop/packages/ui/src/features/sessions/components/new-thread/buildThreadGroups.ts@@ -125,7 +125,11 @@ export function isGroupableItem(item: ConversationItem): boolean {return true;}-function summarize(items: ConversationItem[]): GroupSummary {+/**+ * Tallies, icons, and live/done labels for a run of grouped items. Exported so the quill thread's+ * `ToolGroup` reads the same counts this view does — one place decides what "ran 3 commands" means.+ */+export function summarize(items: ConversationItem[]): GroupSummary {const counts: GroupCounts = {execute: 0,read: 0,diff --git a/products/desktop/packages/ui/src/features/sessions/components/session-update/EditToolView.tsx b/products/desktop/packages/ui/src/features/sessions/components/session-update/EditToolView.tsxindex b130c94c8acd..78dd87553dc3 100644--- a/products/desktop/packages/ui/src/features/sessions/components/session-update/EditToolView.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/session-update/EditToolView.tsx@@ -1,5 +1,6 @@import { PencilSimple } from "@phosphor-icons/react";import { Text } from "@radix-ui/themes";+import { useChatThreadChrome } from "../chat-thread/chatThreadChrome";import { CodePreview } from "./CodePreview";import { FileMentionChip } from "./FileMentionChip";import { ToolRow } from "./ToolRow";@@ -67,6 +68,7 @@ export function EditToolView({const diffStats = diff ? getDiffStats(oldText, newText) : null;const isPlanFile = filePath.includes("claude/plans/");+ const chatChrome = useChatThreadChrome();return (<ToolRow@@ -74,7 +76,9 @@ export function EditToolView({isLoading={isLoading}isFailed={isFailed}wasCancelled={wasCancelled}- defaultOpen={!isPlanFile}+ // Keep the legacy thread's inline diff behavior, but make tool details+ // opt-in in the experimental thread like every other tool result.+ defaultOpen={chatChrome ? false : !isPlanFile}content={hasDiff ? (<CodePreviewdiff --git a/products/desktop/packages/ui/src/features/sessions/components/session-update/FileMentionChip.tsx b/products/desktop/packages/ui/src/features/sessions/components/session-update/FileMentionChip.tsxindex 9da40b2ca2cb..54f90f40d89b 100644--- a/products/desktop/packages/ui/src/features/sessions/components/session-update/FileMentionChip.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/session-update/FileMentionChip.tsx@@ -85,11 +85,12 @@ export const FileMentionChip = memo(function FileMentionChip({<Text className="text-[13px]"><FileIcon filename={filename} size={12} /><span className="flex min-w-0 flex-1 items-baseline gap-1 overflow-hidden font-mono text-[13px] leading-none">- <span className="shrink-0 whitespace-nowrap font-semibold">- {filename}- </span>+ {/* The directory gives way first, so the filename only ellipsizes once+ there's no room for it either — better than a hard clip at the+ row's edge, which is what `shrink-0` produced. */}+ <span className="min-w-0 truncate font-semibold">{filename}</span>{directory && (- <span className="min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-gray-9">+ <span className="min-w-0 shrink-[9999] overflow-hidden text-ellipsis whitespace-nowrap text-muted-foreground/50">{directory}</span>)}diff --git a/products/desktop/packages/ui/src/features/sessions/components/session-update/ToolRow.tsx b/products/desktop/packages/ui/src/features/sessions/components/session-update/ToolRow.tsxindex 359c18f128ed..759fa72ff7f1 100644--- a/products/desktop/packages/ui/src/features/sessions/components/session-update/ToolRow.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/session-update/ToolRow.tsx@@ -91,17 +91,41 @@ export function ToolRow({defaultOpen={defaultOpen}open={open}onOpenChange={onOpenChange}- // Hover/selected chrome only when the row actually expands on click — a- // flat marker (e.g. "Thinking" before any content arrives) shouldn't- // invite interaction it can't honor.+ // Quill's interactive row bleeds its hit area 4px past the text column+ // and fills on hover; in a transcript of these that reads as a wall of+ // controls, so the row aligns to the column and brightens instead. The+ // focus ring goes inset for the same reason — an outset ring on a+ // full-bleed row draws outside the column.+ //+ // Open reads exactly like hover — the row you opened is the row you were+ // pointing at, so it shouldn't change appearance under the cursor. Only+ // rows that actually expand on click get it: a flat marker (e.g.+ // "Thinking" before any content arrives) shouldn't invite interaction it+ // can't honor.className={cn(- "opacity-50",+ "mx-0 px-0 opacity-50 hover:bg-transparent focus-visible:bg-transparent",+ // The installed quill parks the chevron with `margin-inline-start: auto`;+ // unset it so it sits against the text it opens. Newer quill already+ // hugs, at which point this is inert.+ "[&>svg:last-child]:ms-0",+ "focus-visible:shadow-none focus-visible:ring-(--ring)/50 focus-visible:ring-2 focus-visible:ring-inset",isCollapsible &&- "hover:opacity-100 data-panel-open:bg-fill-selected data-panel-open:opacity-100",+ "hover:opacity-100 data-panel-open:bg-transparent data-panel-open:opacity-100",+ // A failed call goes destructive whole-row, at full strength — the+ // outcome is the point of the row, and a red "(Failed)" alone reads as+ // an aside when the title beside it is still neutral. The descendant+ // selector is what makes it stick: the title, the argument, and the+ // status text each set their own muted color. Scoped to the trigger,+ // so a nested marker in the panel keeps its own outcome.+ isFailed &&+ "text-destructive-foreground opacity-100 [&_*]:text-destructive-foreground",)}><ChatMarkerIcon>{iconNode}</ChatMarkerIcon>- <ChatMarkerContent className="flex w-full min-w-0 flex-nowrap items-center gap-1">+ {/* No `w-full`: the content sizes to its text so the chevron hugs the+ end of it, and `overflow-hidden` clips anything that outgrows the+ trigger rather than letting it spill past the row. */}+ <ChatMarkerContent className="flex min-w-0 flex-nowrap items-center gap-1 overflow-hidden">{/* Example: posthog - insight-create(... */}{typeof children === "string" ? (<ToolTitle>{children}</ToolTitle>diff --git a/products/desktop/packages/ui/src/features/sessions/components/session-update/toolCallUtils.tsx b/products/desktop/packages/ui/src/features/sessions/components/session-update/toolCallUtils.tsxindex ecf37e7e3a3b..936b216be18f 100644--- a/products/desktop/packages/ui/src/features/sessions/components/session-update/toolCallUtils.tsx+++ b/products/desktop/packages/ui/src/features/sessions/components/session-update/toolCallUtils.tsx@@ -65,7 +65,7 @@ export function ToolTitle({// original styling so toggling the chat thread off leaves ConversationView pixel-identical.const chatChrome = useChatThreadChrome();const base = chatChrome- ? "text-sm text-muted-foreground truncate shrink-0 max-w-[calc(100%-1.5rem)]"+ ? "text-sm text-muted-foreground truncate min-w-0": "text-[13px] text-gray-11";return <Text className={cn(base, className)}>{children}</Text>;}