fix(workbench): keep projected turn start time stable (#2039)

This commit is contained in:
Lyon
2026-06-24 13:08:27 +08:00
committed by GitHub
parent 20bc5066c7
commit 50734e5117
@@ -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 });