TypeScript
fix(web): finished replies keep their hover timestamp while commands run (#28610)
Bilal Irfanf3ccba809ba9
diff --git a/apps/web/src/components/chat/MessagesTimeline.logic.test.ts b/apps/web/src/components/chat/MessagesTimeline.logic.test.tsindex 4c7eba620b5..e32a7eb485f 100644--- a/apps/web/src/components/chat/MessagesTimeline.logic.test.ts+++ b/apps/web/src/components/chat/MessagesTimeline.logic.test.ts@@ -1528,6 +1528,60 @@ describe("deriveMessagesTimelineRows", () => {expect(rows.at(-1)).toMatchObject({ kind: "thinking" });});+ it("keeps the latest finished reply's timestamp while a command is still running", () => {+ const reply = (streaming: boolean) => ({+ id: "assistant-reply-entry",+ kind: "message" as const,+ createdAt: "2026-01-01T00:00:10Z",+ message: {+ id: "assistant-reply" as never,+ role: "assistant" as const,+ text: "Training finished, checking memory next.",+ runId: "turn-1" as never,+ createdAt: "2026-01-01T00:00:10Z",+ updatedAt: "2026-01-01T00:00:12Z",+ streaming,+ },+ });+ const rowsWith = (streaming: boolean) =>+ deriveMessagesTimelineRows({+ timelineEntries: [+ reply(streaming),+ {+ id: "command-entry",+ kind: "work",+ createdAt: "2026-01-01T00:00:15Z",+ entry: {+ id: "command",+ createdAt: "2026-01-01T00:00:15Z",+ runId: "turn-1" as never,+ label: "Running command",+ command: "nvidia-smi",+ tone: "tool" as const,+ toolLifecycleStatus: "inProgress" as const,+ },+ },+ ],+ latestRun: {+ runId: "turn-1" as never,+ status: "running",+ startedAt: "2026-01-01T00:00:00Z",+ completedAt: null,+ },+ isWorking: true,+ activeTurnStartedAt: "2026-01-01T00:00:00Z",+ turnDiffSummaries: [],+ supportsConversationRollback: false,+ }).find((row) => row.id === "assistant-reply-entry");++ expect(rowsWith(false)).toMatchObject({+ showAssistantMeta: false,+ showAssistantTimestamp: true,+ showAssistantCopyButton: false,+ });+ expect(rowsWith(true)).toMatchObject({ showAssistantTimestamp: false });+ });+it("does not show Thinking once the open run's provider turn has ended", () => {const input = {timelineEntries: [diff --git a/apps/web/src/components/chat/MessagesTimeline.logic.ts b/apps/web/src/components/chat/MessagesTimeline.logic.tsindex 2fe811db4d1..8a4a7552901 100644--- a/apps/web/src/components/chat/MessagesTimeline.logic.ts+++ b/apps/web/src/components/chat/MessagesTimeline.logic.ts@@ -591,6 +591,8 @@ type MessagesTimelineRowContent =message: ChatMessage;projectedItem?: OrchestrationV2ProjectedTurnItem;showAssistantMeta: boolean;+ /** The latest finished reply of a still-running response shows only its timestamp. */+ showAssistantTimestamp: boolean;showAssistantCopyButton: boolean;assistantCopyStreaming: boolean;assistantTurnDiffSummary?: TurnDiffSummary | undefined;@@ -2027,10 +2029,10 @@ export function deriveMessagesTimelineRows(input: {timelineEntry.message.role === "assistant" &&runIdIsActiveResponse(timelineEntry.message.runId);- const showAssistantMeta =+ const isTerminalAssistantMessage =timelineEntry.message.role === "assistant" &&- terminalAssistantMessageIds.has(timelineEntry.message.id) &&- !assistantResponseStillInProgress;+ terminalAssistantMessageIds.has(timelineEntry.message.id);+ const showAssistantMeta = isTerminalAssistantMessage && !assistantResponseStillInProgress;nextRows.push({kind: "message",@@ -2041,6 +2043,10 @@ export function deriveMessagesTimelineRows(input: {? {}: { projectedItem: timelineEntry.projectedItem }),showAssistantMeta,+ showAssistantTimestamp:+ isTerminalAssistantMessage &&+ assistantResponseStillInProgress &&+ !timelineEntry.message.streaming,showAssistantCopyButton: showAssistantMeta,assistantCopyStreaming: timelineEntry.message.streaming || assistantResponseStillInProgress,assistantTurnDiffSummary:@@ -2504,6 +2510,7 @@ function isRowUnchanged(a: MessagesTimelineRow, b: MessagesTimelineRow): booleana.message === bm.message &&a.projectedItem === bm.projectedItem &&a.showAssistantMeta === bm.showAssistantMeta &&+ a.showAssistantTimestamp === bm.showAssistantTimestamp &&a.showAssistantCopyButton === bm.showAssistantCopyButton &&a.assistantCopyStreaming === bm.assistantCopyStreaming &&a.assistantTurnDiffSummary === bm.assistantTurnDiffSummary &&diff --git a/apps/web/src/components/chat/TimelineAssistantRows.tsx b/apps/web/src/components/chat/TimelineAssistantRows.tsxindex 458d84b9e98..b425e1009d1 100644--- a/apps/web/src/components/chat/TimelineAssistantRows.tsx+++ b/apps/web/src/components/chat/TimelineAssistantRows.tsx@@ -76,6 +76,13 @@ export function AssistantTimelineRow({ row }: { row: Extract<TimelineRow, { kindshowCopyButton={row.showAssistantCopyButton}copyStreaming={row.assistantCopyStreaming}/>+ ) : row.showAssistantTimestamp ? (+ <AssistantMessageMeta+ className="mt-1.5"+ message={row.message}+ showCopyButton={false}+ copyStreaming={row.assistantCopyStreaming}+ />) : null}</div></>diff --git a/apps/web/src/components/chat/timelineMinimapItems.test.ts b/apps/web/src/components/chat/timelineMinimapItems.test.tsindex 776cd39096a..a72813d8f75 100644--- a/apps/web/src/components/chat/timelineMinimapItems.test.ts+++ b/apps/web/src/components/chat/timelineMinimapItems.test.ts@@ -15,6 +15,7 @@ describe("deriveTimelineMinimapItems", () => {id: "image-only",createdAt: at,showAssistantMeta: false,+ showAssistantTimestamp: false,showAssistantCopyButton: false,assistantCopyStreaming: false,message: {