Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/web/src/components/chat/TimelineAssistantRows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ function AssistantMessageMeta({
{!message.streaming && (
<Tooltip>
<TooltipTrigger render={<p className="text-muted-foreground text-xs tabular-nums" />}>
{formatDayAwareTimestamp(message.updatedAt, ctx.timestampFormat)}
{formatDayAwareTimestamp(message.editedAt ?? message.updatedAt, ctx.timestampFormat)}
</TooltipTrigger>
<TooltipPopup>
{formatChatTimestampTooltip(message.updatedAt, ctx.timestampFormat)}
{formatChatTimestampTooltip(message.editedAt ?? message.updatedAt, ctx.timestampFormat)}
</TooltipPopup>
</Tooltip>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { MESSAGES_ONLY_DISPLAY_MODE, NORMAL_DISPLAY_MODE } from "@t3tools/shared
import * as DateTime from "effect/DateTime";
import { createRef, type ComponentProps } from "react";
import { describe, expect, it, vi } from "vite-plus/test";
import { page, userEvent } from "vite-plus/test/browser";

import "~/index.css";

Expand All @@ -21,6 +22,7 @@ import { MessagesTimeline } from "../../components/chat/MessagesTimeline";
import { deriveMessagesTimelineRows } from "../../components/chat/MessagesTimeline.logic";
import { __setClientSettingsForTests } from "../../hooks/useSettings";
import { deriveTimelineEntriesFromVisibleTurnItems } from "../../session-logic";
import { formatChatTimestampTooltip, formatDayAwareTimestamp } from "../../timestampFormat";
import { applyDisplayMode } from "./displayModeTimeline";

const threadId = ThreadId.make("display-mode-thread");
Expand Down Expand Up @@ -290,8 +292,10 @@ describe("Messages only timeline", () => {
input: { text: "The build is red." },
output: { ok: true, message: "Shown to the user." },
};
const editedAt = new Date(Date.UTC(2026, 10, 3, 0, 47, 0)).toISOString();
const replace = (id: string, status: "completed" | "running"): OrchestrationV2TurnItem => ({
...base(id, 3),
completedAt: DateTime.makeUnsafe(editedAt),
status,
type: "dynamic_tool",
toolName: "mcp__t3-code__replace_send_to_user",
Expand All @@ -304,11 +308,19 @@ describe("Messages only timeline", () => {
});
const sent = entriesOf([userMessage("rewrite-ask", 0, "Is the build green?"), send]);

it("redraws the send's row with the new text when the rewrite arrives", async () => {
it("redraws the send's row with the new text and time when the rewrite arrives", async () => {
await using screen = await renderTimeline([
...applyDisplayMode(MESSAGES_ONLY_DISPLAY_MODE, sent),
]);
const shownTime = (at: string) => formatDayAwareTimestamp(at, "locale");
const rowOf = (text: string) =>
page.elementLocator(
screen.getByText(text).element().closest('[data-timeline-row-kind="message"]')!,
);
await expect.element(screen.getByText("The build is red.")).toBeVisible();
await expect
.element(rowOf("The build is red.").getByText(shownTime(time(1)), { exact: true }))
.toBeVisible();
const rewritten = [...sent, ...entriesOf([replace("rewrite-call", "completed")])];
await screen.rerender(
<MessagesTimeline
Expand All @@ -319,6 +331,14 @@ describe("Messages only timeline", () => {
);
await expect.element(screen.getByText("The build is green again.")).toBeVisible();
expect(screen.container.textContent ?? "").not.toContain("The build is red.");
const reply = rowOf("The build is green again.");
const shown = reply.getByText(shownTime(editedAt), { exact: true });
await expect.element(shown).toBeVisible();
expect(reply.element().textContent).not.toContain(shownTime(time(1)));
await userEvent.hover(shown);
await expect
.element(page.getByText(formatChatTimestampTooltip(editedAt, "locale"), { exact: true }))
.toBeVisible();
});

it("draws no row for a replace call in any mode, running or done", () => {
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/fork/displayMode/displayModeTimeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function replyEntry(
streaming: false,
createdBy: "agent",
createdAt: entry.createdAt,
// The turn fold's "Worked for" ends at updatedAt; the meta line shows editedAt instead.
updatedAt: entry.createdAt,
...(editedAt === undefined ? {} : { editedAt }),
},
Expand Down
Loading