[GH-ISSUE #6659] [Issue]: Illustrator manual generation hard-caps maxTokens at 1,800 #3731

Closed
opened 2026-10-21 06:06:36 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @SpicyMarinara on GitHub (Sep 25, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6659

Originally assigned to: @SpicyMarinara on GitHub.

Summary

The Illustrator agent's manual image-generation path silently clamps configured maxTokens to 1,800. This causes longer image_prompt JSON responses to be truncated and fail parsing, even when higher agent, connection, and model limits are configured.

Expected behavior

The outgoing request should use the configured agent maxTokens, subject to the connection override and known-model limit, without an undocumented 1,800-token ceiling.

Actual behavior

The outgoing request always uses "max_tokens": 1800 for manual illustrations when configured limits exceed 1,800. Responses can be truncated mid-JSON object, causing the agent to fail with a parse error.

Steps to reproduce

  1. Use Marinara Engine v2.4.6 in Docker.
  2. Set the Illustrator agent's maxTokens to 32,800 or another value above 1,800.
  3. Set the connection's maxTokensOverride to 32,800 and the active preset's maximum output to 8,192.
  4. Trigger a manual illustration.
  5. Capture or inspect the outgoing model request and observe that max_tokens is set to 1,800.
  6. Use a model whose image_prompt JSON exceeds 1,800 tokens and observe truncation followed by a parse error.

Environment

  • Marinara Engine version: v2.4.6
  • Install type: docker
  • OS + version: Not provided
  • Browser or app shell: Not provided

Logs, screenshots, or video

Outgoing request reportedly contains "max_tokens": 1800. No attachments provided. The issue was reproduced across two providers and four models: two GLM-based models, one Qwen-based model, and Kimi K3.

Additional context

The affected code is packages/server/src/services/generation/illustrator-manual-prompt-generation.ts. resolveManualIllustratorMaxTokens() applies Math.min(MANUAL_ILLUSTRATION_MAX_TOKENS, configuredLimit, modelLimit), with MANUAL_ILLUSTRATION_MAX_TOKENS set to 1,800. The agent editor accepts larger values without showing that they are ignored. Locally changing the constant to 8,192 resolved truncation. Suggested fixes are to raise the constant or use it only as a fallback when no agent value is configured; alternatively, surface the effective cap in the agent editor. Illustrator agent version and support diagnostics were not provided.

Discord thread: Illustrator maxTokens silently clamped to 1,800 by hard-coded constant
Discord thread link: https://discord.com/channels/1417099416812392641/1553012369221746698
Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653)

Discord thread transcript (2 messages)
[2026-09-25T11:56:42.397Z] Garlic?: Version: Marinara Engine v2.4.6 (Docker)
Affected component: Illustrator agent, manual image-generation path

Summary

The illustrator's configured maxTokens has no effect above 1,800 tokens. resolveManualIllustratorMaxTokens() in packages/server/src/services/generation/illustrator-manual-prompt-generation.ts applies Math.min(MANUAL_ILLUSTRATION_MAX_TOKENS, configuredLimit, modelLimit), where MANUAL_ILLUSTRATION_MAX_TOKENS = 1_800. The agent editor accepts larger values, so the cap is invisible to the user.

Reproduction
Set the illustrator agent's maxTokens to 32,800 (or any value above 1,800).
Set the connection's maxTokensOverride to 32,800 and the active preset's max output to 8,192.
Trigger a manual illustration.
Capture the outgoing request.
Expected

max_tokens reflects the configured agent value (subject to the connection override and known-model limit).

Actual

The request is sent with "max_tokens": 1800 regardless of configuration. On models whose image_prompt JSON runs longer than that, the response is truncated mid-object and the agent fails with a parse error. Reproduced on two providers and four models (two GLM-based, one Qwen-based, Kimi K3), so it's client-side, not model behavior.

Root cause

illustrator-manual-prompt-generation.js:4 — const MANUAL_ILLUSTRATION_MAX_TOKENS = 1_800; used as the outer bound in resolveManualIllustratorMaxTokens() (~line 229). The constant wins over both the agent setting and the connection override.

Suggested fix

Either raise the constant, or treat it as a fallback only when no agent value is configured rather than as an absolute ceiling. At minimum, surface the effective cap in the agent editor so the user knows their value is being ignored. Locally patching the constant to 8_192 resolved the truncation.
[Discord message: https://discord.com/channels/1417099416812392641/1553012369221746698/1553012369221746698]

[2026-09-25T11:56:43.253Z] Professor Mari [bot]: Howdy!

Thank you for submitting a new bug report/feature request, your support means a lot. A member of the team will look into it as soon as possible, and if they find it valid, they will open a GitHub Issue out of it. You can check whether it was addressed on the staging build of Marinara Engine. **Do not ping any of the developers, this will not speed up the process.**

**Please include a Support Diagnostic in the post if you haven't done it yet.** Otherwise, ignore this step. To grab it, go to the Marinara Engine tab:

`Settings -> Advanced -> Support Diagnostics -> Copy Support Diagnostics.`

If your report is about any of the **Agents**, please provide **the Agent's version** which you can grab from here:

`Agents -> Download Agents -> Installed Agents -> Selected Agent -> Installed Version`

Thank you, this will help tremendously.

This is an automated message, but if you reply to it, I will do my best to assist you using my LLM-powered brain. That said, it's best for a human to handle this case.

Cheers!
[Discord message: https://discord.com/channels/1417099416812392641/1553012369221746698/1553012372812341339]

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Sep 25, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6659 Originally assigned to: @SpicyMarinara on GitHub. ## Summary The Illustrator agent's manual image-generation path silently clamps configured maxTokens to 1,800. This causes longer image_prompt JSON responses to be truncated and fail parsing, even when higher agent, connection, and model limits are configured. ## Expected behavior The outgoing request should use the configured agent maxTokens, subject to the connection override and known-model limit, without an undocumented 1,800-token ceiling. ## Actual behavior The outgoing request always uses "max_tokens": 1800 for manual illustrations when configured limits exceed 1,800. Responses can be truncated mid-JSON object, causing the agent to fail with a parse error. ## Steps to reproduce 1. Use Marinara Engine v2.4.6 in Docker. 2. Set the Illustrator agent's maxTokens to 32,800 or another value above 1,800. 3. Set the connection's maxTokensOverride to 32,800 and the active preset's maximum output to 8,192. 4. Trigger a manual illustration. 5. Capture or inspect the outgoing model request and observe that max_tokens is set to 1,800. 6. Use a model whose image_prompt JSON exceeds 1,800 tokens and observe truncation followed by a parse error. ## Environment - Marinara Engine version: v2.4.6 - Install type: docker - OS + version: Not provided - Browser or app shell: Not provided ## Logs, screenshots, or video Outgoing request reportedly contains "max_tokens": 1800. No attachments provided. The issue was reproduced across two providers and four models: two GLM-based models, one Qwen-based model, and Kimi K3. ## Additional context The affected code is packages/server/src/services/generation/illustrator-manual-prompt-generation.ts. resolveManualIllustratorMaxTokens() applies Math.min(MANUAL_ILLUSTRATION_MAX_TOKENS, configuredLimit, modelLimit), with MANUAL_ILLUSTRATION_MAX_TOKENS set to 1,800. The agent editor accepts larger values without showing that they are ignored. Locally changing the constant to 8,192 resolved truncation. Suggested fixes are to raise the constant or use it only as a fallback when no agent value is configured; alternatively, surface the effective cap in the agent editor. Illustrator agent version and support diagnostics were not provided. Discord thread: Illustrator maxTokens silently clamped to 1,800 by hard-coded constant Discord thread link: https://discord.com/channels/1417099416812392641/1553012369221746698 Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653) <details> <summary>Discord thread transcript (2 messages)</summary> ```text [2026-09-25T11:56:42.397Z] Garlic?: Version: Marinara Engine v2.4.6 (Docker) Affected component: Illustrator agent, manual image-generation path Summary The illustrator's configured maxTokens has no effect above 1,800 tokens. resolveManualIllustratorMaxTokens() in packages/server/src/services/generation/illustrator-manual-prompt-generation.ts applies Math.min(MANUAL_ILLUSTRATION_MAX_TOKENS, configuredLimit, modelLimit), where MANUAL_ILLUSTRATION_MAX_TOKENS = 1_800. The agent editor accepts larger values, so the cap is invisible to the user. Reproduction Set the illustrator agent's maxTokens to 32,800 (or any value above 1,800). Set the connection's maxTokensOverride to 32,800 and the active preset's max output to 8,192. Trigger a manual illustration. Capture the outgoing request. Expected max_tokens reflects the configured agent value (subject to the connection override and known-model limit). Actual The request is sent with "max_tokens": 1800 regardless of configuration. On models whose image_prompt JSON runs longer than that, the response is truncated mid-object and the agent fails with a parse error. Reproduced on two providers and four models (two GLM-based, one Qwen-based, Kimi K3), so it's client-side, not model behavior. Root cause illustrator-manual-prompt-generation.js:4 — const MANUAL_ILLUSTRATION_MAX_TOKENS = 1_800; used as the outer bound in resolveManualIllustratorMaxTokens() (~line 229). The constant wins over both the agent setting and the connection override. Suggested fix Either raise the constant, or treat it as a fallback only when no agent value is configured rather than as an absolute ceiling. At minimum, surface the effective cap in the agent editor so the user knows their value is being ignored. Locally patching the constant to 8_192 resolved the truncation. [Discord message: https://discord.com/channels/1417099416812392641/1553012369221746698/1553012369221746698] [2026-09-25T11:56:43.253Z] Professor Mari [bot]: Howdy! Thank you for submitting a new bug report/feature request, your support means a lot. A member of the team will look into it as soon as possible, and if they find it valid, they will open a GitHub Issue out of it. You can check whether it was addressed on the staging build of Marinara Engine. **Do not ping any of the developers, this will not speed up the process.** **Please include a Support Diagnostic in the post if you haven't done it yet.** Otherwise, ignore this step. To grab it, go to the Marinara Engine tab: `Settings -> Advanced -> Support Diagnostics -> Copy Support Diagnostics.` If your report is about any of the **Agents**, please provide **the Agent's version** which you can grab from here: `Agents -> Download Agents -> Installed Agents -> Selected Agent -> Installed Version` Thank you, this will help tremendously. This is an automated message, but if you reply to it, I will do my best to assist you using my LLM-powered brain. That said, it's best for a human to handle this case. Cheers! [Discord message: https://discord.com/channels/1417099416812392641/1553012369221746698/1553012372812341339] ``` </details> ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 06:06:36 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Sep 25, 2026):

Implementation owner: Codex working for @SpicyMarinara. I am addressing this Engine-owned request-parameter bug in a focused PR against staging, reusing the existing provider and generation-limit code and regression suites.

<!-- gh-comment-id:5833522590 --> @SpicyMarinara commented on GitHub (Sep 25, 2026): Implementation owner: Codex working for @SpicyMarinara. I am addressing this Engine-owned request-parameter bug in a focused PR against staging, reusing the existing provider and generation-limit code and regression suites.
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#3731
No description provided.