diff --git a/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx b/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx index e8cf14f2e..17020185c 100644 --- a/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx +++ b/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx @@ -408,11 +408,13 @@ describe("AgentTranscriptDialog", () => { fireEvent.click(screen.getByRole("button", { name: "Copy all" })); + // Full body (not the truncated summary) with the RFC 3339 prefix, events + // separated by a blank line. expect(copyTextMock).toHaveBeenCalledWith( [ - "[2026-06-08T00:00:00.000Z] [Agent] Agent summary", + "[2026-06-08T00:00:00.000Z] [Agent] Agent summary\nAgent hidden detail", "[2026-06-08T08:00:05.123Z] [Thinking] Thinking summary", - ].join("\n"), + ].join("\n\n"), ); }); @@ -434,7 +436,7 @@ describe("AgentTranscriptDialog", () => { fireEvent.click(screen.getByRole("button", { name: "Copy all" })); expect(copyTextMock).toHaveBeenCalledWith( - ["[Agent] Missing timestamp", "[Error] Invalid timestamp"].join("\n"), + ["[Agent] Missing timestamp", "[Error] Invalid timestamp"].join("\n\n"), ); }); }); diff --git a/packages/views/common/task-transcript/trace-event-presenter.ts b/packages/views/common/task-transcript/trace-event-presenter.ts index fc04601ab..6ccddda69 100644 --- a/packages/views/common/task-transcript/trace-event-presenter.ts +++ b/packages/views/common/task-transcript/trace-event-presenter.ts @@ -147,7 +147,8 @@ export function traceEventSummary(event: TraceEvent): string { /** * Full, untruncated text for "copy all" — the complete body, not the one-line * summary. Tool calls copy their full input JSON; results and prose copy their - * whole content. Callers apply secret redaction on the result. + * whole content. An RFC 3339 timestamp prefixes the line when the event has a + * valid `created_at` (#5873). Callers apply secret redaction on the result. */ export function traceEventCopyText(event: TraceEvent): string { const label = traceEventLabel(event); @@ -162,7 +163,9 @@ export function traceEventCopyText(event: TraceEvent): string { default: body = event.content ?? ""; } - return body ? `[${label}] ${body}` : `[${label}]`; + const date = event.created_at ? new Date(event.created_at) : null; + const timestamp = date && !Number.isNaN(date.getTime()) ? `[${date.toISOString()}] ` : ""; + return body ? `${timestamp}[${label}] ${body}` : `${timestamp}[${label}]`; } export function traceEventHasDetail(event: TraceEvent): boolean {