Skip to content

Fail closed when image-generate returns empty bytes - #103

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

cursor[bot] merged 2 commits into
mainfrom
cursor/image-empty-bytes-2ccd

Conversation

@jmjava

@jmjava jmjava commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Problem

generate_images_for_spec wrote whatever the Images API / image_fn returned, including 0-byte files, and reported generated. --force could clobber a committed asset with empty bytes. TTS already fails closed on empty audio (#99).

Change

  • Empty provider bytes raise ImageGenerationError before writing.
  • Empty b64_json / URL download raises in generate_image_bytes.

Milestone: milestones/image-empty-bytes.md. Also marks hint-front-matter-yaml as shipped (#102).

Out of scope

  • image_generation.model / size string typing is separate.

Gates

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

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
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>
@cursor
cursor Bot merged commit 7a09391 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