[GH-ISSUE #675] [Bug]: Slurp discards character appearance and art style from image prompts #348

Closed
opened 2026-10-20 17:26:43 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @Gunterlie on GitHub (Sep 1, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/675

Summary

Slurp drops the configured art style and the character appearance from the final image prompt. The leak guard that keeps private context out of provider prompts discards the whole rewritten prompt when the rewriter reproduces the guidance text, and the fallback is the bare draft prompt, which contains neither the style nor the appearance.

Reported by two users: constant loss for one, occasional style drift for another. The difference is explained below.

Root cause

selectNoodleImageProviderPrompt() in packages/slurp/src/engine/packages/server/src/services/slurp/slurp-image-prompt.ts:8 rejects the rewritten prompt when it contains any privateContext entry as a substring:

const copiesPrivateContext = input.privateContext?.some((value) => {
  const normalizedValue = value?.trim().toLocaleLowerCase().replace(/\s+/gu, " ");
  return normalizedValue && normalizedValue.length > 1 && normalizedPrompt.includes(normalizedValue);
});
return hasInternalMarker || copiesPrivateContext ? input.rawPrompt : rewrittenPrompt;

Both call sites put styleGuidance into that list:

  • slurp-images.service.ts:222-228
  • slurp-public-images.service.ts (same block)
privateContext: [
  configuredImageInstructions,
  connectionImageInstructions,
  characterPersonality,
  characterImageInstructions,
  styleGuidance,
],

At the same time, the rewriter is explicitly instructed to apply that guidance — slurp-image-prompt-rewrite.ts:71-75:

"Apply the supplied art-style guidance when the original prompt does not specify a style."

So the feature fights itself. The rewriter is told to use the style guidance; the guard then throws the result away for having used it. The fallback rawProviderPrompt is input.draftPrompt, which has never had appearance or style applied — which is why both are lost together.

Why it is intermittent

The match is on the full guidance string. A rewriter that paraphrases survives; one that copies the phrase verbatim is discarded. Weaker local models copy verbatim far more often, which matches the report from a Gemma user seeing it constantly versus another user seeing three bad generations in one day.

Verified against the real function:

obeyed rewrite kept?     false   → fell back to raw draft, style and appearance lost
paraphrased kept?        true
short-instruction kept?  false

The third line is the important one for users. A short entry in Image generation instructions such as anime style is 11 characters, comfortably over the length > 1 floor, and will appear verbatim in almost any prompt that honours it. That entry is always discarded. This is exactly the workaround one user reported as no longer working: putting art-style text into the guidance field guarantees the rewrite is thrown away.

Impact

  • Character appearance never reaches the image provider even with Include descriptions on.
  • Configured art style profiles are ignored, non-deterministically.
  • Putting art style into Image generation instructions makes it strictly worse, not better.

Suggested fix

styleGuidance is content that is meant to appear in the output. It does not belong in privateContext. The same argument applies to characterImageInstructions, which is authored to steer the image.

  1. Reduce privateContext to genuinely private values: configuredImageInstructions, connectionImageInstructions, and characterPersonality.
  2. Replace the substring includes() test with a whole-block match, so a short user phrase cannot poison every prompt. The hasInternalMarker regex already covers the real leak shape — labelled blocks and tags — and should stay.

Test that locks in the current behaviour

tests/slurp-image-instructions.regression.ts:26 asserts the discard:

`A person reading beside a window.\n${styleGuidance}`,   // styleGuidance = "Use a hand-painted editorial watercolor style."
→ expects rawPrompt

Any fix must update this case. The neighbouring leak cases (<art_style_guidance> tags, Character image preferences: labels) are correct and should be kept — those are true leaks of internal scaffolding, whereas an applied style phrase is the intended output.

Affects

Slurp 1.0.20 onward. The guard was introduced in 64e76670 "fix(slurp): keep image provider prompts visual-only".

See also the review-modal bypass, which loses the same two things by a different mechanism.

Originally created by @Gunterlie on GitHub (Sep 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/675 ## Summary Slurp drops the configured art style and the character appearance from the final image prompt. The leak guard that keeps private context out of provider prompts discards the whole rewritten prompt when the rewriter reproduces the guidance text, and the fallback is the bare draft prompt, which contains neither the style nor the appearance. Reported by two users: constant loss for one, occasional style drift for another. The difference is explained below. ## Root cause `selectNoodleImageProviderPrompt()` in `packages/slurp/src/engine/packages/server/src/services/slurp/slurp-image-prompt.ts:8` rejects the rewritten prompt when it contains any `privateContext` entry as a substring: ```ts const copiesPrivateContext = input.privateContext?.some((value) => { const normalizedValue = value?.trim().toLocaleLowerCase().replace(/\s+/gu, " "); return normalizedValue && normalizedValue.length > 1 && normalizedPrompt.includes(normalizedValue); }); return hasInternalMarker || copiesPrivateContext ? input.rawPrompt : rewrittenPrompt; ``` Both call sites put `styleGuidance` into that list: - `slurp-images.service.ts:222-228` - `slurp-public-images.service.ts` (same block) ```ts privateContext: [ configuredImageInstructions, connectionImageInstructions, characterPersonality, characterImageInstructions, styleGuidance, ], ``` At the same time, the rewriter is explicitly instructed to **apply** that guidance — `slurp-image-prompt-rewrite.ts:71-75`: > "Apply the supplied art-style guidance when the original prompt does not specify a style." So the feature fights itself. The rewriter is told to use the style guidance; the guard then throws the result away for having used it. The fallback `rawProviderPrompt` is `input.draftPrompt`, which has never had appearance or style applied — which is why **both** are lost together. ## Why it is intermittent The match is on the full guidance string. A rewriter that paraphrases survives; one that copies the phrase verbatim is discarded. Weaker local models copy verbatim far more often, which matches the report from a Gemma user seeing it constantly versus another user seeing three bad generations in one day. Verified against the real function: ``` obeyed rewrite kept? false → fell back to raw draft, style and appearance lost paraphrased kept? true short-instruction kept? false ``` The third line is the important one for users. A short entry in **Image generation instructions** such as `anime style` is 11 characters, comfortably over the `length > 1` floor, and will appear verbatim in almost any prompt that honours it. That entry is *always* discarded. This is exactly the workaround one user reported as no longer working: putting art-style text into the guidance field guarantees the rewrite is thrown away. ## Impact - Character appearance never reaches the image provider even with **Include descriptions** on. - Configured art style profiles are ignored, non-deterministically. - Putting art style into **Image generation instructions** makes it strictly worse, not better. ## Suggested fix `styleGuidance` is content that is *meant* to appear in the output. It does not belong in `privateContext`. The same argument applies to `characterImageInstructions`, which is authored to steer the image. 1. Reduce `privateContext` to genuinely private values: `configuredImageInstructions`, `connectionImageInstructions`, and `characterPersonality`. 2. Replace the substring `includes()` test with a whole-block match, so a short user phrase cannot poison every prompt. The `hasInternalMarker` regex already covers the real leak shape — labelled blocks and tags — and should stay. ## Test that locks in the current behaviour `tests/slurp-image-instructions.regression.ts:26` asserts the discard: ```ts `A person reading beside a window.\n${styleGuidance}`, // styleGuidance = "Use a hand-painted editorial watercolor style." → expects rawPrompt ``` Any fix must update this case. The neighbouring leak cases (`<art_style_guidance>` tags, `Character image preferences:` labels) are correct and should be kept — those are true leaks of internal scaffolding, whereas an applied style phrase is the intended output. ## Affects Slurp 1.0.20 onward. The guard was introduced in 64e76670 "fix(slurp): keep image provider prompts visual-only". See also the review-modal bypass, which loses the same two things by a different mechanism.
bsakaguchi 2026-10-20 17:26:43 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@Gunterlie commented on GitHub (Sep 1, 2026):

Scope correction.

The original report that prompted this issue bundled two complaints: the review modal's text being broken, and appearance/style not reaching the prompt. Those are separate defects with separate causes.

The broken text is #677 — ten localization keys used by ImagePromptReviewModal are missing from the package catalog, so the modal renders raw key names. That is a shared Engine component, so it affects Noodle too.

This issue is only about the prompt content. The two are independent: fixing #677 will make the modal readable, and it will then legibly display a prompt that is still missing the appearance and the style.

<!-- gh-comment-id:5489529021 --> @Gunterlie commented on GitHub (Sep 1, 2026): **Scope correction.** The original report that prompted this issue bundled two complaints: the review modal's text being broken, and appearance/style not reaching the prompt. Those are separate defects with separate causes. The broken text is #677 — ten localization keys used by `ImagePromptReviewModal` are missing from the package catalog, so the modal renders raw key names. That is a shared Engine component, so it affects Noodle too. This issue is only about the prompt content. The two are independent: fixing #677 will make the modal readable, and it will then legibly display a prompt that is still missing the appearance and the style.
Author
Owner

@Gunterlie commented on GitHub (Sep 1, 2026):

Runnable reproduction — drop in a file and run with npx tsx. No fixtures, no Engine boot needed; selectNoodleImageProviderPrompt is pure.

import { selectNoodleImageProviderPrompt } from "./packages/slurp/src/engine/packages/server/src/services/slurp/slurp-image-prompt";

const rawProviderPrompt = "Aria lounging on a velvet couch, teasing smile.";
const styleGuidance = "soft cel-shaded anime illustration, warm palette";

// What a co-operative rewriter returns: it applied BOTH the style and the appearance,
// exactly as slurp-image-prompt-rewrite.ts:71-75 instructs it to.
const goodRewrite =
  "Aria, silver hair, violet eyes, tall, lounging on a velvet couch, teasing smile, " +
  "soft cel-shaded anime illustration, warm palette";

console.log(selectNoodleImageProviderPrompt({
  rewrittenPrompt: goodRewrite,
  rawPrompt: rawProviderPrompt,
  privateContext: ["", "", "", "", styleGuidance],   // the slurp-images.service.ts:222 shape
}) === goodRewrite);   // false — discarded, falls back to the styleless raw prompt

// A short entry in "Image generation instructions" is discarded unconditionally.
console.log(selectNoodleImageProviderPrompt({
  rewrittenPrompt: "Aria on a velvet couch, anime style, warm light",
  rawPrompt: rawProviderPrompt,
  privateContext: ["anime style"],
}) === "Aria on a velvet couch, anime style, warm light");   // false

// A paraphrase survives — this is why the bug is intermittent.
const paraphrased = "Aria, silver hair, violet eyes, lounging on a velvet couch, cel shaded anime art with a warm palette";
console.log(selectNoodleImageProviderPrompt({
  rewrittenPrompt: paraphrased,
  rawPrompt: rawProviderPrompt,
  privateContext: [styleGuidance],
}) === paraphrased);   // true

Observed output: false / false / true.

The middle case is the important one for the fix. normalizedValue.length > 1 is the only floor, so any short user-authored instruction — anime style is 11 characters — appears verbatim in every prompt that honours it and poisons every generation. Whatever replaces the substring test must not have this property.

Note the intermittency in the third case explains the two different user reports against this issue: a user on a model that paraphrases sees occasional style drift, a user on a model that copies verbatim sees it fail constantly.

<!-- gh-comment-id:5489586050 --> @Gunterlie commented on GitHub (Sep 1, 2026): **Runnable reproduction** — drop in a file and run with `npx tsx`. No fixtures, no Engine boot needed; `selectNoodleImageProviderPrompt` is pure. ```ts import { selectNoodleImageProviderPrompt } from "./packages/slurp/src/engine/packages/server/src/services/slurp/slurp-image-prompt"; const rawProviderPrompt = "Aria lounging on a velvet couch, teasing smile."; const styleGuidance = "soft cel-shaded anime illustration, warm palette"; // What a co-operative rewriter returns: it applied BOTH the style and the appearance, // exactly as slurp-image-prompt-rewrite.ts:71-75 instructs it to. const goodRewrite = "Aria, silver hair, violet eyes, tall, lounging on a velvet couch, teasing smile, " + "soft cel-shaded anime illustration, warm palette"; console.log(selectNoodleImageProviderPrompt({ rewrittenPrompt: goodRewrite, rawPrompt: rawProviderPrompt, privateContext: ["", "", "", "", styleGuidance], // the slurp-images.service.ts:222 shape }) === goodRewrite); // false — discarded, falls back to the styleless raw prompt // A short entry in "Image generation instructions" is discarded unconditionally. console.log(selectNoodleImageProviderPrompt({ rewrittenPrompt: "Aria on a velvet couch, anime style, warm light", rawPrompt: rawProviderPrompt, privateContext: ["anime style"], }) === "Aria on a velvet couch, anime style, warm light"); // false // A paraphrase survives — this is why the bug is intermittent. const paraphrased = "Aria, silver hair, violet eyes, lounging on a velvet couch, cel shaded anime art with a warm palette"; console.log(selectNoodleImageProviderPrompt({ rewrittenPrompt: paraphrased, rawPrompt: rawProviderPrompt, privateContext: [styleGuidance], }) === paraphrased); // true ``` Observed output: `false / false / true`. The middle case is the important one for the fix. `normalizedValue.length > 1` is the only floor, so any short user-authored instruction — `anime style` is 11 characters — appears verbatim in every prompt that honours it and poisons every generation. Whatever replaces the substring test must not have this property. Note the intermittency in the third case explains the two different user reports against this issue: a user on a model that paraphrases sees occasional style drift, a user on a model that copies verbatim sees it fail constantly.
Author
Owner

@Gunterlie commented on GitHub (Sep 1, 2026):

Fix opened as draft #683.

<!-- gh-comment-id:5492760958 --> @Gunterlie commented on GitHub (Sep 1, 2026): Fix opened as draft #683.
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-Agents#348
No description provided.