


























@@ -31,7 +31,6 @@ describe("OpenClawApp Talk controls", () => {
3131const app = Object.create(OpenClawApp.prototype) as {
3232client: unknown;
3333connected: boolean;
34-lastError: string | null;
3534realtimeTalkActive: boolean;
3635realtimeTalkDetail: string | null;
3736realtimeTalkConversation: Array<{ id: string; role: string; text: string }>;
@@ -44,7 +43,6 @@ describe("OpenClawApp Talk controls", () => {
4443Object.defineProperties(app, {
4544client: { value: { request: vi.fn() }, writable: true },
4645connected: { value: true, writable: true },
47-lastError: { value: null, writable: true },
4846realtimeTalkActive: { value: true, writable: true },
4947realtimeTalkConversation: { value: [], writable: true },
5048realtimeTalkDetail: { value: null, writable: true },
@@ -66,6 +64,41 @@ describe("OpenClawApp Talk controls", () => {
6664expect(session?.stop).toBe(stopMock);
6765});
686667+it("preserves unrelated errors when retrying Talk", async () => {
68+const { OpenClawApp } = await import("./app.ts");
69+const app = Object.create(OpenClawApp.prototype) as {
70+chatError: string | null;
71+client: unknown;
72+connected: boolean;
73+lastError: string | null;
74+realtimeTalkActive: boolean;
75+realtimeTalkDetail: string | null;
76+realtimeTalkConversation: Array<{ id: string; role: string; text: string }>;
77+realtimeTalkStatus: string;
78+realtimeTalkSession: { stop(): void } | null;
79+realtimeTalkTranscript: string | null;
80+sessionKey: string;
81+};
82+Object.defineProperties(app, {
83+chatError: { value: "current chat failure", writable: true },
84+client: { value: { request: vi.fn() }, writable: true },
85+connected: { value: true, writable: true },
86+lastError: { value: "current gateway failure", writable: true },
87+realtimeTalkActive: { value: true, writable: true },
88+realtimeTalkConversation: { value: [], writable: true },
89+realtimeTalkDetail: { value: null, writable: true },
90+realtimeTalkSession: { value: { stop: vi.fn() }, writable: true },
91+realtimeTalkStatus: { value: "error", writable: true },
92+realtimeTalkTranscript: { value: null, writable: true },
93+sessionKey: { value: "main", writable: true },
94+});
95+96+await OpenClawApp.prototype.toggleRealtimeTalk.call(app as never);
97+98+expect(app.lastError).toBe("current gateway failure");
99+expect(app.chatError).toBe("current chat failure");
100+});
101+69102it("accumulates Talk transcripts as ordered conversation turns", async () => {
70103const { OpenClawApp } = await import("./app.ts");
71104const app = Object.create(OpenClawApp.prototype) as {
@@ -116,7 +149,7 @@ describe("OpenClawApp Talk controls", () => {
116149]);
117150});
118151119-it("routes Talk startup failures through the chat error surface", async () => {
152+it("keeps Talk startup failures on the dedicated Talk error surface", async () => {
120153startMock.mockRejectedValueOnce(new Error("voice provider missing"));
121154const { OpenClawApp } = await import("./app.ts");
122155const app = Object.create(OpenClawApp.prototype) as {
@@ -148,8 +181,10 @@ describe("OpenClawApp Talk controls", () => {
148181149182await OpenClawApp.prototype.toggleRealtimeTalk.call(app as never);
150183151-expect(app.lastError).toBe("voice provider missing");
152-expect(app.chatError).toBe("voice provider missing");
184+expect(app.realtimeTalkStatus).toBe("error");
185+expect(app.realtimeTalkDetail).toBe("voice provider missing");
186+expect(app.lastError).toBe("previous chat failure");
187+expect(app.chatError).toBe("previous chat failure");
153188expect(stopMock).toHaveBeenCalledOnce();
154189});
155190此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。