fix(workbench): stabilize visible trace timing rows (#2006)
This commit is contained in:
@@ -266,7 +266,7 @@ function traceNoiseSummaryRow(trace: Record<string, unknown>, events: TraceEvent
|
|||||||
rowId: "trace-noise-summary",
|
rowId: "trace-noise-summary",
|
||||||
seq: traceEventDisplaySeq(lastEvent),
|
seq: traceEventDisplaySeq(lastEvent),
|
||||||
tone: lastEvent ? traceEventTone(lastEvent) : "source",
|
tone: lastEvent ? traceEventTone(lastEvent) : "source",
|
||||||
header: `${traceEventClock(lastEvent, options)} Trace ${status},等待可读事件`,
|
header: `Trace ${status},等待可读事件`,
|
||||||
body: `已隐藏 ${events.length} 条 AgentRun backend 状态事件。最新原始事件:${lastLabel}。`,
|
body: `已隐藏 ${events.length} 条 AgentRun backend 状态事件。最新原始事件:${lastLabel}。`,
|
||||||
bodyFormat: "text"
|
bodyFormat: "text"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -321,7 +321,23 @@ function maxDefinedDurationMs(...values: Array<number | undefined>): number | nu
|
|||||||
}
|
}
|
||||||
|
|
||||||
function messageDurationFloorKey(message: ChatMessage): string {
|
function messageDurationFloorKey(message: ChatMessage): string {
|
||||||
return firstNonEmptyString(message.id, message.runnerTrace?.traceId, message.traceId) ?? "unknown-agent-message";
|
const primary = firstNonEmptyString(message.traceId, message.runnerTrace?.traceId, message.turnId, message.id) ?? "unknown-agent-message";
|
||||||
|
migrateVisibleTimingAliases(primary, [message.id, message.runnerTrace?.traceId, message.traceId, message.turnId]);
|
||||||
|
return primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
function migrateVisibleTimingAliases(primary: string, aliases: unknown[]): void {
|
||||||
|
for (const aliasValue of aliases) {
|
||||||
|
if (typeof aliasValue !== "string") continue;
|
||||||
|
const alias = aliasValue.trim();
|
||||||
|
if (!alias || alias === primary) continue;
|
||||||
|
const timingSample = visibleTimingSamples.get(alias);
|
||||||
|
if (timingSample && !visibleTimingSamples.has(primary)) visibleTimingSamples.set(primary, { ...timingSample });
|
||||||
|
const displayedDuration = displayedDurationFloorMs.get(alias);
|
||||||
|
if (displayedDuration !== undefined && displayedDurationFloorMs.get(primary) === undefined) displayedDurationFloorMs.set(primary, displayedDuration);
|
||||||
|
const sealedDuration = sealedDurationMs.get(alias);
|
||||||
|
if (sealedDuration !== undefined && sealedDurationMs.get(primary) === undefined) sealedDurationMs.set(primary, sealedDuration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function messageActivityMeta(message: ChatMessage): { text: string; label: string } | null {
|
function messageActivityMeta(message: ChatMessage): { text: string; label: string } | null {
|
||||||
|
|||||||
Reference in New Issue
Block a user