Skip to content

fix(proxy): harden image generation and edit requests - #3362

Merged
lbjlaq merged 1 commit into
lbjlaq:mainfrom
buluw:codex/images-api-compat
Aug 30, 2026
Merged

fix(proxy): harden image generation and edit requests#3362
lbjlaq merged 1 commit into
lbjlaq:mainfrom
buluw:codex/images-api-compat

Conversation

@buluw

@buluw buluw commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Make OpenAI-compatible image generation and edit requests preserve model, ordering, sizing, and input-boundary semantics.

Closes #3349.

Changes

  • Resolve dynamic image aliases against the selected account for both generation and edit requests.
  • Accept ordered Canvas-style data-URL references on image generations without fetching remote URLs.
  • Preserve repeated image, image[], and image<digits> multipart fields in arrival order.
  • Place an edit mask immediately after the first input image.
  • Preserve model-suffix aspect ratios when no explicit ratio or recognized size is supplied.
  • Enforce image_size, quality, and model-suffix priority consistently.
  • Reject invalid image data and enforce 16 images, 20 MiB per decoded image, and 32 MiB total decoded input.

Validation

  • cargo test --manifest-path src-tauri/Cargo.toml --offline --lib stream_peek_tests
    • 15 passed, 0 failed; six tests directly cover image generation/edit compatibility.
  • cargo test --manifest-path src-tauri/Cargo.toml --offline --lib proxy::mappers::common_utils::tests
    • 13 passed, 0 failed.

Compatibility

  • Text-only image generation remains unchanged.
  • Existing routes and response formats remain unchanged.
  • Invalid or oversized inputs now return HTTP 400 before an upstream request.
  • Strict multipart MIME/empty-file rejection and an upper bound for n are not included.
  • Real multipart and Canvas client integration remain to be verified separately.

@lbjlaq
lbjlaq merged commit 3942fc8 into lbjlaq:main Aug 30, 2026
4 of 7 checks passed
@buluw
buluw deleted the codex/images-api-compat branch August 31, 2026 03:47
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.

[Bug] Make Images Generations and Edits compatible with dynamic models, ordered references, and bounded inputs

2 participants