fix(diagnostics): complete early model stream closes · openclaw/openclaw@e401570
vincentkoc
·
2026-04-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -72,6 +72,9 @@ Docs: https://docs.openclaw.ai
|
72 | 72 | |
73 | 73 | ### Fixes |
74 | 74 | |
| 75 | +- Diagnostics/OTEL: treat normal early model stream cleanup as a completed |
| 76 | + model call instead of exporting a misleading `StreamAbandoned` error span. |
| 77 | + Thanks @vincentkoc. |
75 | 78 | - ACP: wait for the configured runtime backend to become healthy before startup |
76 | 79 | identity reconciliation, avoiding transient acpx warnings during Gateway boot. |
77 | 80 | Fixes #40566. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -253,7 +253,7 @@ describe("wrapStreamFnWithDiagnosticModelCallEvents", () => {
|
253 | 253 | expect(JSON.stringify([started.mock.calls, ended.mock.calls])).not.toContain(secretChunk); |
254 | 254 | }); |
255 | 255 | |
256 | | -it("emits error events when stream consumption stops early", async () => { |
| 256 | +it("emits completed events when stream consumption stops early", async () => { |
257 | 257 | async function* stream() { |
258 | 258 | yield { type: "text", text: "first" }; |
259 | 259 | yield { type: "text", text: "second" }; |
@@ -279,12 +279,15 @@ describe("wrapStreamFnWithDiagnosticModelCallEvents", () => {
|
279 | 279 | } |
280 | 280 | }); |
281 | 281 | |
282 | | -expect(events.map((event) => event.type)).toEqual(["model.call.started", "model.call.error"]); |
| 282 | +expect(events.map((event) => event.type)).toEqual([ |
| 283 | +"model.call.started", |
| 284 | +"model.call.completed", |
| 285 | +]); |
283 | 286 | expect(events[1]).toMatchObject({ |
284 | | -type: "model.call.error", |
| 287 | +type: "model.call.completed", |
285 | 288 | callId: "call-abandoned", |
286 | | -errorCategory: "StreamAbandoned", |
287 | 289 | durationMs: expect.any(Number), |
288 | 290 | }); |
| 291 | +expect(events[1]).not.toHaveProperty("errorCategory"); |
289 | 292 | }); |
290 | 293 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -252,7 +252,7 @@ async function* observeModelCallIterator<T>(
|
252 | 252 | } finally { |
253 | 253 | if (!terminalEmitted) { |
254 | 254 | await safeReturnIterator(iterator); |
255 | | -emitModelCallError(eventBase, startedAt, { errorCategory: "StreamAbandoned" }); |
| 255 | +emitModelCallCompleted(eventBase, startedAt); |
256 | 256 | } |
257 | 257 | } |
258 | 258 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。