mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #6066] [Issue]: Bug Report: Conversation Identity Fallback Incorrectly Suppressed by Macro Alias Detection #3361
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#3361
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 @Mr-Ken-1102 on GitHub (Sep 12, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6066
Originally assigned to: @SpicyMarinara on GitHub.
Bug Report: Conversation Identity Fallback Incorrectly Suppressed by Macro Alias Detection
Summary
In Marinara Engine 2.4.4, Conversation-mode identity fallback can incorrectly omit Character and Persona fields when a custom Conversation prompt contains ordinary prose words such as
personality,description, orpersona.The issue is not in the Conversation fallback gate. The fallback gate behaves as intended and always enables identity fallback in Conversation mode.
The defect is in the macro alias detector used by the fallback suppression logic. Its current regular expression can match text across
}}macro boundaries, causing normal prose following a macro such as{{charName}}to be misinterpreted as if it contained explicit identity macros.This causes populated Character and Persona fields to be silently suppressed from the final model request.
Environment
1a299369aSeverity / Impact
This is a prompt-construction regression that can materially alter model behavior.
A custom Conversation prompt may appear valid in the UI but cause Character or Persona identity fields to disappear from the final model request simply because ordinary prose contains alias words after another macro.
Affected data can include:
Character
Persona
In the reproduced case, the custom prompt caused:
while Character Backstory, Appearance, and Scenario remained present.
Minimal Reproduction
A normal Conversation instruction such as:
contains no
{{personality}}or{{description}}macro.However, the current alias detector reports references to both
personalityanddescription.A similar issue occurs when ordinary prose contains the word
persona.For the tested saved preset, three false positives were observed:
description{{charName}}personality{{charName}}personauser/personaRoot Cause
The relevant detector currently constructs a pattern equivalent to:
The problem is the use of:
before and after the alias.
Although non-greedy, these expressions are not constrained to a single macro token. They can cross a closing
}}, continue through ordinary prompt prose, and terminate at a later}}.Conceptually, the detector can therefore interpret text like:
as one large apparent macro span.
This makes
personalityanddescriptionlook like macro aliases even though they are plain prose.Why the Conversation Fallback Gate Is Not the Problem
The current implementation is:
Observed behavior:
conversationtrueconversationnull/undefined/ emptytruegamefalseroleplayfalseroleplaytrue!presetIdThere is no built-in/custom whitelist or special Conversation preset distinction here.
Therefore, changing
shouldInjectIdentityFallback()would address the wrong subsystem.Built-in vs Custom Conversation Preset Control Flow
Built-in and custom Conversation prompts use the same identity fallback path.
The high-level flow is:
customSystemPromptconversationPromptDEFAULT_CONVERSATION_PROMPTfinalMessages.shouldInjectIdentityFallback(...)returnstruein Conversation mode.injectIdentityFallbackMessages(...)decides which fields to suppress or inject.The built-in and custom paths diverge only when the injector analyzes the selected template.
The built-in prompt produces no false alias matches.
The tested custom prompt does.
Actual Behavior
With the affected custom Conversation prompt:
The missing-field pattern was reproduced directly with the existing compiled injector.
Expected Behavior
Ordinary prose inside a Conversation prompt must not suppress identity fallback fields.
Only actual supported identity macro references or explicitly supported suppression constructs should cause a field to be omitted from fallback injection.
For example:
must not suppress Character Personality or Character Description.
By contrast:
should retain the intended deduplication behavior and prevent duplicate fallback insertion.
Current Suppression Logic
The fallback injector currently suppresses fields under several conditions:
The third condition is where this regression occurs.
Other relevant implementation characteristics:
allContentis captured before injection and is not refreshed after blocks are inserted.These are not necessarily defects by themselves, but they should remain unchanged unless intentionally redesigned.
Regression History / Intent
Repository history indicates that Conversation identity fallback is intentional.
Relevant history:
c7558d96c(June 24) changed the Conversation behavior so Character/Persona identity fallback remains enabled even when a preset is selected.fc673c17d(July 8) introduced template alias detection to prevent duplication and allow intentional field suppression.#3380 / #3377.truefrom the fallback gate.This strongly suggests the current behavior is a regression in deduplication detection, not an intended limitation of custom Conversation presets.
Recommended Fix
Preferred: constrain alias detection to one macro token
The safest patch is to change alias detection so that it cannot cross
{{ ... }}boundaries.The detector should inspect only the contents of an individual macro expression.
This preserves:
This is the smallest targeted correction.
Important compatibility requirement
Before accepting the patch, verify that the revised detection still handles any supported conditional/comment macro syntax that is intentionally allowed to suppress fields.
Alternative Fixes
Ranked from safest to riskiest:
Changing the custom prompt to avoid words such as
description,personality, orpersonais only a workaround and should not be treated as the fix.Suggested Regression Tests
The existing prompt regression suite should add focused coverage for this case.
{{charName}} ... personality ... {{charName}}descriptionpersona/user/persona{{description}}{{personality}}{{persona}}Recommended End-to-End Verification
After the patch:
Verification Already Performed
The following verification has already been completed:
Not performed:
No files were modified during the investigation.
Conclusion
The Conversation-mode identity fallback architecture is functioning as intended.
The regression is caused by the identity macro alias detector allowing its regex match to cross
}}boundaries. As a result, ordinary prose following macros can be mistaken for explicit identity references, and Character/Persona fields are incorrectly suppressed.The recommended fix is therefore narrowly scoped:
This resolves the observed failure without changing the Conversation fallback gate or broader prompt assembly behavior.
@SpicyMarinara commented on GitHub (Sep 12, 2026):
Owner: @SpicyMarinara (Codex). The maintainer has requested that this issue be completed in the assigned issue sweep, tracked in draft PR #6072. Existing contributor patches and previously completed translations will be reviewed and reused with attribution; the final PR will document the implementation and verification before this issue is closed.
@SpicyMarinara commented on GitHub (Sep 12, 2026):
Fixed in #6072, merged into
staging.Identity alias detection now stays inside one macro. Ordinary prose containing “alias” between separate macros no longer suppresses Backstory, Appearance, or Personality. The regression covers all three identity fields and deliberate aliases.