From 50734e5117dd1d84ced4c8f7a0dfd689e3b0caa7 Mon Sep 17 00:00:00 2001 From: Lyon <88232613+pikasTech@users.noreply.github.com> Date: Wed, 24 Jun 2026 13:08:27 +0800 Subject: [PATCH] fix(workbench): keep projected turn start time stable (#2039) --- internal/cloud/workbench-projection-writer.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/cloud/workbench-projection-writer.ts b/internal/cloud/workbench-projection-writer.ts index f5c209d1..00177896 100644 --- a/internal/cloud/workbench-projection-writer.ts +++ b/internal/cloud/workbench-projection-writer.ts @@ -111,7 +111,11 @@ export async function writeWorkbenchProjectionEvent({ runtimeStore = null, event const previousTerminal = checkpointIsTerminal(previousCheckpoint); const suppressedAfterSeal = previousTerminal && !terminal; const explicitStartedAt = optionalTimestampValue(event.startedAt ?? event.traceStartedAt ?? event.runnerStartedAt); - const startedAt = explicitStartedAt ?? previousTiming?.startedAt ?? (sourceSeq <= 1 ? occurredAt : null); + // Once a trace has a durable checkpoint, startedAt is sealed as the card + // elapsed-time source. Later trace/result hydration can carry older or newer + // startedAt values, but it must not make the visible Code Agent card jump by + // switching to a different clock origin. + const startedAt = previousTiming?.startedAt ?? explicitStartedAt ?? (sourceSeq <= 1 ? occurredAt : null); const lastEventAt = latestTimestamp(previousTiming?.lastEventAt, occurredAt); const finishedAt = terminal ? latestTimestamp(previousTiming?.lastEventAt, optionalTimestampValue(event.finishedAt), occurredAt) : null; const timing = eventTimingProjection({ startedAt, lastEventAt, finishedAt, terminal });