fix(hyperframes-media): surface the real reason a TTS line failed [P2]#1999
Draft
miguel-heygen wants to merge 1 commit into
Draft
fix(hyperframes-media): surface the real reason a TTS line failed [P2]#1999miguel-heygen wants to merge 1 commit into
miguel-heygen wants to merge 1 commit into
Conversation
synthesizeHeygen() swallowed every failure into a bare { ok:false }: a thrown
HTTP error (e.g. 402 plan_upgrade_required from heygenJSON) was caught and
discarded, a missing audio_url / failed audio fetch / failed transcode all
returned nothing. audio.mjs then logged 'TTS failed — omitted' for every line
with zero detail, so the actual cause took a hand-rolled repro to find.
Each failure path now returns an { error } string (the caught message, the HTTP
status, or the specific stage that failed), and audio.mjs appends it to the
anomaly. The subprocess providers (elevenlabs/kokoro) get the same treatment via
a shared synthResult() helper. synthesizeHeygen takes an injectable deps arg so
the failure paths are unit-tested (thrown 402, non-ok fetch, missing audio_url).
9fef490 to
7e4e2dd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
synthesizeHeygen()swallowed every failure into a bare{ ok: false }:heygenJSON) was caught and discarded by a barecatch {},audio_url, a failed audio fetch, and a failed transcode each returned{ ok:false }with no reason.audio.mjsthen loggedline N: TTS failed — omittedfor every line with zero diagnostic detail, so the actual cause (a plan/billing error, an auth problem, etc.) took a hand-rolled repro script to find. Reported from real usage: "surface e.message in the anomaly text."Fix
Every failure path now returns an
{ error }string stating why — the caught exception message, the HTTP status, the missingaudio_url, or the failed transcode stage — andaudio.mjsappends it to the anomaly (TTS failed — omitted (<error>)). The subprocess providers (elevenlabs / kokoro) get the same treatment via a sharedsynthResult()helper (naming the non-zero exit or the missing wav).synthesizeHeygentakes an optional injectabledepsarg (defaults to the real network/ffmpeg impls) purely so the failure paths are unit-testable.Verification
tts.test.mjs(node:test) — 4 new tests, 9 total pass: a thrown 402 surfaces inerror(contains 402 + plan_upgrade_required); a non-ok audio fetch surfaces its HTTP status; a missingaudio_urlis named;synthResultnames a non-zero subprocess exit. No behavior change on the success path.