Skip to content

fix(venice): check codec dimensions before image enlargement - #8979

Merged
lidge-jun merged 3 commits into
lidge-jun:devfrom
luvs01:codex/venice-upscale-metadata
Nov 21, 2026
Merged

lidge-jun merged 3 commits into
lidge-jun:devfrom
luvs01:codex/venice-upscale-metadata

Conversation

@luvs01

@luvs01 luvs01 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Apply the existing 16-million-pixel source limit to the native image dimensions before enlarging an inline image for Venice. The enlargement step keeps the attachment it received if the dimensions are invalid or exceed the limit.
  • Clarify in the English and Spanish provider guides that the earlier budget step may already have re-encoded the attachment. The regression test uses a valid one-pixel image and substitutes codec metadata.
  • Maintainer security review is requested for the image-processing change.

Verification

  • bun test tests/adapters/openai/openai-chat-image-normalization.test.ts passed all 22 tests. The new regression failed on the base commit and passed with the fix. The same file covers normal enlargement, cancellation and concurrent image processing.
  • bun run typecheck passed for 2,681 files. bun run structure:check, bun run privacy:scan and git diff --check passed.
  • In docs-site, bun install --frozen-lockfile and bun run build passed. The build checked 126,212 internal links across 820 pages.
  • The broader Windows import-graph run, bun scripts/test.ts --changed=d61cca122d00899b0a917162875c7c2c659f4952, reached its 900-second limit with ACL and timeout errors. The full repository suite was not run locally.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • Bug Fixes
    • Image enlargement for Venice requests now checks that image dimensions are valid and within the supported pixel limit before resizing.
    • If enlargement is skipped or fails, the image produced by size adjustment is retained. Venice may still reject images below its minimum size.
  • Documentation
    • Updated provider guidance to explain when small images are enlarged and what happens when enlargement cannot be completed.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Venice image enlargement path now checks decoded dimensions against validity and pixel-count limits before resizing. Tests cover invalid dimensions and verify that resizing is skipped. Documentation describes the retained image URL when enlargement is skipped or fails.

Changes: Venice image enlargement

Layer / File(s) Summary
Validate dimensions and preserve fallback behavior
src/adapters/openai-chat-images.ts, tests/adapters/openai/openai-chat-image-normalization.test.ts, structure/transports/streaming-health.md, docs-site/src/content/docs/guides/providers.md
bunImageUpscale now rejects dimensions that are not positive safe integers or whose pixel product exceeds MAX_INPUT_PIXELS. Tests verify that invalid dimensions do not trigger resizing and that the image URL remains attached. The documentation describes the dimension limit and says skipped or failed enlargement retains the URL from budget normalization.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to cdb0b

This change stops Venice image enlargement from running on images whose dimensions are invalid or above 16 million pixels, and keeps the existing attachment instead. It is narrowly scoped, tested, and documented, with little merge risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(venice): check codec dimensions before image enlargement" matches the main change. The raw summary shows bunImageUpscale now reads source image metadata and rejects non-safe-integer, no…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(venice): check codec dimensions before image enlargement" matches the main change. The raw summary shows bunImageUpscale now reads source image metadata and rejects non-safe-integer, nonpositive, or over-limit dimensions before resizing. The Venice enlargement docs and the new regression tests for unsafe dimensions match the same change. The title is specific, concise, and free of noise.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a105d27 and cdb0bff.

Files selected for processing: 5

  • docs-site/src/content/docs/es/guides/providers.md
  • docs-site/src/content/docs/guides/providers.md
  • src/adapters/openai-chat-images.ts
  • structure/transports/streaming-health.md
  • tests/adapters/openai/openai-chat-image-normalization.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Nov 20, 2026

luvs01 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator Author

The failed fresh Codex home without config.toml (#5422) case was reproduced on this PR's exact head, c4a610a9. On Windows with Bun 1.4.4, the default runner stopped it at 5.034 seconds. The same unmodified case completed all four assertions in 5.073 seconds when given a longer diagnostic runner limit.

The isolated test-harness fix is #8984. I applied its single test-file change locally on top of this head. With the default runner, the previously failing case passed all four assertions in 5.217 seconds. The child's own 30-second deadline is preserved. This PR's published feature branch and its original CI result remain unchanged.

On the newer dev at f3a47c67, which includes #9013, I tested the local combination with this PR and #8984 (tree b38239d58c6dccb77d7df2b969dddfd32dcc51ba). Six ordinary cases passed on Windows with Bun 1.4.4 (34 assertions): Venice PNG enlargement and byte preservation, an unchanged image for a provider without a minimum size, Grok image editing and relay inputs, and the fresh Codex home settings case. In a separate Ubuntu run on a branch based on this dev, the unmodified settings test also passed in 1.33 s. The observed timings depend on the runner. The original red check still belongs to this PR's published head.

@luvs01
luvs01 marked this pull request as ready for review November 21, 2026 06:54
@lidge-jun

Copy link
Copy Markdown
Owner

Maintainer integration into dev (MAINTAINERS.md maintainer-integration exception; lane fb2101-queue-b).

  • Exact head: cdb0bffd6bda661778be8493813c47c09f50b337
  • Checks on this head: all completed checks pass (ci with gates and test changed, CodeRabbit, enforce-target, hygiene); none pending or failing.
  • Review: terra review APPROVE: the codec-reported dimensions are checked against the existing 16-million-pixel limit before Venice enlargement resizes, inside the shared decode gate, and a refusal keeps the URL from budget normalization. The regression fails on origin/dev (resize called five times) and passes here; the image normalization file passes 22/22. The earlier red test changed was the [Bug]: Fresh Codex install without config.toml blocks authless provider onboarding #5422 settings deadline flake fixed by test(settings): align isolated route tests with their child deadline #8984.
  • Merged with current dev locally before merging: typecheck, structure:check, file-size ratchet, docs parity, test-layout, core-lab boundary and the focused suite pass.
  • Review threads: 0 unresolved.
  • Scope: image-processing hardening in src/adapters/openai-chat-images.ts plus docs; no auth, workflow, release, dependency or provider-preset surface.

This is maintainer integration, not an independent approval.

@lidge-jun
lidge-jun merged commit e567fd1 into lidge-jun:dev Nov 21, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants