diff --git a/webui/src/components/thread/ThreadMessages.tsx b/webui/src/components/thread/ThreadMessages.tsx
index 8c1667b2a..24211c5da 100644
--- a/webui/src/components/thread/ThreadMessages.tsx
+++ b/webui/src/components/thread/ThreadMessages.tsx
@@ -188,9 +188,8 @@ export function ThreadMessages({
hasBodyBelow={false}
retryStatus={retryStatus}
startedAtMs={
- runStartedAt != null
- ? runStartedAt * 1000
- : pendingActivity.startedAtMs
+ // Match the activity timeline's prompt-based clock across the first output.
+ pendingActivity.startedAtMs ?? (runStartedAt != null ? runStartedAt * 1000 : undefined)
}
/>
diff --git a/webui/src/tests/thread-messages.test.tsx b/webui/src/tests/thread-messages.test.tsx
index 0793769d1..d893e3d32 100644
--- a/webui/src/tests/thread-messages.test.tsx
+++ b/webui/src/tests/thread-messages.test.tsx
@@ -16,52 +16,89 @@ afterEach(() => {
});
describe("ThreadMessages", () => {
- it("shows optimistic turn progress in the thread before the first agent output", () => {
+ it.each([0, -13_000, -14_000, -15_000, 15_000])(
+ "keeps the optimistic timer through acknowledgement and output with %i ms server clock skew",
+ (clockSkewMs) => {
+ vi.useFakeTimers();
+ const now = new Date("2026-08-13T10:00:05.000Z").getTime();
+ vi.setSystemTime(now);
+ const prompt: UIMessage = {
+ id: "u-optimistic",
+ role: "user",
+ content: "check this",
+ turnId: "turn-optimistic",
+ turnPhase: "user",
+ deliveryStatus: "sending",
+ createdAt: now,
+ };
+ const { rerender } = render(
+ ,
+ );
+
+ expect(screen.getByRole("status", { name: "Working for 0s" })).toBeInTheDocument();
+
+ rerender(
+ ,
+ );
+ expect(screen.getByRole("status", { name: "Working for 0s" })).toBeInTheDocument();
+ act(() => { vi.advanceTimersByTime(1000); });
+
+ rerender(
+ ,
+ );
+
+ expect(screen.getByRole("button", { name: "Working for 1s" })).toBeInTheDocument();
+ },
+ );
+
+ it("restores pending progress from the original prompt when guidance arrives", () => {
vi.useFakeTimers();
- const now = new Date("2026-08-13T10:00:05.000Z").getTime();
+ const now = 1_800_000_000_000;
vi.setSystemTime(now);
- const prompt: UIMessage = {
- id: "u-optimistic",
- role: "user",
- content: "check this",
- turnId: "turn-optimistic",
- turnPhase: "user",
- deliveryStatus: "sending",
- createdAt: now - 5_000,
- };
- const { rerender } = render(
- ,
- );
-
- expect(screen.getByRole("status", { name: "Working for 5s" })).toBeInTheDocument();
-
- rerender(
+ render(
,
);
-
- expect(screen.getByRole("button", { name: "Working for 5s" })).toBeInTheDocument();
+ expect(screen.getByRole("status", { name: "Working for 30s" })).toBeInTheDocument();
});
it("does not move a mounted tail answer into offscreen rendering on the next turn", () => {