Skip to content

[Partner Nodes] fix(GPT Image): handle mismatched image sizes returned when size="auto"#14414

Merged
bigcat88 merged 2 commits into
masterfrom
fix/api-nodes/gptimage2-resize-batch
Jun 11, 2026
Merged

[Partner Nodes] fix(GPT Image): handle mismatched image sizes returned when size="auto"#14414
bigcat88 merged 2 commits into
masterfrom
fix/api-nodes/gptimage2-resize-batch

Conversation

@bigcat88

@bigcat88 bigcat88 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

GPT Image with size="auto" can return images whose sizes differ by a few pixels within one response, which crashed the batch return at torch.stack; resize them to the first image's dimensions before stacking

API Node PR Checklist

Scope

  • Is API Node Change

Pricing & Billing

  • Need pricing update
  • No pricing update

If Need pricing update:

  • Metronome rate cards updated
  • Auto‑billing tests updated and passing

QA

  • QA done
  • QA not required

Comms

  • Informed Kosinkadink

…d when size="auto"

Signed-off-by: bigcat88 <bigcat88@icloud.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR enhances the validate_and_cast_response function in comfy_api_nodes/nodes_openai.py to handle OpenAI image responses where returned images may have slightly different pixel dimensions. The change adds a common_upscale import, updates the function's docstring to document the output as a batched tensor with shape (N, H, W, C), and introduces logic that compares each returned image tensor's height and width against the first image's dimensions, upscaling mismatched images before batch stacking.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: handling mismatched image sizes in GPT Image responses when using size="auto" mode.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
Description check ✅ Passed The pull request description clearly explains the issue (GPT Image with size='auto' returning images with mismatched pixel dimensions) and the solution (resizing images to the first image's dimensions before stacking).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@bigcat88 bigcat88 merged commit ef470b6 into master Jun 11, 2026
17 of 18 checks passed
@bigcat88 bigcat88 deleted the fix/api-nodes/gptimage2-resize-batch branch June 11, 2026 08:28
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