[GH-ISSUE #6208] Conversation mode renders {{user}} in a character's message as the character's own name #3461

Closed
opened 2026-10-21 06:03:20 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @kolacheee on GitHub (Sep 14, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6208

Originally assigned to: @SpicyMarinara on GitHub.

In a Conversation chat, {{user}} inside a character's message is displayed with the character's own name (or the literal "Assistant" when the chat has no character) instead of the user's name. The model receives the right text; only what is shown on screen is wrong.

Found while investigating an active-persona report; re-verified on staging at 14de2d1ad, and the same code is in v2.4.4.

How to reproduce (try it yourself)

  1. Create a persona "Alice" and select it in a Conversation chat (or set it as active and leave the chat without a persona).
  2. Get a character message that contains {{user}}. The quickest way without a model: give the character a greeting like Nice to meet you, {{user}}. and start a Conversation with it, or edit an existing character message to contain {{user}}.
  3. Compare the rendered message with Peek Prompt.

What you'll see: the message on screen reads "Nice to meet you, ." With no character in the chat it reads "Nice to meet you, Assistant." Peek Prompt shows the same message as "Nice to meet you, Alice."

What should happen: {{user}} renders as the user's persona name (Alice), the way Roleplay messages already do.

Where it is

At staging 14de2d1ad, packages/client/src/components/chat/ConversationMessage.tsx, the macroContext memo at lines 333-345: userName: displayName (line 335) is the cause. displayName (lines 302-308) is the message author's label, so for any non-user message it is primaryCharInfo?.name ?? "Assistant". {{user}} resolves from userName (packages/client/src/lib/chat-macros.ts, user: userName ?? persona?.name ?? "User"), so a character message substitutes the speaker's name. The persona.name: displayName on line 337 is shadowed by userName and does not matter; the persona description/personality/backstory/appearance/scenario fields on the following lines still come from the real persona, so only the name macros are wrong: {{user}}, {{userName}}, and the phonetic variants that fall back to the user name. The same context feeds the display-side regex scripts, so a Find/Replace using {{user}} matches the character name in Conversation mode too. The Roleplay equivalent (ChatMessage.tsx) passes the user's name as userName, and the server (macro-context.ts) always uses the persona name. In v2.4.4 the same line is at 321.

Suggested fix

In ConversationMessage.tsx, build the macro context from the user's identity for every message: userName (and persona.name) come from the current persona (personaInfo, or the message's stamped persona for user messages), not from displayName. The message header keeps using displayName for the author label. Everything else in the context can stay as is.

Context

Verified on the running app with the API: a seeded assistant message containing {{user}} rendered as "Assistant" in a chat with no characters, while the prompt preview rendered "Alice Active"; the with-character case follows from the same expression. Please verify before fixing.

Originally created by @kolacheee on GitHub (Sep 14, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6208 Originally assigned to: @SpicyMarinara on GitHub. In a Conversation chat, `{{user}}` inside a character's message is displayed with the character's own name (or the literal "Assistant" when the chat has no character) instead of the user's name. The model receives the right text; only what is shown on screen is wrong. Found while investigating an active-persona report; re-verified on `staging` at 14de2d1ad, and the same code is in v2.4.4. ## How to reproduce (try it yourself) 1. Create a persona "Alice" and select it in a Conversation chat (or set it as active and leave the chat without a persona). 2. Get a character message that contains `{{user}}`. The quickest way without a model: give the character a greeting like `Nice to meet you, {{user}}.` and start a Conversation with it, or edit an existing character message to contain `{{user}}`. 3. Compare the rendered message with Peek Prompt. **What you'll see:** the message on screen reads "Nice to meet you, <character name>." With no character in the chat it reads "Nice to meet you, Assistant." Peek Prompt shows the same message as "Nice to meet you, Alice." **What should happen:** `{{user}}` renders as the user's persona name (Alice), the way Roleplay messages already do. ## Where it is At staging 14de2d1ad, `packages/client/src/components/chat/ConversationMessage.tsx`, the `macroContext` memo at lines 333-345: `userName: displayName` (line 335) is the cause. `displayName` (lines 302-308) is the message author's label, so for any non-user message it is `primaryCharInfo?.name ?? "Assistant"`. `{{user}}` resolves from `userName` (`packages/client/src/lib/chat-macros.ts`, `user: userName ?? persona?.name ?? "User"`), so a character message substitutes the speaker's name. The `persona.name: displayName` on line 337 is shadowed by `userName` and does not matter; the persona description/personality/backstory/appearance/scenario fields on the following lines still come from the real persona, so only the name macros are wrong: `{{user}}`, `{{userName}}`, and the phonetic variants that fall back to the user name. The same context feeds the display-side regex scripts, so a Find/Replace using `{{user}}` matches the character name in Conversation mode too. The Roleplay equivalent (`ChatMessage.tsx`) passes the user's name as `userName`, and the server (`macro-context.ts`) always uses the persona name. In v2.4.4 the same line is at 321. ## Suggested fix In `ConversationMessage.tsx`, build the macro context from the user's identity for every message: `userName` (and `persona.name`) come from the current persona (`personaInfo`, or the message's stamped persona for user messages), not from `displayName`. The message header keeps using `displayName` for the author label. Everything else in the context can stay as is. ## Context Verified on the running app with the API: a seeded assistant message containing `{{user}}` rendered as "Assistant" in a chat with no characters, while the prompt preview rendered "Alice Active"; the with-character case follows from the same expression. Please verify before fixing.
bsakaguchi 2026-10-21 06:03:20 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Sep 14, 2026):

Implementation owner: @SpicyMarinara, assisted by Codex. Taking this in the assigned issue sweep. Following the decision in #6206 to retire global active personas; explicit chat selections and stored persona data will be preserved. A linked draft PR is being opened before implementation.

<!-- gh-comment-id:5668436857 --> @SpicyMarinara commented on GitHub (Sep 14, 2026): Implementation owner: @SpicyMarinara, assisted by Codex. Taking this in the assigned issue sweep. Following the decision in #6206 to retire global active personas; explicit chat selections and stored persona data will be preserved. A linked draft PR is being opened before implementation.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 14, 2026):

Fixed in #6212, merged to staging. Conversation now resolves {{user}} from the chat user identity while preserving the speaking character header and earlier user-message persona snapshots. For example, Bob Character saying “Hello {{user}}” in Alice Persona’s chat now displays “Hello Alice Persona.”

The issue was reproduced before the fix. Client/API regressions and the focused desktop Chromium, mobile Chromium, and mobile WebKit flow pass.

<!-- gh-comment-id:5668920354 --> @SpicyMarinara commented on GitHub (Sep 14, 2026): Fixed in #6212, merged to staging. Conversation now resolves {{user}} from the chat user identity while preserving the speaking character header and earlier user-message persona snapshots. For example, Bob Character saying “Hello {{user}}” in Alice Persona’s chat now displays “Hello Alice Persona.” The issue was reproduced before the fix. Client/API regressions and the focused desktop Chromium, mobile Chromium, and mobile WebKit flow pass.
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#3461
No description provided.