Skip to content

Commit 54b2d49

Browse files
t3dotggclaude
andcommitted
fix(web): keep an in-progress image preview row from rendering empty
Standalone image rows sit outside any expanded group, so the neutral filter hid them while the tool was still in progress and left an empty gap. Image preview rows now bypass that filter. Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent 4780a81 commit 54b2d49

2 files changed

Lines changed: 31 additions & 9 deletions

File tree

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
shouldPreserveAssistantLineBreaks,
1313
type MessagesTimelineRow,
1414
workEntryDisplayLabel,
15+
workEntryIsVisibleInGroup,
1516
} from "./MessagesTimeline.logic";
1617

1718
describe("expanded tool group scrolling", () => {
@@ -471,6 +472,22 @@ describe("resolveAssistantMessageCopyState", () => {
471472
});
472473
});
473474

475+
describe("workEntryIsVisibleInGroup", () => {
476+
it("keeps an in-progress image preview row visible outside a group", () => {
477+
const entry = {
478+
id: "work-image",
479+
createdAt: "2026-01-01T00:00:04Z",
480+
turnId: "turn-1" as never,
481+
label: "Image view",
482+
detail: "screenshots/result.png",
483+
itemType: "image_view" as const,
484+
tone: "tool" as const,
485+
toolLifecycleStatus: "inProgress" as const,
486+
};
487+
expect(workEntryIsVisibleInGroup(entry, false)).toBe(true);
488+
});
489+
});
490+
474491
describe("deriveMessagesTimelineRows", () => {
475492
it("only enables assistant copy for the terminal assistant message in a turn", () => {
476493
const rows = deriveMessagesTimelineRows({
@@ -832,6 +849,8 @@ describe("deriveMessagesTimelineRows", () => {
832849
showAssistantMeta: false,
833850
showAssistantCopyButton: false,
834851
});
852+
});
853+
835854
it("keeps an image preview row visible after the turn settles", () => {
836855
const timelineEntries = [
837856
{

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ export function liveWorkEntryLabel(
9090
return workEntryDisplayLabel(entry, workspaceRoot);
9191
}
9292

93+
/**
94+
* Rows that preview an image the agent viewed or produced. They stay out of
95+
* tool groups and out of the settled-turn fold: the image is the answer the
96+
* user asked for, not tool noise to hide behind "Worked for ...".
97+
*/
98+
function workEntryRendersImagePreview(entry: WorkLogEntry): boolean {
99+
return workEntryViewedImagePath(entry) !== null;
100+
}
101+
93102
export function workEntryIsVisibleInGroup(
94103
entry: WorkLogEntry,
95104
expandedToolGroupEntry = false,
@@ -98,6 +107,9 @@ export function workEntryIsVisibleInGroup(
98107
(expandedToolGroupEntry &&
99108
(entry.toolLifecycleStatus === "inProgress" ||
100109
entry.sourceActivityKind === "task.progress")) ||
110+
// An image row stands alone outside any group, so the neutral filter
111+
// would leave an empty gap while its tool is still in progress.
112+
workEntryRendersImagePreview(entry) ||
101113
!workEntryIndicatesToolNeutralStatus(entry)
102114
);
103115
}
@@ -131,15 +143,6 @@ export function shouldFollowWorkGroupAppend(
131143
);
132144
}
133145

134-
/**
135-
* Rows that preview an image the agent viewed or produced. They stay out of
136-
* tool groups and out of the settled-turn fold: the image is the answer the
137-
* user asked for, not tool noise to hide behind "Worked for ...".
138-
*/
139-
function workEntryRendersImagePreview(entry: WorkLogEntry): boolean {
140-
return workEntryViewedImagePath(entry) !== null;
141-
}
142-
143146
export interface TimelineEndState {
144147
readonly isAtEnd?: boolean;
145148
readonly contentLength?: number;

0 commit comments

Comments
 (0)