[GH-ISSUE #924] [Issue]: {{char}} can resolve to the wrong character in multi-character group prompts #449

Closed
opened 2026-10-20 17:28:59 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @NeoKazuya on GitHub (May 16, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/924

Summary

In group prompts with multiple characters, character-specific prompt text can be filled with the first character in the chat instead of the character that owns that text or the character currently replying.

This affects prompt text that uses character macros such as {{char}}. A visible example is an individual-mode group reply: with Narration Style set to Second Person and Narrative Perspective set to Character's, Bob's model request can include Respond ONLY as Bob. while the same request still says to write from Alice's perspective.

Expected behavior

When prompt text belongs to Bob, character macros that refer to that character should use Bob. That includes Bob's separate reply in an individual-mode group chat, Bob's character fields, and Bob's dialogue examples.

For example, the default output-format instruction should say to write from Bob's perspective for Bob's reply. Regenerating Bob's individual-mode group message should behave the same way.

Actual behavior

Prompt text can be filled with the first character before the app sends or inserts Bob-specific prompt text.

As a result, Bob's model request can contain:

Respond ONLY as Bob.

while the same request also contains:

Write English prose in the present tense, second-person limited narration from Alice's perspective...

Targeted regeneration of Bob's message in an individual-mode group chat shows the same mismatch.

Steps to reproduce

  1. Create two characters, Alice and Bob.
  2. Create a roleplay group chat with Alice and Bob using these settings:
    • Group chat mode: Individual
    • Prompt Preset: default preset
    • Narration Style: Second Person
    • Narrative Perspective: Character's
  3. Send a user message so the group generates separate replies.
  4. Inspect Bob's generated prompt through Peek Prompt, or capture the outgoing model request for Bob's reply.

Expected: Bob's reply uses Bob in the Character's POV instruction.

Actual: Bob's reply contains Respond ONLY as Bob. but the output-format instruction still uses Alice in the Character's POV text.

Environment

  • Marinara Engine version: 1.5.9
  • Found on main and reproduced on current staging at f60f2a27572a3929d8b787cda2fb6efb3c5a461b
  • Install type: Source
  • OS + version: Windows 11
  • Browser or app shell: Not browser-specific; reproduced through server prompt/generation routes

Logs, screenshots, or video

Observed current-staging prompt/model request snippets from the affected Bob reply:

The same outgoing request contains both of these instructions:

Respond ONLY as Bob.
Write English prose in the present tense, second-person limited narration from Alice's perspective, as an unreliable narrator.

The same first-character substitution also showed up in broader prompt sections when those sections contained {{char}}:

<bob>
    <description>
        Alice is a knight.
    </description>
</bob>
Alice: hello from Bob

With an active constant lorebook entry containing LORE_NAME={{char}}, the Bob request also contained:

LORE_NAME=Alice

Additional context

This is adjacent to the regen instruction fix in PR #178, but separate from it: the regen request now knows to say Respond ONLY as Bob., while character prompt values can still be frozen to Alice.

It's also adjacent to the lorebook/regex macro work in #738 / #736, but this issue is about multi-character group prompt text that should resolve against a known responder or character owner.

The character-card, example-dialogue, and lorebook cases are included as broader affected cases because they need to stay correct at the same time.

Respond ONLY as Bob. works because it's added after Bob has already been selected as the responder. The Character's POV line doesn't work because it uses {{char}}, which was already filled as Alice earlier in prompt building.

Temporary workaround: prompt authors can avoid the visible POV mismatch by not using {{char}} in the Character's POV instruction and instead writing a generic phrase such as the currently replying character. That works for this visible symptom because the same Bob request already has the direct Respond ONLY as Bob. instruction identifying the responder. The workaround is less explicit, and it doesn't fix existing presets, card fields, examples, or lorebook entries that already use {{char}}.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @NeoKazuya on GitHub (May 16, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/924 ## Summary In group prompts with multiple characters, character-specific prompt text can be filled with the first character in the chat instead of the character that owns that text or the character currently replying. This affects prompt text that uses character macros such as `{{char}}`. A visible example is an individual-mode group reply: with Narration Style set to `Second Person` and Narrative Perspective set to `Character's`, Bob's model request can include `Respond ONLY as Bob.` while the same request still says to write from Alice's perspective. ## Expected behavior When prompt text belongs to Bob, character macros that refer to that character should use Bob. That includes Bob's separate reply in an individual-mode group chat, Bob's character fields, and Bob's dialogue examples. For example, the default output-format instruction should say to write from Bob's perspective for Bob's reply. Regenerating Bob's individual-mode group message should behave the same way. ## Actual behavior Prompt text can be filled with the first character before the app sends or inserts Bob-specific prompt text. As a result, Bob's model request can contain: ```text Respond ONLY as Bob. ``` while the same request also contains: ```text Write English prose in the present tense, second-person limited narration from Alice's perspective... ``` Targeted regeneration of Bob's message in an individual-mode group chat shows the same mismatch. ## Steps to reproduce 1. Create two characters, Alice and Bob. 2. Create a roleplay group chat with Alice and Bob using these settings: - Group chat mode: `Individual` - Prompt Preset: default preset - Narration Style: `Second Person` - Narrative Perspective: `Character's` 3. Send a user message so the group generates separate replies. 4. Inspect Bob's generated prompt through Peek Prompt, or capture the outgoing model request for Bob's reply. Expected: Bob's reply uses Bob in the Character's POV instruction. Actual: Bob's reply contains `Respond ONLY as Bob.` but the output-format instruction still uses Alice in the Character's POV text. ## Environment - Marinara Engine version: `1.5.9` - Found on `main` and reproduced on current `staging` at `f60f2a27572a3929d8b787cda2fb6efb3c5a461b` - Install type: Source - OS + version: Windows 11 - Browser or app shell: Not browser-specific; reproduced through server prompt/generation routes ## Logs, screenshots, or video Observed current-staging prompt/model request snippets from the affected Bob reply: The same outgoing request contains both of these instructions: ```text Respond ONLY as Bob. ``` ```text Write English prose in the present tense, second-person limited narration from Alice's perspective, as an unreliable narrator. ``` The same first-character substitution also showed up in broader prompt sections when those sections contained `{{char}}`: ```xml <bob> <description> Alice is a knight. </description> </bob> ``` ```text Alice: hello from Bob ``` With an active constant lorebook entry containing `LORE_NAME={{char}}`, the Bob request also contained: ```text LORE_NAME=Alice ``` ## Additional context This is adjacent to the regen instruction fix in PR #178, but separate from it: the regen request now knows to say `Respond ONLY as Bob.`, while character prompt values can still be frozen to Alice. It's also adjacent to the lorebook/regex macro work in #738 / #736, but this issue is about multi-character group prompt text that should resolve against a known responder or character owner. The character-card, example-dialogue, and lorebook cases are included as broader affected cases because they need to stay correct at the same time. `Respond ONLY as Bob.` works because it's added after Bob has already been selected as the responder. The Character's POV line doesn't work because it uses `{{char}}`, which was already filled as Alice earlier in prompt building. Temporary workaround: prompt authors can avoid the visible POV mismatch by not using `{{char}}` in the Character's POV instruction and instead writing a generic phrase such as `the currently replying character`. That works for this visible symptom because the same Bob request already has the direct `Respond ONLY as Bob.` instruction identifying the responder. The workaround is less explicit, and it doesn't fix existing presets, card fields, examples, or lorebook entries that already use `{{char}}`. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:28:59 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@SpicyMarinara commented on GitHub (May 17, 2026):

Thank you for the PR, merged!

<!-- gh-comment-id:4470108232 --> @SpicyMarinara commented on GitHub (May 17, 2026): Thank you for the PR, merged!
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#449
No description provided.