[PR #7529] [MERGED] fix(image): make the image response size limit configurable #7777

Closed
opened 2026-10-24 04:07:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7529
Author: @Gunterlie
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @Gunterlie

Base: staging ← Head: fix/7526-image-response-limit


📝 Commits (2)

  • 1bee5d6 fix(image): make the image response size limit configurable
  • 38e037c docs: say the 30 MiB image response limit is the default

📊 Changes

6 files changed (+64 additions, -2 deletions)

View changed files

📝 .env.example (+3 -0)
📝 docs/CONFIGURATION.md (+2 -1)
📝 docs/TROUBLESHOOTING.md (+1 -0)
📝 packages/server/src/config/env-watcher.ts (+1 -0)
📝 packages/server/src/services/image/image-generation.ts (+15 -1)
➕ scripts/regressions/image-response-limit.regression.ts (+42 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7526

Why this change

  • A local ComfyUI that keeps metadata in its output files (workflow plus Base64 reference images) can return a file larger than 30 MiB. Marinara had a fixed 30 MiB cap on image provider responses, so the generation failed with a bare Outbound response exceeded 31457280 bytes. The user had no way to raise the cap and no hint about the cause.

What changed

  • New .env setting IMAGE_GEN_MAX_RESPONSE_BYTES. The default stays 30 MiB. A blank, zero, or malformed value falls back to the default, so a typo cannot disable the cap. It mirrors VIDEO_GEN_MAX_RESPONSE_BYTES and needs a restart.
  • The cap error from image providers now names the setting: Outbound response exceeded N bytes. Raise IMAGE_GEN_MAX_RESPONSE_BYTES in .env and restart Marinara to accept larger images.
  • The setting is listed in .env.example, docs/CONFIGURATION.md, docs/TROUBLESHOOTING.md, and the env-watcher restart list.
  • New regression scripts/regressions/image-response-limit.regression.ts.

Not changed, on purpose:

  • The default limit. 30 MiB stays as the guard for remote providers.
  • RunPod ComfyUI (runpod-comfyui.service.ts) and Venice keep their own fixed 30 MiB caps. They are not in the path of the issue.
  • A malformed value falls back to the default without a log line, the same as the video setting.

Validation

  • 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

Commands run by the agent:

  • node ./scripts/run-regressions.mjs --filter scripts/regressions/image-response-limit.regression.ts: passed.
  • image-generation-timeout and greeting-image-bake regressions: passed.
  • pnpm --filter @marinara-engine/server run lint (tsc): passed.
  • pnpm format:check: passed.
  • Full pnpm check was not run locally. CI runs it.

Local review:

  • Local CodeRabbit: 1 minor finding (doc wording: the limit applies to the provider response, not the image). Fixed.
  • Reviewer subagent: verdict ship, 3 low findings. Fixed: an inaccurate code comment, and the docs now say "local ComfyUI". Also dropped cause from the wrapped error, because route error formatters append cause.message and printed the limit twice. Not done: a warning log for a malformed value (optional, the video setting has none).

Manual verification notes

  • Not verified against a real ComfyUI. Manually verify: set IMAGE_GEN_MAX_RESPONSE_BYTES=104857600, restart, and generate a ComfyUI image whose output file is larger than 30 MiB. The image must arrive.
  • Manually verify: without the setting, the same generation fails and the error text names IMAGE_GEN_MAX_RESPONSE_BYTES.

Docs and release impact

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

Docs changed: docs/CONFIGURATION.md, docs/TROUBLESHOOTING.md. Follow-up for translations: https://github.com/Pasta-Devs/Marinara-Engine/issues/7528

UI evidence (if applicable)

None. Server and docs only.

Summary by CodeRabbit

  • New Features
    • The maximum accepted image-provider response size can be configured with IMAGE_GEN_MAX_RESPONSE_BYTES. The default is 30 MiB; invalid values use the default, and changing the setting requires a server restart.
    • When a response exceeds the configured limit, the error explains how to adjust the setting and restart the server.
  • Documentation
    • Configuration and troubleshooting guides explain the limit and how to address oversized responses, including ComfyUI outputs with embedded metadata. Options include raising the limit or disabling ComfyUI metadata.

🔄 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/7529 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `fix/7526-image-response-limit` --- ### 📝 Commits (2) - [`1bee5d6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1bee5d6e45c84a49bf808f985528f9f004338eff) fix(image): make the image response size limit configurable - [`38e037c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/38e037c4880101b7d2f317035c92e910ef54cadd) docs: say the 30 MiB image response limit is the default ### 📊 Changes **6 files changed** (+64 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+3 -0) 📝 `docs/CONFIGURATION.md` (+2 -1) 📝 `docs/TROUBLESHOOTING.md` (+1 -0) 📝 `packages/server/src/config/env-watcher.ts` (+1 -0) 📝 `packages/server/src/services/image/image-generation.ts` (+15 -1) ➕ `scripts/regressions/image-response-limit.regression.ts` (+42 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #7526 ## Why this change - A local ComfyUI that keeps metadata in its output files (workflow plus Base64 reference images) can return a file larger than 30 MiB. Marinara had a fixed 30 MiB cap on image provider responses, so the generation failed with a bare `Outbound response exceeded 31457280 bytes`. The user had no way to raise the cap and no hint about the cause. ## What changed - New `.env` setting `IMAGE_GEN_MAX_RESPONSE_BYTES`. The default stays 30 MiB. A blank, zero, or malformed value falls back to the default, so a typo cannot disable the cap. It mirrors `VIDEO_GEN_MAX_RESPONSE_BYTES` and needs a restart. - The cap error from image providers now names the setting: `Outbound response exceeded N bytes. Raise IMAGE_GEN_MAX_RESPONSE_BYTES in .env and restart Marinara to accept larger images.` - The setting is listed in `.env.example`, `docs/CONFIGURATION.md`, `docs/TROUBLESHOOTING.md`, and the env-watcher restart list. - New regression `scripts/regressions/image-response-limit.regression.ts`. Not changed, on purpose: - The default limit. 30 MiB stays as the guard for remote providers. - RunPod ComfyUI (`runpod-comfyui.service.ts`) and Venice keep their own fixed 30 MiB caps. They are not in the path of the issue. - A malformed value falls back to the default without a log line, the same as the video setting. ## Validation - [ ] `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` Commands run by the agent: - `node ./scripts/run-regressions.mjs --filter scripts/regressions/image-response-limit.regression.ts`: passed. - `image-generation-timeout` and `greeting-image-bake` regressions: passed. - `pnpm --filter @marinara-engine/server run lint` (tsc): passed. - `pnpm format:check`: passed. - Full `pnpm check` was not run locally. CI runs it. Local review: - Local CodeRabbit: 1 minor finding (doc wording: the limit applies to the provider response, not the image). Fixed. - Reviewer subagent: verdict ship, 3 low findings. Fixed: an inaccurate code comment, and the docs now say "local ComfyUI". Also dropped `cause` from the wrapped error, because route error formatters append `cause.message` and printed the limit twice. Not done: a warning log for a malformed value (optional, the video setting has none). ### Manual verification notes - Not verified against a real ComfyUI. Manually verify: set `IMAGE_GEN_MAX_RESPONSE_BYTES=104857600`, restart, and generate a ComfyUI image whose output file is larger than 30 MiB. The image must arrive. - Manually verify: without the setting, the same generation fails and the error text names `IMAGE_GEN_MAX_RESPONSE_BYTES`. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Docs changed: `docs/CONFIGURATION.md`, `docs/TROUBLESHOOTING.md`. Follow-up for translations: https://github.com/Pasta-Devs/Marinara-Engine/issues/7528 ## UI evidence (if applicable) None. Server and docs only. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * The maximum accepted image-provider response size can be configured with `IMAGE_GEN_MAX_RESPONSE_BYTES`. The default is 30 MiB; invalid values use the default, and changing the setting requires a server restart. * When a response exceeds the configured limit, the error explains how to adjust the setting and restart the server. * **Documentation** * Configuration and troubleshooting guides explain the limit and how to address oversized responses, including ComfyUI outputs with embedded metadata. Options include raising the limit or disabling ComfyUI metadata. <!-- 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-24 04:07:25 +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#7777
No description provided.