Skip to content

Commit 500c29b

Browse files
fix(web): finished replies keep their hover timestamp while commands run
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 6838e31 commit 500c29b

3 files changed

Lines changed: 71 additions & 3 deletions

File tree

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,60 @@ describe("deriveMessagesTimelineRows", () => {
14801480
expect(rows.at(-1)).toMatchObject({ kind: "thinking" });
14811481
});
14821482

1483+
it("keeps the latest finished reply's timestamp while a command is still running", () => {
1484+
const reply = (streaming: boolean) => ({
1485+
id: "assistant-reply-entry",
1486+
kind: "message" as const,
1487+
createdAt: "2026-01-01T00:00:10Z",
1488+
message: {
1489+
id: "assistant-reply" as never,
1490+
role: "assistant" as const,
1491+
text: "Training finished, checking memory next.",
1492+
runId: "turn-1" as never,
1493+
createdAt: "2026-01-01T00:00:10Z",
1494+
updatedAt: "2026-01-01T00:00:12Z",
1495+
streaming,
1496+
},
1497+
});
1498+
const rowsWith = (streaming: boolean) =>
1499+
deriveMessagesTimelineRows({
1500+
timelineEntries: [
1501+
reply(streaming),
1502+
{
1503+
id: "command-entry",
1504+
kind: "work",
1505+
createdAt: "2026-01-01T00:00:15Z",
1506+
entry: {
1507+
id: "command",
1508+
createdAt: "2026-01-01T00:00:15Z",
1509+
runId: "turn-1" as never,
1510+
label: "Running command",
1511+
command: "nvidia-smi",
1512+
tone: "tool" as const,
1513+
toolLifecycleStatus: "inProgress" as const,
1514+
},
1515+
},
1516+
],
1517+
latestRun: {
1518+
runId: "turn-1" as never,
1519+
status: "running",
1520+
startedAt: "2026-01-01T00:00:00Z",
1521+
completedAt: null,
1522+
},
1523+
isWorking: true,
1524+
activeTurnStartedAt: "2026-01-01T00:00:00Z",
1525+
turnDiffSummaries: [],
1526+
supportsConversationRollback: false,
1527+
}).find((row) => row.id === "assistant-reply-entry");
1528+
1529+
expect(rowsWith(false)).toMatchObject({
1530+
showAssistantMeta: false,
1531+
showAssistantTimestamp: true,
1532+
showAssistantCopyButton: false,
1533+
});
1534+
expect(rowsWith(true)).toMatchObject({ showAssistantTimestamp: false });
1535+
});
1536+
14831537
it("does not show Thinking once the open run's provider turn has ended", () => {
14841538
const input = {
14851539
timelineEntries: [

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,8 @@ type MessagesTimelineRowContent =
602602
projectedItem?: OrchestrationV2ProjectedTurnItem;
603603
durationStart: string;
604604
showAssistantMeta: boolean;
605+
/** The latest finished reply of a still-running response shows only its timestamp. */
606+
showAssistantTimestamp: boolean;
605607
showAssistantCopyButton: boolean;
606608
assistantCopyStreaming: boolean;
607609
assistantTurnDiffSummary?: TurnDiffSummary | undefined;
@@ -1990,10 +1992,10 @@ export function deriveMessagesTimelineRows(input: {
19901992
const durationStart =
19911993
durationStartByMessageId.get(timelineEntry.message.id) ?? timelineEntry.message.createdAt;
19921994

1993-
const showAssistantMeta =
1995+
const isTerminalAssistantMessage =
19941996
timelineEntry.message.role === "assistant" &&
1995-
terminalAssistantMessageIds.has(timelineEntry.message.id) &&
1996-
!assistantResponseStillInProgress;
1997+
terminalAssistantMessageIds.has(timelineEntry.message.id);
1998+
const showAssistantMeta = isTerminalAssistantMessage && !assistantResponseStillInProgress;
19971999

19982000
nextRows.push({
19992001
kind: "message",
@@ -2005,6 +2007,10 @@ export function deriveMessagesTimelineRows(input: {
20052007
: { projectedItem: timelineEntry.projectedItem }),
20062008
durationStart,
20072009
showAssistantMeta,
2010+
showAssistantTimestamp:
2011+
isTerminalAssistantMessage &&
2012+
assistantResponseStillInProgress &&
2013+
!timelineEntry.message.streaming,
20082014
showAssistantCopyButton: showAssistantMeta,
20092015
assistantCopyStreaming: timelineEntry.message.streaming || assistantResponseStillInProgress,
20102016
assistantTurnDiffSummary:
@@ -2450,6 +2456,7 @@ function isRowUnchanged(a: MessagesTimelineRow, b: MessagesTimelineRow): boolean
24502456
a.projectedItem === bm.projectedItem &&
24512457
a.durationStart === bm.durationStart &&
24522458
a.showAssistantMeta === bm.showAssistantMeta &&
2459+
a.showAssistantTimestamp === bm.showAssistantTimestamp &&
24532460
a.showAssistantCopyButton === bm.showAssistantCopyButton &&
24542461
a.assistantCopyStreaming === bm.assistantCopyStreaming &&
24552462
a.assistantTurnDiffSummary === bm.assistantTurnDiffSummary &&

‎apps/web/src/components/chat/TimelineAssistantRows.tsx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ export function AssistantTimelineRow({ row }: { row: Extract<TimelineRow, { kind
6969
showCopyButton={row.showAssistantCopyButton}
7070
copyStreaming={row.assistantCopyStreaming}
7171
/>
72+
) : row.showAssistantTimestamp ? (
73+
<AssistantMessageMeta
74+
className="mt-1.5"
75+
message={row.message}
76+
showCopyButton={false}
77+
copyStreaming={row.assistantCopyStreaming}
78+
/>
7279
) : null}
7380
</div>
7481
</>

0 commit comments

Comments
 (0)