[PR #5747] [MERGED] fix(image-gen): default OpenRouter image requests to image-only modalities #6915

Closed
opened 2026-10-23 04:14:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5747
Author: @Nelathan
Created: 9/2/2026
Status: ✅ Merged
Merged: 9/12/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/openrouter-image-modalities


📝 Commits (4)

  • ec48960 fix(image-gen): default OpenRouter image requests to image-only modalities
  • 44bfdde test(image-gen): assert OpenRouter image requests pick the right modalities
  • cc179ca Merge staging and refresh OpenRouter modality regression coverage
  • 5dd60c5 Merge remote-tracking branch 'origin/staging' into fix/openrouter-image-modalities

📊 Changes

3 files changed (+77 additions, -10 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/services/image/image-generation.ts (+10 -10)
📝 scripts/regressions/provider-compat.regression.ts (+66 -0)

📄 Description

Linked issue

Closes #6079.

Why this change

OpenRouter image-only models outside the old vendor list, including Microsoft MAI and Grok Imagine, receive a request for both image and text and fail with unsupported-output-modality errors. Image generation should request only outputs that the selected model supports.

What changed

  • Preserve @Nelathan's fix: default chat-completions image requests to image-only output, opting into text for Gemini image, GPT-5 image, and OpenRouter automatic-routing families.
  • Merge current staging into the existing contributor branch, preserving the dedicated Images API routing already delivered for #5750 and the newer image aspect-ratio handling.
  • Update the outgoing-request regression for current routing, model families, default selection, and an unknown image-only model; add the missing changelog entry. No new dependencies or API calls.

Validation

Automated maintainer verification (Codex-assisted, 2026-09-12):

  • pnpm install and pnpm check passed.
  • The new provider regression fails against staging's old helper on microsoft/mai-image-2.5, then passes with this patch.
  • node scripts/run-regressions.mjs --filter scripts/regressions/provider-compat.regression.ts passed.
  • node scripts/run-regressions.mjs --filter scripts/regressions/openrouter-image-endpoint.regression.ts passed, including dedicated routing, explicit endpoint fallback, and non-retryable auth/rate-limit/server failures.
  • node scripts/run-regressions.mjs --filter scripts/regressions/open-issues.regression.ts passed.
  • All 54 image models in the public OpenRouter catalog checked today match the selected text/image families. This is metadata verification, not a paid generation.
  • Node regressions used isolated temporary data and file-storage directories.
  • The previously failing roleplay exposes reasoning and explains unavailable saved summaries test passed locally in mobile WebKit on the refreshed branch (1 passed).

The checkboxes below remain a human-maintainer checklist, as required by AGENTS.md.

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

No paid-provider generation or manual browser verification was repeated in this maintainer pass. The contributor reported successful live Flux, MAI, Grok, and Gemini generations on 2026-09-02 in the original PR description. Those are contributor-reported results. The original Qwen endpoint limitation has since been fixed separately in #5750.

  • Manually generate an image with MAI or Grok through an OpenRouter connection, then verify a Gemini image request still succeeds.
  • Manually build and boot the container; the maintainer pass relies on CI for the production container build.

Docs and release impact

Added an [Unreleased] changelog entry for #6079. No user-facing configuration, documentation, or release-version changes.

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

No UI changes. This PR changes the server's provider request shape only.

Summary by CodeRabbit

  • Bug Fixes

    • Improved OpenRouter image generation compatibility by requesting image-only responses for image-focused models, preventing unsupported-modality errors.
    • Preserved combined image and text responses for supported Gemini, GPT-5 image, and automatic-routing models.
  • Tests

    • Added regression coverage validating response modality settings, model handling, and request routing across supported OpenRouter image-generation models.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/5747 **Author:** [@Nelathan](https://github.com/Nelathan) **Created:** 9/2/2026 **Status:** ✅ Merged **Merged:** 9/12/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/openrouter-image-modalities` --- ### 📝 Commits (4) - [`ec48960`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ec48960caf9bc223723c247503dc49b493d4b16d) fix(image-gen): default OpenRouter image requests to image-only modalities - [`44bfdde`](https://github.com/Pasta-Devs/Marinara-Engine/commit/44bfddedc3609990e3a795b004d9260ee3459d9f) test(image-gen): assert OpenRouter image requests pick the right modalities - [`cc179ca`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cc179cabe2fde2735a79eb9c5bf43fb1acce011c) Merge staging and refresh OpenRouter modality regression coverage - [`5dd60c5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5dd60c5280a35b56a732305d04b2d57f8a30693a) Merge remote-tracking branch 'origin/staging' into fix/openrouter-image-modalities ### 📊 Changes **3 files changed** (+77 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/services/image/image-generation.ts` (+10 -10) 📝 `scripts/regressions/provider-compat.regression.ts` (+66 -0) </details> ### 📄 Description ## Linked issue Closes #6079. ## Why this change OpenRouter image-only models outside the old vendor list, including Microsoft MAI and Grok Imagine, receive a request for both image and text and fail with unsupported-output-modality errors. Image generation should request only outputs that the selected model supports. ## What changed - Preserve @Nelathan's fix: default chat-completions image requests to image-only output, opting into text for Gemini image, GPT-5 image, and OpenRouter automatic-routing families. - Merge current staging into the existing contributor branch, preserving the dedicated Images API routing already delivered for #5750 and the newer image aspect-ratio handling. - Update the outgoing-request regression for current routing, model families, default selection, and an unknown image-only model; add the missing changelog entry. No new dependencies or API calls. ## Validation Automated maintainer verification (Codex-assisted, 2026-09-12): - `pnpm install` and `pnpm check` passed. - The new provider regression fails against staging's old helper on `microsoft/mai-image-2.5`, then passes with this patch. - `node scripts/run-regressions.mjs --filter scripts/regressions/provider-compat.regression.ts` passed. - `node scripts/run-regressions.mjs --filter scripts/regressions/openrouter-image-endpoint.regression.ts` passed, including dedicated routing, explicit endpoint fallback, and non-retryable auth/rate-limit/server failures. - `node scripts/run-regressions.mjs --filter scripts/regressions/open-issues.regression.ts` passed. - All 54 image models in the public OpenRouter catalog checked today match the selected text/image families. This is metadata verification, not a paid generation. - Node regressions used isolated temporary data and file-storage directories. - The previously failing `roleplay exposes reasoning and explains unavailable saved summaries` test passed locally in mobile WebKit on the refreshed branch (1 passed). The checkboxes below remain a human-maintainer checklist, as required by `AGENTS.md`. - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes No paid-provider generation or manual browser verification was repeated in this maintainer pass. The contributor reported successful live Flux, MAI, Grok, and Gemini generations on 2026-09-02 in the original PR description. Those are contributor-reported results. The original Qwen endpoint limitation has since been fixed separately in #5750. - [ ] Manually generate an image with MAI or Grok through an OpenRouter connection, then verify a Gemini image request still succeeds. - [ ] Manually build and boot the container; the maintainer pass relies on CI for the production container build. ## Docs and release impact Added an `[Unreleased]` changelog entry for #6079. No user-facing configuration, documentation, or release-version changes. - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) No UI changes. This PR changes the server's provider request shape only. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved OpenRouter image generation compatibility by requesting image-only responses for image-focused models, preventing unsupported-modality errors. * Preserved combined image and text responses for supported Gemini, GPT-5 image, and automatic-routing models. * **Tests** * Added regression coverage validating response modality settings, model handling, and request routing across supported OpenRouter image-generation models. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:14:51 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6915
No description provided.