Skip to content

Fail closed when TTS writes empty audio or list-valued strings - #99

Merged
cursor[bot] merged 2 commits into
mainfrom
cursor/tts-empty-audio-2ccd
Sep 7, 2026
Merged

cursor[bot] merged 2 commits into
mainfrom
cursor/tts-empty-audio-2ccd

Conversation

@jmjava

@jmjava jmjava commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Problem

TTSGenerator printed Wrote after synthesize_speech even when the provider wrote a 0-byte mp3. Downstream timestamps then ran against empty audio. Chat already fails closed on empty text; TTS did not.

tts.model / tts.voice / tts.instructions as a YAML list also loaded and were passed to the API (instructions: as a bullet list is a common typo).

Change

  • Present tts.model / tts.voice must be non-empty YAML strings.
  • Present tts.instructions must be a YAML string (empty string allowed).
  • After synthesize, missing or 0-byte output is TTSError and the empty file is removed.
  • xAI TTS raises AIError on an empty HTTP body (does not write the file).

Milestone: milestones/tts-empty-audio.md. Also marks av-sync-scene-spec as shipped (#98).

Out of scope

  • Wizard PUT of empty narration still writes the file (lint/TTS catch later).
  • wizard.system_prompt / llm_model type gating is separate.

Gates

  • ruff check src/ tests/
  • pytest tests/
  • docgen benchmark (no clock change; no --update-baseline)
Open in Web Open in Cursor 

cursoragent and others added 2 commits September 7, 2026 20:26
A 0-byte mp3 after synthesize_speech was treated as success. Reject
list-valued tts.model / voice / instructions at config load, raise on
empty provider output (unlink the file), and reject an empty xAI TTS body.

Co-authored-by: jmjava <jmjava@gmail.com>
Local ruff, pytest, and docgen benchmark are green on this branch.

Co-authored-by: jmjava <jmjava@gmail.com>
@jmjava
jmjava marked this pull request as ready for review September 7, 2026 20:27
@cursor
cursor Bot merged commit 3d25934 into main Sep 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants