From 935eef50efedb1c872f5ede7579dc17dc837f796 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sat, 19 Sep 2026 01:26:03 -0700 Subject: [PATCH] fix: pin consent_attestation on the Desktop client-direct TTS path resolve_client_voice_config() now asserts tts.extra_body is {} when no tts.openai extras are set and {consent_attestation: ...} when it is, and the Desktop synthesizeSpeechClientDirect test asserts the spread field reaches the openai speech request body. Removing either wiring (extra_body kwarg in _resolve_tts_client_config, or the ...tts.extra_body spread in voice-client-direct.ts) now turns the respective test red. --- apps/desktop/src/lib/voice-client-direct.test.ts | 7 ++++++- tests/tools/test_voice_client_config.py | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/lib/voice-client-direct.test.ts b/apps/desktop/src/lib/voice-client-direct.test.ts index 6109ef0442..fe49964415 100644 --- a/apps/desktop/src/lib/voice-client-direct.test.ts +++ b/apps/desktop/src/lib/voice-client-direct.test.ts @@ -230,7 +230,10 @@ describe('synthesizeSpeechClientDirect', () => { const fetchMock = vi.fn(async () => new Response(bytes, { status: 200 })) vi.stubGlobal('fetch', fetchMock) - const audio = await synthesizeSpeechClientDirect(openaiTts, 'Hello there.') + const audio = await synthesizeSpeechClientDirect( + { ...openaiTts, extra_body: { consent_attestation: 'I own this voice' } }, + 'Hello there.' + ) expect(new Uint8Array(audio)).toEqual(new Uint8Array([1, 2, 3])) @@ -242,6 +245,8 @@ describe('synthesizeSpeechClientDirect', () => { expect(body.voice).toBe('nova') expect(body.input).toBe('Hello there.') expect(body.speed).toBeUndefined() + // Server-resolved tts.openai extras (consent_attestation for cloned voices) reach the wire. + expect(body.consent_attestation).toBe('I own this voice') }) it('speaks the elevenlabs tts shape with the voice in the path', async () => { diff --git a/tests/tools/test_voice_client_config.py b/tests/tools/test_voice_client_config.py index ac9a0d4674..fd56cf99e0 100644 --- a/tests/tools/test_voice_client_config.py +++ b/tests/tools/test_voice_client_config.py @@ -139,6 +139,12 @@ def test_edge_tts_relays_openai_goes_direct(voice_home, monkeypatch): assert tts["api_key"] == "sk_direct789" assert tts["voice"] == "nova" assert tts["model"] + # Unset tts.openai extras stay off the wire; set ones ride the direct config verbatim. + assert tts["extra_body"] == {} + + voice_home({"tts": {"provider": "openai", + "openai": {"voice": "nova", "consent_attestation": "I own this voice"}}}) + assert _resolve()["tts"]["extra_body"] == {"consent_attestation": "I own this voice"} def test_elevenlabs_tts_direct_carries_voice_and_model(voice_home, monkeypatch):