diff --git a/src/cli/src/commands/trace.ts b/src/cli/src/commands/trace.ts index 9c25042..a3f2a41 100644 --- a/src/cli/src/commands/trace.ts +++ b/src/cli/src/commands/trace.ts @@ -144,9 +144,14 @@ export function createTraceCommand(deps?: Partial): Command { if (degraded !== null) degradedCount++; if (err !== null) errorCount++; - const ms = num(e.payload['durationMs']) ?? num(e.payload['totalDurationMs']); - const label = str(e.payload['stage']) ?? e.eventKind; - if (ms !== null && (slowest === null || ms > slowest.ms)) slowest = { name: label, ms }; + // Only real steps compete for "slowest" — tool_call_trace and + // pipeline_execution are aggregates OF those steps, so including them + // would always name the total and tell you nothing. + const ms = num(e.payload['durationMs']); + const label = str(e.payload['stage']); + if (ms !== null && label !== null && (slowest === null || ms > slowest.ms)) { + slowest = { name: label, ms }; + } const marks = [ degraded !== null ? `⚠ ${degraded}` : null,