improvement(mothership): treat error as terminal event (#4290)

This commit is contained in:
Vikhyath Mondreti
2026-04-24 14:51:26 -07:00
committed by GitHub
parent f330fe22a2
commit af4be770a1

View File

@@ -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()