[GH-ISSUE #7662] [Issue]: "Queue media generation requests" doesn't stop concurrent requests to the same provider #4238

Closed
opened 2026-10-21 06:13:12 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @ylli-selmani on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7662

Originally assigned to: @ylli-selmani on GitHub.

Summary

With Settings → Overall Generations → Queue media generation requests on, NovelAI still rejects image requests because several of them reach it at the same time. The queue only covers a few call sites, so most automatic image work bypasses it.

Expected behavior

With the toggle on, every image request to the same provider account waits for the previous one to finish, whichever feature sends it: the Illustrator agent, the model's [illustrate] command, Character Tracker NPC avatars, capability packages like Slurp, the gallery, and game assets.

Actual behavior

NovelAI rejects requests for concurrent generation in these cases:

  1. The Illustrator agent draws an image while the main model sends an [illustrate] command in the same turn.
  2. The Illustrator draws an image while the Character Tracker generates NPC avatars.
  3. In Slurp, generating many posts at once fires their image requests back to back, or overlapping.

What the code does (staging @ 5c07e57):

  • The toggle exists only on the client. Only the routes that receive it in their request body wrap their call in runMediaGenerationRequest (services/image/image-generation-queue.ts): the illustrator retry route, the gallery selfie, scene video, and gallery image generation. Game assets use it only to run that one batch with a single worker.
  • generateImage runs every call with queue: false (image-generation.ts:232-234). Every other path gets only the global ceiling, which allows 4 parallel requests (DEFAULT_MEDIA_GENERATION_CONCURRENCY).
  • /generate never receives the toggle. The automatic illustration and the [illustrate] command each start their own async job and call generateImage directly (generate.routes.ts:14416, :14683). NPC avatars are fire-and-forget through tracker-portrait.ts:116. Capability packages (Slurp) reach generateImage through host.images.generate (capability-integrations.service.ts:76).
  • Where the queue is used, it is keyed per connection id. Two connection rows for the same NovelAI account get separate queues.
  • There is no gap between back-to-back requests, and no backoff when the provider answers that a generation is already running.

Steps to reproduce

  1. Use a NovelAI image connection and turn Queue media generation requests on.
  2. In a roleplay chat, enable the Illustrator, and the Character Tracker with automatic NPC avatars.
  3. Send messages until the Illustrator draws in the same turn the tracker creates NPC avatars, or the model uses [illustrate] while the Illustrator is also drawing.
  4. One of the image requests is rejected by NovelAI.

Environment

  • Marinara Engine version: staging (5c07e57)
  • Install type: source
  • OS + version: Windows
  • Browser or app shell:

Logs, screenshots, or video

Code-path analysis above.

Additional context

Proposed fix: move the per-account FIFO into generateImage/generateVideo, next to the existing global ceiling. Key it on the provider endpoint plus account, and read the toggle on the server. Keep runMediaGenerationRequest working for existing callers. Add a short gap after each response, plus a backoff on "concurrent generation" rejections. Because packages go through host.images.generate, Slurp and other capability packages get the fix without changes in Marinara-Agents.

Related: #5097 (global concurrency ceiling).

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @ylli-selmani on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7662 Originally assigned to: @ylli-selmani on GitHub. ## Summary With **Settings → Overall Generations → Queue media generation requests** on, NovelAI still rejects image requests because several of them reach it at the same time. The queue only covers a few call sites, so most automatic image work bypasses it. ## Expected behavior With the toggle on, every image request to the same provider account waits for the previous one to finish, whichever feature sends it: the Illustrator agent, the model's `[illustrate]` command, Character Tracker NPC avatars, capability packages like Slurp, the gallery, and game assets. ## Actual behavior NovelAI rejects requests for concurrent generation in these cases: 1. The Illustrator agent draws an image while the main model sends an `[illustrate]` command in the same turn. 2. The Illustrator draws an image while the Character Tracker generates NPC avatars. 3. In Slurp, generating many posts at once fires their image requests back to back, or overlapping. What the code does (staging @ 5c07e57): - The toggle exists only on the client. Only the routes that receive it in their request body wrap their call in `runMediaGenerationRequest` (`services/image/image-generation-queue.ts`): the illustrator **retry** route, the gallery selfie, scene video, and gallery image generation. Game assets use it only to run that one batch with a single worker. - `generateImage` runs every call with `queue: false` (`image-generation.ts:232-234`). Every other path gets only the global ceiling, which allows **4** parallel requests (`DEFAULT_MEDIA_GENERATION_CONCURRENCY`). - `/generate` never receives the toggle. The automatic illustration and the `[illustrate]` command each start their own async job and call `generateImage` directly (`generate.routes.ts:14416`, `:14683`). NPC avatars are fire-and-forget through `tracker-portrait.ts:116`. Capability packages (Slurp) reach `generateImage` through `host.images.generate` (`capability-integrations.service.ts:76`). - Where the queue is used, it is keyed per connection id. Two connection rows for the same NovelAI account get separate queues. - There is no gap between back-to-back requests, and no backoff when the provider answers that a generation is already running. ## Steps to reproduce 1. Use a NovelAI image connection and turn **Queue media generation requests** on. 2. In a roleplay chat, enable the Illustrator, and the Character Tracker with automatic NPC avatars. 3. Send messages until the Illustrator draws in the same turn the tracker creates NPC avatars, or the model uses `[illustrate]` while the Illustrator is also drawing. 4. One of the image requests is rejected by NovelAI. ## Environment - Marinara Engine version: staging (5c07e57) - Install type: source - OS + version: Windows - Browser or app shell: ## Logs, screenshots, or video Code-path analysis above. ## Additional context Proposed fix: move the per-account FIFO into `generateImage`/`generateVideo`, next to the existing global ceiling. Key it on the provider endpoint plus account, and read the toggle on the server. Keep `runMediaGenerationRequest` working for existing callers. Add a short gap after each response, plus a backoff on "concurrent generation" rejections. Because packages go through `host.images.generate`, Slurp and other capability packages get the fix without changes in Marinara-Agents. Related: #5097 (global concurrency ceiling). ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 06:13:12 +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#4238
No description provided.