Fail closed when image-generate returns empty bytes - #103
Merged
Merged
Conversation
A 0-byte PNG was written as generated, including --force over a committed asset. Raise ImageGenerationError before write, matching TTS empty-audio (#99). Co-authored-by: jmjava <jmjava@gmail.com>
jmjava
marked this pull request as ready for review
September 7, 2026 20:42
Local ruff, pytest, and docgen benchmark are green on this branch. Co-authored-by: jmjava <jmjava@gmail.com>
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
generate_images_for_specwrote whatever the Images API /image_fnreturned, including 0-byte files, and reportedgenerated.--forcecould clobber a committed asset with empty bytes. TTS already fails closed on empty audio (#99).Change
ImageGenerationErrorbefore writing.b64_json/ URL download raises ingenerate_image_bytes.Milestone:
milestones/image-empty-bytes.md. Also markshint-front-matter-yamlas shipped (#102).Out of scope
image_generation.model/sizestring typing is separate.Gates
ruff check src/ tests/pytest tests/docgen benchmark(no clock change; no--update-baseline)