



























@@ -22,7 +22,7 @@ describe("diagnostic stability recorder", () => {
2222resetDiagnosticEventsForTest();
2323});
242425-it("records a bounded payload-free projection of diagnostic events", () => {
25+it("records a bounded payload-free projection of diagnostic events", async () => {
2626startDiagnosticStabilityRecorder();
27272828emitDiagnosticEvent({
@@ -41,13 +41,29 @@ describe("diagnostic stability recorder", () => {
4141count: 3,
4242message: "message that should not be stored",
4343});
44+emitDiagnosticEvent({
45+type: "talk.event",
46+sessionId: "talk-session-secret",
47+turnId: "talk-turn-secret",
48+captureId: "talk-capture-secret",
49+talkEventType: "latency.metrics",
50+mode: "realtime",
51+transport: "gateway-relay",
52+brain: "agent-consult",
53+provider: "openai",
54+final: true,
55+durationMs: 12,
56+byteLength: 345,
57+});
58+await new Promise<void>((resolve) => setImmediate(resolve));
44594560const snapshot = getDiagnosticStabilitySnapshot({ limit: 10 });
466147-expect(snapshot.count).toBe(2);
62+expect(snapshot.count).toBe(3);
4863expect(snapshot.summary.byType).toMatchObject({
4964"webhook.error": 1,
5065"tool.loop": 1,
66+"talk.event": 1,
5167});
5268expect(snapshot.events[0]).toMatchObject({
5369type: "webhook.error",
@@ -66,6 +82,20 @@ describe("diagnostic stability recorder", () => {
6682expect(snapshot.events[1]).not.toHaveProperty("message");
6783expect(snapshot.events[1]).not.toHaveProperty("sessionId");
6884expect(snapshot.events[1]).not.toHaveProperty("sessionKey");
85+expect(snapshot.events[2]).toMatchObject({
86+type: "talk.event",
87+talkEventType: "latency.metrics",
88+mode: "realtime",
89+transport: "gateway-relay",
90+brain: "agent-consult",
91+provider: "openai",
92+final: true,
93+durationMs: 12,
94+bytes: 345,
95+});
96+expect(snapshot.events[2]).not.toHaveProperty("sessionId");
97+expect(snapshot.events[2]).not.toHaveProperty("turnId");
98+expect(snapshot.events[2]).not.toHaveProperty("captureId");
6999});
7010071101it("keeps stable reason codes but drops free-form reason text", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。