[PR #4457] [MERGED] NO MERGIE!: fix(noodle): send image instructions to the timeline model, not the image model #6387

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4457
Author: @Gunterlie
Created: 8/2/2026
Status: ✅ Merged
Merged: 8/2/2026
Merged by: @Gunterlie

Base: staging ← Head: fix/noodle-image-instructions-bypass-llm


📝 Commits (7)

  • 6434673 fix(noodle): send image instructions to the timeline model, not the image model
  • c94c301 fix(noodle): drop LLM-facing framing from the image prompt blocks
  • 7376f73 fix(image): keep prompt labels out of the diffusion prompt
  • 1191ef8 Merge branch 'staging' into fix/noodle-image-instructions-bypass-llm
  • b66f248 test(noodle): cover the shared appearance block, and scope the changelog claim
  • bd671a3 Merge remote-tracking branch 'origin/fix/noodle-image-instructions-bypass-llm' into fix/noodle-image-instructions-bypass-llm
  • d521992 Merge branch 'staging' into fix/noodle-image-instructions-bypass-llm

📊 Changes

6 files changed (+71 additions, -14 deletions)

View changed files

📝 CHANGELOG.md (+6 -0)
📝 packages/client/src/localization/locales/en.json (+2 -2)
📝 packages/server/src/services/image/illustrator-references.ts (+3 -1)
📝 packages/server/src/services/noodle/noodle-prompt.ts (+6 -1)
📝 packages/server/src/services/prompt-overrides/registry/noodle.ts (+7 -7)
📝 scripts/regressions/noodle-prompt.regression.ts (+47 -3)

📄 Description

Why

A user reported that Noodle image generation "bypasses the LLM": anything typed into Noodle Settings → image prompt instructions arrived at their local ComfyUI verbatim, with no character context. Their instruction string — "Create a social-media-ready character image. Mention build, clothing, appearance, body details, pose, expression, setting, lighting, mood, composition. Use precise language..." — appeared in the generated image's metadata as literal prompt text.

That is what the code does today. Noodle runs no LLM refinement pass for images. The timeline model writes imagePrompt alongside the post text (noodle-prompt.ts:375), and then noodle-noodler-images.service.ts:115 / noodle-public-images.service.ts:193 string-join that draft with appearance notes, personality, card image habits, and the user's instructions, and send the result straight to the generator. The setting is named and positioned like a system prompt but behaves like a prompt suffix, so writing instructions into it is the natural mistake.

Outside Noodle, the illustrator path does run instructions through the LLM first, which is why the behavior only looks broken here.

The reporter's ComfyUI screenshot shows the two halves cleanly: the model's own imagePrompt (a competent scene description) followed by the pasted-on instruction sentence.

What changed

1. Instructions go to the model that can act on them

  • imageGenerationPrompt is appended to the Noodle timeline feature instructions inside the enableImagePrompts branch, so the model reads it as direction while writing imagePrompt. The line states explicitly that the text is an instruction, not something to copy into the field.
  • userInstructions is removed from the default noodle.imagePost template. The variable stays registered, so custom templates referencing it still resolve.

2. No LLM-facing prose in the image prompt

The personality block was sending Let these traits naturally influence the subject, image quality, camera habits, mood, and composition to the image model, plus Character personality and traits: / Character-specific image instructions: labels. Nothing re-reads this string after the template renders, so that framing was dead weight competing for CLIP token budget. Bare values now.

3. Naming

  • Field label and help text: "Image instructions (sent to your LLM)", pointing raw style tokens at image style profiles instead.
  • Prompt-override descriptions now say plainly that noodle.imagePost output reaches the image model verbatim with no LLM pass after it.

Both image services share the template, so the NoodleR and public-account feeds are both covered — fixing only the reported path would have left the other leaking.

Not our bug

In the reporter's screenshot the instruction text is split across positive and negative prompts, breaking on the word "avoid". Nothing in packages/server/src/services/image/ or the Noodle services does that — it is their comfyui-umeairt-toolkit node parsing the prompt for negatives. It resolves itself once we stop sending prose down that path.

Behavior change to flag

Anyone using this field for style tokens (photorealistic, 85mm, natural lighting) will now see those go to the LLM rather than the generator. Image style profiles are the supported home for that and still apply to every Noodle image. Noted in the CHANGELOG.

Test plan

  • pnpm check
  • With image generation enabled and instruction-style text in Noodle Settings, refresh the timeline and confirm the ComfyUI metadata prompt describes the character rather than repeating the instructions
  • Confirm the generated imagePrompt visibly reflects the instructions (asking for lighting and composition should produce those details)
  • Confirm the model does not echo the instructions back inside imagePrompt. This is the main residual risk: normalizeNoodleImagePrompt (noodle-image-prompt.ts:34) exists because weaker local models parrot these labels, and this change puts the instructions in front of the model. Worth testing on a smaller local model specifically.
  • Manually verify in browser that the relabeled field saves on blur and its help text renders
  • With the instructions field empty, confirm timeline generation and image prompts are unchanged
  • Verify a custom noodle.imagePost override referencing {{userInstructions}} renders without error
  • Check an open-disclosure character post so the personality and appearance blocks actually populate, and confirm no labels reach the image model
  • Check the public-account image path, not just NoodleR posts

Notes

  • No linked issue — one should be opened for the Discord report before this merges.
  • Targets staging per CONTRIBUTING.md § Branches.
  • User-facing English strings changed; the docs-i18n language packs may need a follow-up.
  • Not verified at runtime by the author: pnpm check passes, but no timeline refresh or ComfyUI generation was run.

Correction and follow-up (negative-prompt leak)

I earlier told the reporter the positive/negative split was their ComfyUI toolkit's doing. That was wrong — it is ours. I had grepped packages/server/src/services/image/ and missed that the compiler is re-exported from packages/shared.

extractNegativeFragment (packages/shared/src/utils/image-prompt-compiler.ts:943) matches ^(avoid|no|without|exclude|do not include|don't include)\s+(.+) against every positive fragment and moves the remainder into the negative prompt (image-prompt-compiler.ts:174-177). So "Use precise language, avoid euphemisms or sanitized wording" splits into positive Use precise language and negative euphemisms or sanitized wording — exactly the reporter's screenshot.

For genuine visual prose ("no hat" → negative hat) this is the intended feature. The defect is that free prose reaches the compiler at all. Character card descriptions are full of sentences like "No one knows what happened to her sister", which this heuristic happily converts into the negative tag one knows what happened to her sister.

This PR removes two of the three prose sources (settings instructions, block labels/framing). The third remains and needs a maintainer decision:

characterAppearanceFromRow (noodle-public-images.service.ts:87) falls back to the raw card description field when no dedicated illustrator appearance is set:

return readIllustratorAppearance(data) ?? normalizeIllustratorAppearance(data.description) ?? "";

normalizeIllustratorAppearance caps it at 1400 chars, so it is bounded, but it is still raw card prose going to a diffusion model — and any negation sentence inside it gets pulled into the negative prompt.

Two candidate fixes, deliberately not taken here:

  1. Drop the description fallback for Noodle so only a real appearance field is used. Cleanest, but characters without that field lose appearance conditioning entirely — an image-quality tradeoff that is a maintainer call.
  2. Restrict extractNegativeFragment to short tag-like fragments. This is a shared choke point used by every image path in the app; tightening it on a hunch risks breaking legitimate negatives ("no text or watermarks" is indistinguishable from card prose by word count alone).

I did not want to guess at either from outside the project's quality bar.

Also spotted, out of scope: buildSceneIllustrationAppearanceNotes (game-asset-generation.ts:1080) builds its own Character appearance notes: header for the Game Mode scene path, and prompt.regression.ts:3957 asserts that header is present. Same leak, different path, with a test pinning current behavior — worth a separate issue.

Verification

  • pnpm check — passes
  • pnpm regression:noodle — passes (14 lanes)
  • pnpm regression:prompt — passes
  • pnpm regression:roleplay — passes
  • New assertions confirmed to fail against the pre-fix builder before being committed

Still not verified at runtime: no timeline refresh or actual ComfyUI generation was run by the author.

Summary by CodeRabbit

  • New Features

    • Added configurable instructions for Noodle image generation.
    • Clarified that image-prompt guidance is processed by the timeline model and applied to image prompts.
  • Bug Fixes

    • Removed unnecessary labels, framing, and unrelated post content from image prompts.
    • Prevented shared illustrator appearance headers from being repeated.
    • Preserved character traits and image-specific instructions while excluding language-model instructions.

🔄 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/4457 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 8/2/2026 **Status:** ✅ Merged **Merged:** 8/2/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `fix/noodle-image-instructions-bypass-llm` --- ### 📝 Commits (7) - [`6434673`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6434673589ef83d48672110cca43401bab8882cd) fix(noodle): send image instructions to the timeline model, not the image model - [`c94c301`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c94c3016c6f06c2e943aa3b920a2d1ecc85a0ec9) fix(noodle): drop LLM-facing framing from the image prompt blocks - [`7376f73`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7376f7307990dc06ce95a6b95578576d8fe642cd) fix(image): keep prompt labels out of the diffusion prompt - [`1191ef8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1191ef82b336d00934031d709f41cc15053579e2) Merge branch 'staging' into fix/noodle-image-instructions-bypass-llm - [`b66f248`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b66f248a414aba61850094b2f9360ae6ad9d9347) test(noodle): cover the shared appearance block, and scope the changelog claim - [`bd671a3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bd671a350f647db8e5425f43556d2ad327d73609) Merge remote-tracking branch 'origin/fix/noodle-image-instructions-bypass-llm' into fix/noodle-image-instructions-bypass-llm - [`d521992`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d5219923411f8dedd2b35901a8d82891b96b1cff) Merge branch 'staging' into fix/noodle-image-instructions-bypass-llm ### 📊 Changes **6 files changed** (+71 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+6 -0) 📝 `packages/client/src/localization/locales/en.json` (+2 -2) 📝 `packages/server/src/services/image/illustrator-references.ts` (+3 -1) 📝 `packages/server/src/services/noodle/noodle-prompt.ts` (+6 -1) 📝 `packages/server/src/services/prompt-overrides/registry/noodle.ts` (+7 -7) 📝 `scripts/regressions/noodle-prompt.regression.ts` (+47 -3) </details> ### 📄 Description ## Why A user reported that Noodle image generation "bypasses the LLM": anything typed into Noodle Settings → image prompt instructions arrived at their local ComfyUI verbatim, with no character context. Their instruction string — *"Create a social-media-ready character image. Mention build, clothing, appearance, body details, pose, expression, setting, lighting, mood, composition. Use precise language..."* — appeared in the generated image's metadata as literal prompt text. That is what the code does today. Noodle runs **no LLM refinement pass for images**. The timeline model writes `imagePrompt` alongside the post text (`noodle-prompt.ts:375`), and then `noodle-noodler-images.service.ts:115` / `noodle-public-images.service.ts:193` string-join that draft with appearance notes, personality, card image habits, and the user's instructions, and send the result straight to the generator. The setting is named and positioned like a system prompt but behaves like a prompt suffix, so writing instructions into it is the natural mistake. Outside Noodle, the illustrator path does run instructions through the LLM first, which is why the behavior only looks broken here. The reporter's ComfyUI screenshot shows the two halves cleanly: the model's own `imagePrompt` (a competent scene description) followed by the pasted-on instruction sentence. ## What changed **1. Instructions go to the model that can act on them** - `imageGenerationPrompt` is appended to the Noodle timeline feature instructions inside the `enableImagePrompts` branch, so the model reads it as direction while writing `imagePrompt`. The line states explicitly that the text is an instruction, not something to copy into the field. - `userInstructions` is removed from the default `noodle.imagePost` template. The variable stays registered, so custom templates referencing it still resolve. **2. No LLM-facing prose in the image prompt** The personality block was sending `Let these traits naturally influence the subject, image quality, camera habits, mood, and composition` to the image model, plus `Character personality and traits:` / `Character-specific image instructions:` labels. Nothing re-reads this string after the template renders, so that framing was dead weight competing for CLIP token budget. Bare values now. **3. Naming** - Field label and help text: "Image instructions (sent to your LLM)", pointing raw style tokens at image style profiles instead. - Prompt-override descriptions now say plainly that `noodle.imagePost` output reaches the image model verbatim with no LLM pass after it. Both image services share the template, so the NoodleR and public-account feeds are both covered — fixing only the reported path would have left the other leaking. ## Not our bug In the reporter's screenshot the instruction text is split across positive and negative prompts, breaking on the word "avoid". Nothing in `packages/server/src/services/image/` or the Noodle services does that — it is their `comfyui-umeairt-toolkit` node parsing the prompt for negatives. It resolves itself once we stop sending prose down that path. ## Behavior change to flag Anyone using this field for style tokens (`photorealistic, 85mm, natural lighting`) will now see those go to the LLM rather than the generator. Image style profiles are the supported home for that and still apply to every Noodle image. Noted in the CHANGELOG. ## Test plan - [ ] `pnpm check` - [ ] With image generation enabled and instruction-style text in Noodle Settings, refresh the timeline and confirm the ComfyUI metadata prompt describes the character rather than repeating the instructions - [ ] Confirm the generated `imagePrompt` visibly reflects the instructions (asking for lighting and composition should produce those details) - [ ] **Confirm the model does not echo the instructions back inside `imagePrompt`.** This is the main residual risk: `normalizeNoodleImagePrompt` (`noodle-image-prompt.ts:34`) exists because weaker local models parrot these labels, and this change puts the instructions in front of the model. Worth testing on a smaller local model specifically. - [ ] Manually verify in browser that the relabeled field saves on blur and its help text renders - [ ] With the instructions field empty, confirm timeline generation and image prompts are unchanged - [ ] Verify a custom `noodle.imagePost` override referencing `{{userInstructions}}` renders without error - [ ] Check an open-disclosure character post so the personality and appearance blocks actually populate, and confirm no labels reach the image model - [ ] Check the public-account image path, not just NoodleR posts ## Notes - No linked issue — one should be opened for the Discord report before this merges. - Targets `staging` per `CONTRIBUTING.md § Branches`. - User-facing English strings changed; the `docs-i18n` language packs may need a follow-up. - Not verified at runtime by the author: `pnpm check` passes, but no timeline refresh or ComfyUI generation was run. --- ## Correction and follow-up (negative-prompt leak) I earlier told the reporter the positive/negative split was their ComfyUI toolkit's doing. **That was wrong** — it is ours. I had grepped `packages/server/src/services/image/` and missed that the compiler is re-exported from `packages/shared`. `extractNegativeFragment` (`packages/shared/src/utils/image-prompt-compiler.ts:943`) matches `^(avoid|no|without|exclude|do not include|don't include)\s+(.+)` against **every positive fragment** and moves the remainder into the negative prompt (`image-prompt-compiler.ts:174-177`). So `"Use precise language, avoid euphemisms or sanitized wording"` splits into positive `Use precise language` and negative `euphemisms or sanitized wording` — exactly the reporter's screenshot. For genuine visual prose (`"no hat"` → negative `hat`) this is the intended feature. The defect is that **free prose reaches the compiler at all**. Character card descriptions are full of sentences like *"No one knows what happened to her sister"*, which this heuristic happily converts into the negative tag `one knows what happened to her sister`. **This PR removes two of the three prose sources** (settings instructions, block labels/framing). The third remains and needs a maintainer decision: `characterAppearanceFromRow` (`noodle-public-images.service.ts:87`) falls back to the raw card `description` field when no dedicated illustrator appearance is set: ```ts return readIllustratorAppearance(data) ?? normalizeIllustratorAppearance(data.description) ?? ""; ``` `normalizeIllustratorAppearance` caps it at 1400 chars, so it is bounded, but it is still raw card prose going to a diffusion model — and any negation sentence inside it gets pulled into the negative prompt. Two candidate fixes, deliberately **not** taken here: 1. Drop the `description` fallback for Noodle so only a real appearance field is used. Cleanest, but characters without that field lose appearance conditioning entirely — an image-quality tradeoff that is a maintainer call. 2. Restrict `extractNegativeFragment` to short tag-like fragments. This is a shared choke point used by every image path in the app; tightening it on a hunch risks breaking legitimate negatives (`"no text or watermarks"` is indistinguishable from card prose by word count alone). I did not want to guess at either from outside the project's quality bar. **Also spotted, out of scope:** `buildSceneIllustrationAppearanceNotes` (`game-asset-generation.ts:1080`) builds its own `Character appearance notes:` header for the Game Mode scene path, and `prompt.regression.ts:3957` asserts that header is present. Same leak, different path, with a test pinning current behavior — worth a separate issue. ## Verification - `pnpm check` — passes - `pnpm regression:noodle` — passes (14 lanes) - `pnpm regression:prompt` — passes - `pnpm regression:roleplay` — passes - New assertions confirmed to fail against the pre-fix builder before being committed Still not verified at runtime: no timeline refresh or actual ComfyUI generation was run by the author. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added configurable instructions for Noodle image generation. - Clarified that image-prompt guidance is processed by the timeline model and applied to image prompts. - **Bug Fixes** - Removed unnecessary labels, framing, and unrelated post content from image prompts. - Prevented shared illustrator appearance headers from being repeated. - Preserved character traits and image-specific instructions while excluding language-model instructions. <!-- 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:09:57 +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#6387
No description provided.