diff --git a/apps/sim/lib/copilot/request/go/stream.ts b/apps/sim/lib/copilot/request/go/stream.ts index d179653086..c92d135aff 100644 --- a/apps/sim/lib/copilot/request/go/stream.ts +++ b/apps/sim/lib/copilot/request/go/stream.ts @@ -571,14 +571,14 @@ function stampSseReadLoopSpan( const nowWall = Date.now() const startWall = nowWall - (nowPerf - startPerfMs) - const terminalEventSeen = counters.eventsByType.complete > 0 + const terminalEventSeen = counters.eventsByType.complete > 0 || counters.eventsByType.error > 0 // `terminal_event_missing` is the single-attribute dashboard signal // for the "disappeared response" bug class: the caller considered // this leg to be the final one (`context.streamComplete === true`) - // but no `complete` event arrived on the wire. Tool-pause legs have - // expectedTerminal=false and never trip this, so dashboards can - // filter on `{ .copilot.sse.terminal_event_missing = true }` without - // false positives. + // but no terminal `complete` or `error` event arrived on the wire. + // Tool-pause legs have expectedTerminal=false and never trip this, so + // dashboards can filter on `{ .copilot.sse.terminal_event_missing = true }` + // without false positives. const terminalEventMissing = opts.expectedTerminal && !terminalEventSeen const tracer = getCopilotTracer()