Skip to content

fix: preserve custom image dimensions in the SDK - #288

Open
ch-z-hc wants to merge 1 commit into
MiniMax-AI:mainfrom
ch-z-hc:fix/sdk-image-sizing-precedence
Open

ch-z-hc wants to merge 1 commit into
MiniMax-AI:mainfrom
ch-z-hc:fix/sdk-image-sizing-precedence

Conversation

@ch-z-hc

@ch-z-hc ch-z-hc commented Oct 14, 2026 •

Copy link
Copy Markdown

Bug

sdk.image.generate({ prompt: 'A landscape', width: 1920, height: 1080, aspect_ratio: '1:1' }) still sends aspect_ratio: '1:1'. The SDK tries to clear it in the defaults, but merging the caller's parameters restores it. The API gives aspect_ratio priority, so the requested custom dimensions are ignored.

Fix

Apply the existing sizing decision after spreading the request parameters, matching the CLI's precedence. Keep ratio-only requests, dimension validation, other fields and the caller's object unchanged. No new dependency or API surface.

The HTTP-fixture regression inspects the actual serialized request: original code fails the conflicting-ratio case; patched code passes it plus dimensions-only and ratio-only controls.

Validation

  • Image SDK tests: 14 passed on Windows. Windows and Linux typecheck, lint and CLI/SDK/declaration build pass; lint retains one existing speech-test warning.
  • Two independent automated blind reviews: no findings.
  • Full Windows run with a validation-only fetch preload: 590 passed / 12 failed; unchanged main in the same setup: 587 passed / the same 12 failed.
  • Full Linux repeat: 599 passed / 3 failed; unchanged main: 596 passed / the same 3 failed (two unreachable-region tests time out, plus the FileSDK upload base-URL assertion). An earlier patched run had 600 passed / 2 failed because that upload test passed. These unrelated failures were not diagnosed or fixed here; this is not a claim that the full suite is green.

The preload rejects non-loopback fetches by default; test-owned mocks can override it. Linux uses temporary configuration and a process-local no-op URL opener. No repository assertions, timeouts or skip conditions were relaxed. No live model calls.

Implemented and tested with Codex assistance. Blind reviews were automated, not human approval.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

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.

1 participant