Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-6333 fix(transcript): state the run's agent once, not on every prose row (#7128)
Bohan Jiangf320af4a5b60
diff --git a/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx b/packages/views/common/task-transcript/agent-transcript-dialog.test.tsxindex 150ee2ab3f..3ce00e90eb 100644--- a/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx+++ b/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx@@ -309,6 +309,57 @@ describe("AgentTranscriptDialog", () => {expect(screen.getByText(/"command": "pnpm test"/)).toBeInTheDocument();});+ // Regression, #7125: a run of short prose steps under a long agent name put+ // the same semibold name above every one-line body, so the row's heaviest+ // element was the one value that never changes. Identity belongs to the run,+ // and the header already carries it.+ it("states the agent once in the header, not on every prose row", () => {+ renderWithI18n(+ <AgentTranscriptDialog+ open+ onOpenChange={vi.fn()}+ task={{ ...baseTask, agent_id: "agent-1" }}+ items={[+ { seq: 1, type: "text", content: "Cleanup done. Starting tests:" },+ { seq: 2, type: "text", content: "Now adding the Feishu row:" },+ { seq: 3, type: "text", content: "Now the version bump:" },+ ]}+ agentName="【Chores|Opus5】Multica Helper"+ />,+ );++ expect(screen.getAllByTestId("rich-content")).toHaveLength(3);+ expect(screen.getAllByText("【Chores|Opus5】Multica Helper")).toHaveLength(1);+ expect(screen.getAllByTestId("actor-avatar")).toHaveLength(1);+ });++ // A facet is only readable if you can see what it selects. Tool facets always+ // could — their rows print the tool name — but prose rows carried no kind+ // mark at all, so "Agent" in the menu pointed at nothing.+ it("anchors each filter facet to the glyph its rows carry", () => {+ renderDialog([+ { seq: 1, type: "text", content: "Committing now:" },+ { seq: 2, type: "tool_use", tool: "Bash", input: { command: "git commit" } },+ ]);++ const agentFacet = screen.getByRole("menuitemcheckbox", { name: "Agent" });+ expect(agentFacet.querySelector(".lucide-bot")).not.toBeNull();++ const proseRow = screen.getByTestId("rich-content").closest(".group");+ expect(proseRow?.querySelector(".lucide-bot")).not.toBeNull();+ });++ it("names a tool facet the way its rows do, keeping the prefix in the key", () => {+ renderDialog([{ seq: 1, type: "tool_use", tool: "Bash", input: { command: "ls" } }]);++ expect(screen.getByRole("menuitemcheckbox", { name: "Bash" })).toBeInTheDocument();+ expect(screen.queryByRole("menuitemcheckbox", { name: "tool:Bash" })).toBeNull();++ // The label changed; the persisted facet key did not.+ fireEvent.click(screen.getByRole("menuitemcheckbox", { name: "Bash" }));+ expect(useTranscriptViewStore.getState().selectedFilterKeys).toEqual(["tool:Bash"]);+ });+it("folds a call and its result into one step instead of two rows", () => {renderDialog([{ seq: 1, type: "tool_use", tool: "Bash", input: { command: "ls" } },diff --git a/packages/views/common/task-transcript/agent-transcript-dialog.tsx b/packages/views/common/task-transcript/agent-transcript-dialog.tsxindex 8bcc52e67d..90d7d3aac9 100644--- a/packages/views/common/task-transcript/agent-transcript-dialog.tsx+++ b/packages/views/common/task-transcript/agent-transcript-dialog.tsx@@ -418,20 +418,25 @@ export function AgentTranscriptDialog({// why the pairing is positional.const steps = useMemo(() => buildSteps(items), [items]);+ // A facet reads as what its rows look like: the glyph the rows carry, and the+ // name the rows print. The first step of a kind stands in for the glyph. The+ // `tool:` prefix stays in the key (it is what gets persisted) but never+ // reaches the menu — the rows say `Bash`, so the facet says `Bash` too.const filterOptions = useMemo(() => {- const options = new Map<string, string>();+ const options = new Map<string, { label: string; step: TraceStep }>();for (const step of steps) {const key = stepFilterKey(step);if (options.has(key)) continue;- options.set(- key,- step.kind === "call"- ? key- : traceEventLabel({ type: step.item.type, tool: step.item.tool }),- );+ options.set(key, {+ label:+ step.kind === "call"+ ? step.tool || t(($) => $.transcript.kind_tool)+ : traceEventLabel({ type: step.item.type, tool: step.item.tool }),+ step,+ });}- return Array.from(options.entries()).sort((a, b) => a[1].localeCompare(b[1]));- }, [steps]);+ return Array.from(options.entries()).sort((a, b) => a[1].label.localeCompare(b[1].label));+ }, [steps, t]);const filterOptionKeys = useMemo(() => new Set(filterOptions.map(([value]) => value)),@@ -1036,13 +1041,19 @@ export function AgentTranscriptDialog({)}</DropdownMenuTrigger><DropdownMenuContent align="end" className="w-auto">- {filterOptions.map(([value, label]) => (+ {filterOptions.map(([value, option]) => (<DropdownMenuCheckboxItemkey={value}checked={selectedFilterKeys.includes(value)}onCheckedChange={() => toggleFilterKey(value)}>- {label}+ <span className="flex items-center gap-1.5">+ <StepIcon+ step={option.step}+ className="h-3 w-3 shrink-0 text-muted-foreground"+ />+ {option.label}+ </span></DropdownMenuCheckboxItem>))}{selectedFilterKeys.length > 0 && (@@ -1147,8 +1158,6 @@ export function AgentTranscriptDialog({itemContent={(_, row) => (<TranscriptRowrow={row}- agentName={agentName || agentInfo?.name || ""}- agentId={task.agent_id}runStartMs={runStartMs}isLive={isLive}selectedSeq={selectedSeq}@@ -1261,8 +1270,6 @@ function RunOutcomeRow({interface TranscriptRowProps {row: TraceRow;- agentName: string;- agentId?: string;runStartMs?: number;isLive: boolean;selectedSeq: number | null;@@ -1316,30 +1323,26 @@ function DurationCell({ ms, pending }: { ms?: number; pending?: boolean }) {* This is the layer inversion the redesign turns on: the report used to look* exactly like a `Read`, so the one thing worth reading was the hardest thing* to find. Prose is content and stays open; tool calls are evidence and fold.+ *+ * Identity is deliberately absent here. A transcript is one run by one agent —+ * `TraceMessageStep` carries no per-step actor, so an avatar and name on the+ * row would be the same two values repeated for every step, and the header+ * already states them. Repeating them cost a semibold 12px line above 12px+ * body text, which on a run of short steps made the row's heaviest element its+ * least informative one.+ *+ * What the row does keep is its kind: the same `StepIcon` column every other+ * row carries, so "Agent" in the filter has something to point at. Kind, not+ * identity — the glyph says "the agent's own words", which is what the facet+ * selects, and it says it in 12px without a repeated string.*/-function ProseRow({- row,- agentName,- agentId,- runStartMs,-}: TranscriptRowProps & { row: TraceMessageStep }) {+function ProseRow({ row, runStartMs }: TranscriptRowProps & { row: TraceMessageStep }) {return (<div className="group flex items-start gap-2 px-4 py-2.5"><OffsetCell startedAt={row.startedAt} runStartMs={runStartMs} /><span aria-hidden className="mt-1 w-0.5 self-stretch rounded-full bg-success" />- <div className="mt-0.5 shrink-0">- {agentId ? (- <ActorAvatar actorType="agent" actorId={agentId} size="sm" />- ) : (- <div className="flex h-5 w-5 items-center justify-center rounded-full bg-info/10 text-info">- <Bot className="h-3 w-3" />- </div>- )}- </div>+ <StepIcon step={row} className="mt-1 h-3 w-3 shrink-0 text-muted-foreground" /><div className="min-w-0 flex-1 pr-2">- {agentName && (- <div className="mb-0.5 text-caption font-semibold">{agentName}</div>- )}<RichContentcontent={row.item.content ?? ""}density="compact"