[AI-assisted] fix(agents): mark failed TTS tool synthesis as an error (#67980)

Merged via squash.

Prepared head SHA: fa12d93c79
Co-authored-by: lawrence3699 <247479654+lawrence3699@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
chaoliang yan
2026-04-18 10:30:03 +10:00
committed by GitHub
parent 0266cf4d10
commit 4749993bb5
3 changed files with 15 additions and 9 deletions

View File

@@ -43,6 +43,7 @@ Docs: https://docs.openclaw.ai
- Gateway/assistant media: require `operator.read` scope for assistant-media file and metadata requests on identity-bearing HTTP auth paths so callers without a read scope can no longer access assistant media. (#68175) Thanks @eleqtrizit.
- Exec approvals/display: escape raw control characters (including newline and carriage return) in the shared and macOS approval-prompt command sanitizers, so trailing command payloads no longer render on hidden extra lines in the approval UI. (#68198)
- OpenAI Codex/OAuth + Pi: keep imported Codex CLI OAuth bootstrap, Pi auth export, and runtime overlay handling aligned so Codex sessions survive refresh and health checks without leaking transient CLI state into saved auth files. Thanks @vincentkoc.
- Agents/TTS: report failed speech synthesis as a real tool error so unconfigured providers no longer feed successful TTS failure output back into agent loops. (#67980) Thanks @lawrence3699.
## 2026.4.15

View File

@@ -41,4 +41,17 @@ describe("createTtsTool", () => {
});
expect(JSON.stringify(result.content)).not.toContain("MEDIA:");
});
it("throws when synthesis fails so the agent records a tool error", async () => {
textToSpeechSpy.mockResolvedValue({
success: false,
error: "TTS conversion failed: openai: not configured",
});
const tool = createTtsTool();
await expect(tool.execute("call-1", { text: "hello" })).rejects.toThrow(
"TTS conversion failed: openai: not configured",
);
});
});

View File

@@ -49,15 +49,7 @@ export function createTtsTool(opts?: {
};
}
return {
content: [
{
type: "text",
text: result.error ?? "TTS conversion failed",
},
],
details: { error: result.error },
};
throw new Error(result.error ?? "TTS conversion failed");
},
};
}