mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3054] [Issue]: Negation word in a comma-separated prompt clause sweeps all following positive descriptors into the negative prompt #1622
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1622
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3054
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
When an image prompt (or the user's positive-prompt field) contains a comma-separated clause that starts with a negation word (no / avoid / without / exclude / "do not include"), the compiler grabs the entire rest of the clause as the thing to negate. Everything after that word — which the user or the LLM meant as positive detail — gets moved into the negative prompt and actively excluded from the image.
Concrete examples:
no glasses, red hair-> the negative prompt ends up containingglasses, red hair, so the requested red hair is excluded.A woman, no makeup, holding flowers, smiling-> the negative prompt becomesmakeup, holding flowers, smiling, and the positive prompt keeps onlyA woman. The flowers and the smile are thrown away.This silently inverts user intent and is reachable from the normal selfie, portrait, and avatar generation paths, because LLM-authored descriptions frequently contain phrases like
no makeup, natural light.How to reproduce (try it yourself)
A woman, no makeup, holding flowers, smiling(or set the user positive field tono glasses, red hair).compileImagePrompt.You'll see: the negative prompt contains
makeup, holding flowers, smiling(the flowers and smile are excluded); the positive prompt keeps onlyA womanplus profile tags. Forno glasses, red hair, the negative containsglasses, red hairand the red hair is dropped.Expected: only the directly-negated term is excluded (
makeup/glasses); the trailing descriptors (holding flowers,smiling,red hair) remain in the positive prompt.Where it is
packages/shared/src/utils/image-prompt-compiler.ts:extractNegativeFragmentline 569 —clean.match(/^(?:avoid|no|without|exclude|do not include|don't include)\s+(.+)$/i); the greedy unbounded(.+)$captures everything after the negation word to end of string.distillTaggedPromptSourcelines 231-237 — fans the captured string out on[,;], pushing every piece asavoid <item>./\n+|,(?=\s*(?:avoid|no|without)\b)/ionly splits the comma before a negation word, so the negation word stays attached to all following non-negation commas.compileImagePromptpositive loop lines 88-91 — runs each fragment throughextractNegativeFragmentthensplitNegativePromptItems(split on[,;]).Caller entry points:
packages/server/src/routes/generate.routes.ts:9523(selfie),:8400(portrait);packages/server/src/routes/characters.routes.ts:333,400(avatar).What's happening
extractNegativeFragment's capture group is greedy and unbounded, so forno makeup, holding flowers, smilingit capturesmakeup, holding flowers, smilinginstead of justmakeup. Both consumption sites then comma-split that captured string into multiple negatives. The sentence/clause splitters deliberately keep the leading negation word bound to its trailing comma list, so any positive descriptor that follows a negated term in the same clause-run is swept into the negative prompt.Suggested fix
Bound the negation to one comma-clause AND route the trailing terms back onto the positive path (do not merely stop negating them — a naive
([^,;]+)change alone silently drops them, which is a different bug):extractNegativeFragment(line 569): change the greedy capture to stop at the first comma/semicolon:const match = clean.match(/^(?:avoid|no|without|exclude|do not include|don't include)\s+([^,;]+)/i);Legitimate multi-word negatives (
no extra fingers,without makeup) have no internal comma, so they still negate as one term.Route the post-negation remainder to the positive path at both consumption sites:
.replace(/((?:^|[\n,])\s*(?:avoid|no|without|exclude|do not include|don't include)\s+[^,;\n]+),/gi, "$1\n"), sono makeup, holding flowers, smilingbecomes...no makeup\nholding flowers, smilingand the trailing terms flow to positives via the normal split.distillTaggedPromptSource(lines 231-238): on a negation match, pushavoid <firstClause>only, strip that leading negation clause fromsentence, and fall through (do NOTcontinue) to the existing per-item loop (lines 262-275), which already classifies the remaining items correctly. This keepsred hairpositive while negatingglasses.Regression avoided: option (a) by itself (just bounding the regex) converts the inversion into silent data-loss because neither call site re-adds the trailing terms to the positive list; the corrected fix re-routes them. The background subject tag
no people(image-style-profiles.ts:91) still negates correctly (no comma),userNegative/hardNegative/negativePromptnever touch the positive path, and the server compiler is a thin re-export of this shared helper, so all providers and callers benefit. No tests exist for this file.AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Claiming this for the current staging sweep in draft PR #3064: https://github.com/Pasta-Devs/Marinara-Engine/pull/3064
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed in PR #3064 on branch
codex/issue-sweep-3054-3063(commit3ae8ca37). Closing this issue as addressed; the PR remains open for staging review/merge.