Skip to content

Commit af4be77

Browse files
improvement(mothership): treat error as terminal event (#4290)
1 parent f330fe2 commit af4be77

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

apps/sim/lib/copilot/request/go/stream.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -571,14 +571,14 @@ function stampSseReadLoopSpan(
571571
const nowWall = Date.now()
572572
const startWall = nowWall - (nowPerf - startPerfMs)
573573

574-
const terminalEventSeen = counters.eventsByType.complete > 0
574+
const terminalEventSeen = counters.eventsByType.complete > 0 || counters.eventsByType.error > 0
575575
// `terminal_event_missing` is the single-attribute dashboard signal
576576
// for the "disappeared response" bug class: the caller considered
577577
// this leg to be the final one (`context.streamComplete === true`)
578-
// but no `complete` event arrived on the wire. Tool-pause legs have
579-
// expectedTerminal=false and never trip this, so dashboards can
580-
// filter on `{ .copilot.sse.terminal_event_missing = true }` without
581-
// false positives.
578+
// but no terminal `complete` or `error` event arrived on the wire.
579+
// Tool-pause legs have expectedTerminal=false and never trip this, so
580+
// dashboards can filter on `{ .copilot.sse.terminal_event_missing = true }`
581+
// without false positives.
582582
const terminalEventMissing = opts.expectedTerminal && !terminalEventSeen
583583

584584
const tracer = getCopilotTracer()

0 commit comments

Comments
 (0)