diff --git a/internal/cloud/server-code-agent-http.ts b/internal/cloud/server-code-agent-http.ts index 8210deec..a67d3de5 100644 --- a/internal/cloud/server-code-agent-http.ts +++ b/internal/cloud/server-code-agent-http.ts @@ -3658,10 +3658,10 @@ function recordCodeAgentProjectionMetrics(options = {}, { result = null, trace = projectedLatestEventAt: projection.updatedAt ?? trace?.updatedAt ?? result?.updatedAt ?? null, terminalSourceAt: terminalSourceAtFromResult(result), terminalProjectedAt: projection.projectionStatus === "caught-up" ? projection.updatedAt ?? trace?.updatedAt ?? result?.updatedAt ?? null : null, - status: result?.status ?? trace?.status ?? "unknown", + status: projection?.status ?? "unknown", reason: projectionReason(projection, refreshError), projectionStatus: projection.projectionStatus ?? "unknown", - source: result?.agentRun ? "agentrun_v01" : "workbench_read_model" + source: "workbench_read_model" }); } diff --git a/web/hwlab-cloud-web/src/composables/useTraceSubscription.ts b/web/hwlab-cloud-web/src/composables/useTraceSubscription.ts index 95a4209f..c52b0ee7 100644 --- a/web/hwlab-cloud-web/src/composables/useTraceSubscription.ts +++ b/web/hwlab-cloud-web/src/composables/useTraceSubscription.ts @@ -185,7 +185,7 @@ export function mergeTraceResults(terminal: AgentChatResultResponse, trace: Trac terminalEvidence: mergedTrace.terminalEvidence ?? terminal.terminalEvidence, finalResponse: terminal.finalResponse, traceSummary: mergedTrace.traceSummary ?? terminal.traceSummary, - lastEventLabel: mergedTrace.lastEventLabel ?? terminal.lastEventLabel ?? events.at(-1)?.label + lastEventLabel: mergedTrace.lastEventLabel ?? terminal.lastEventLabel ?? undefined }; } @@ -308,7 +308,7 @@ function mergeTraceSnapshots(previous: TraceSnapshot | null, next: TraceSnapshot lastEventAt: next.lastEventAt ?? next.timing?.lastEventAt ?? previous.lastEventAt ?? previous.timing?.lastEventAt ?? null, finishedAt: next.finishedAt ?? next.timing?.finishedAt ?? previous.finishedAt ?? previous.timing?.finishedAt ?? null, durationMs: next.durationMs ?? next.timing?.durationMs ?? previous.durationMs ?? previous.timing?.durationMs ?? null, - lastEventLabel: next.lastEventLabel ?? previous.lastEventLabel ?? events.at(-1)?.label ?? events.at(-1)?.type, + lastEventLabel: next.lastEventLabel ?? previous.lastEventLabel ?? undefined, updatedAt: next.updatedAt ?? previous.updatedAt ?? new Date().toISOString() }; } @@ -362,7 +362,7 @@ function traceSnapshotSignalKey(snapshot: TraceSnapshot): string { snapshot.durationMs ?? snapshot.timing?.durationMs ?? "", snapshot.hasMore === true ? "more" : "caught-up", snapshot.fullTraceLoaded === true ? "loaded" : "partial", - snapshot.lastEventLabel ?? events.at(-1)?.label ?? events.at(-1)?.type ?? "", + snapshot.lastEventLabel ?? "", traceSnapshotErrorKey(snapshot.error), snapshot.projectionHealth ?? snapshot.projection?.projectionHealth ?? "", snapshot.projection?.blocker?.code ?? snapshot.blocker?.code ?? ""