fix(hooks): say why the combined hook+captions pass failed

3 of 40 prod clips fell back to the two-pass path with no visible reason:
the job log truncates the CalledProcessError (argv first). Log the exit
code and the last non-progress stderr lines instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
victormanuel.caverogracia 2026-09-25 21:13:42 +02:00
parent 1679f8d7dc
commit a404a11673

View file

@ -1218,7 +1218,14 @@ def auto_hook_clip(clip_path, clip, captions=None):
print(f" 🪝 Hook + 💬 captions burned in one pass ({style}, {seconds:g}s): {text}") print(f" 🪝 Hook + 💬 captions burned in one pass ({style}, {seconds:g}s): {text}")
return out_path, {**config, "_captioned": captioned} return out_path, {**config, "_captioned": captioned}
except Exception as e: except Exception as e:
print(f" ⚠️ Combined hook+captions pass failed ({type(e).__name__}: {e}) — " # The job log truncates long lines, so name the exit code and the
# last non-progress stderr lines first, not the whole argv.
detail = type(e).__name__
if isinstance(e, subprocess.CalledProcessError):
tail = [l for l in (e.stderr or b"").decode(errors="replace").splitlines()
if l.strip() and not l.lstrip().startswith("frame=")][-3:]
detail = f"exit {e.returncode}: {' | '.join(tail)[-300:]}"
print(f" ⚠️ Combined hook+captions pass failed ({detail}) — "
f"burning them one at a time.") f"burning them one at a time.")
if os.path.exists(captioned): if os.path.exists(captioned):
os.remove(captioned) # never leave a half-written subtitled_ behind os.remove(captioned) # never leave a half-written subtitled_ behind