Skip to content

Commit 2ef0c74

Browse files
t3dotggclaude
andcommitted
fix(web): keep image previews out of the live activity row
While the turn was still working, a trailing image view was collected into the live tool row, which renders only a label. The image appeared only after the turn settled. Image preview rows now stop the active collection the same way agent spawns and errors do. Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent fe2d057 commit 2ef0c74

2 files changed

Lines changed: 59 additions & 1 deletion

File tree

‎apps/web/src/components/chat/MessagesTimeline.logic.test.ts‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,63 @@ describe("deriveMessagesTimelineRows", () => {
633633
expect(rows.find((row) => row.id === "work-image-entry")?.kind).toBe("work");
634634
});
635635

636+
it("keeps a trailing image preview row visible while the turn is still working", () => {
637+
const rows = deriveMessagesTimelineRows({
638+
timelineEntries: [
639+
{
640+
id: "user-entry",
641+
kind: "message" as const,
642+
createdAt: "2026-01-01T00:00:00Z",
643+
message: {
644+
id: "user-1" as never,
645+
role: "user" as const,
646+
text: "show me the result",
647+
turnId: null,
648+
createdAt: "2026-01-01T00:00:00Z",
649+
updatedAt: "2026-01-01T00:00:00Z",
650+
streaming: false,
651+
},
652+
},
653+
{
654+
id: "work-command-entry",
655+
kind: "work" as const,
656+
createdAt: "2026-01-01T00:00:02Z",
657+
entry: {
658+
id: "work-command",
659+
createdAt: "2026-01-01T00:00:02Z",
660+
turnId: "turn-1" as never,
661+
label: "Ran command",
662+
tone: "tool" as const,
663+
},
664+
},
665+
{
666+
id: "work-image-entry",
667+
kind: "work" as const,
668+
createdAt: "2026-01-01T00:00:04Z",
669+
entry: {
670+
id: "work-image",
671+
createdAt: "2026-01-01T00:00:04Z",
672+
turnId: "turn-1" as never,
673+
label: "Image view",
674+
detail: "screenshots/result.png",
675+
itemType: "image_view" as const,
676+
tone: "tool" as const,
677+
},
678+
},
679+
],
680+
isWorking: true,
681+
activeTurnStartedAt: "2026-01-01T00:00:01Z",
682+
turnDiffSummaryByAssistantMessageId: new Map(),
683+
revertTurnCountByUserMessageId: new Map(),
684+
});
685+
686+
// The live activity row must not swallow the image: it renders only a
687+
// label, which would hide the image until the turn settles.
688+
const imageRow = rows.find((row) => row.id === "work-image-entry");
689+
expect(imageRow?.kind).toBe("work");
690+
expect(rows.some((row) => row.kind === "work-live")).toBe(false);
691+
});
692+
636693
it("folds all assistant messages before the terminal message", () => {
637694
const timelineEntries = [
638695
{

‎apps/web/src/components/chat/MessagesTimeline.logic.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,8 @@ export function deriveMessagesTimelineRows(input: {
599599
!entryBelongsToActiveTurn(entry, index) ||
600600
entry.kind !== "work" ||
601601
entry.entry.agentSpawn !== undefined ||
602-
entry.entry.tone === "error"
602+
entry.entry.tone === "error" ||
603+
workEntryRendersImagePreview(entry.entry)
603604
) {
604605
break;
605606
}

0 commit comments

Comments
 (0)