fix(workbench): keep projected turn start time stable (#2039)
This commit is contained in:
@@ -111,7 +111,11 @@ export async function writeWorkbenchProjectionEvent({ runtimeStore = null, event
|
|||||||
const previousTerminal = checkpointIsTerminal(previousCheckpoint);
|
const previousTerminal = checkpointIsTerminal(previousCheckpoint);
|
||||||
const suppressedAfterSeal = previousTerminal && !terminal;
|
const suppressedAfterSeal = previousTerminal && !terminal;
|
||||||
const explicitStartedAt = optionalTimestampValue(event.startedAt ?? event.traceStartedAt ?? event.runnerStartedAt);
|
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 lastEventAt = latestTimestamp(previousTiming?.lastEventAt, occurredAt);
|
||||||
const finishedAt = terminal ? latestTimestamp(previousTiming?.lastEventAt, optionalTimestampValue(event.finishedAt), occurredAt) : null;
|
const finishedAt = terminal ? latestTimestamp(previousTiming?.lastEventAt, optionalTimestampValue(event.finishedAt), occurredAt) : null;
|
||||||
const timing = eventTimingProjection({ startedAt, lastEventAt, finishedAt, terminal });
|
const timing = eventTimingProjection({ startedAt, lastEventAt, finishedAt, terminal });
|
||||||
|
|||||||
Reference in New Issue
Block a user