From 77fd944c57d2bbe3e46422b7d36e5139e511e803 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sat, 19 Sep 2026 22:48:55 -0700 Subject: [PATCH] fix(tts): drop the empty mkstemp placeholder when the provider wrote elsewhere With the reported artifact now played, the requested .mp3 placeholder stays behind as a zero-byte file whenever a command provider rewrote the suffix or voice_compatible converted to .ogg; unlink it right after synthesis so nothing leaks into TMPDIR. Same cleanup as #115078 (@Finn763). Co-authored-by: finn763 <165816600+finn763@users.noreply.github.com> --- tools/tts_tool_speaker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/tts_tool_speaker.py b/tools/tts_tool_speaker.py index e8ccd41bcd..4b3bf77d0b 100644 --- a/tools/tts_tool_speaker.py +++ b/tools/tts_tool_speaker.py @@ -131,7 +131,10 @@ class _SyncSentencePipeline: fd, tmp_path = tempfile.mkstemp(suffix=".mp3") os.close(fd) raw = _origin().text_to_speech_tool(text=cleaned, output_path=tmp_path) - return _first_written_artifact(raw, tmp_path) + written = _first_written_artifact(raw, tmp_path) + if os.path.abspath(written) != os.path.abspath(tmp_path): + _unlink_quietly(tmp_path) # provider wrote elsewhere: the placeholder is empty + return written except Exception as exc: logger.warning("Sync per-sentence TTS synthesis failed: %s", exc) _unlink_quietly(tmp_path)