[GH-ISSUE #2162] [Issue]: Self-referential character-field macros resolve against the first character in multi-character groups #1072

Closed
opened 2026-10-21 05:26:20 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Romuromylus on GitHub (Jun 4, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2162

Originally assigned to: @cha1latte on GitHub.

Summary

In a multi-character group, the legacy app resolved each character card field through a macro context bound to that specific character, so a self-referential macro such as {{personality}} or {{description}} inside one character's field expanded to that same character's own value. The refactor renders character field values raw and macro-resolves the whole assembled section once against the global (first-character) macro context, so a bare self-reference inside a non-first character's field resolves against the first character.

Expected behavior

A self-referential card macro inside a character's field resolves to that character's own field value, even when multiple characters are active.

Actual behavior

In a multi-character group, a bare unbracketed {{personality}}/{{description}} inside a non-first character's field resolves against the first character's fields. The standard {{user}}/{{char}} macros and the per-character depth-prompt path are unaffected; the refactor's explicit [ ... ] bracket syntax is an opt-in workaround.

Steps to reproduce

  1. Create a group chat with two characters; in the second character's description embed a bare {{personality}}.
  2. Generate; the macro expands to the first character's personality, not the second's.

Impact area

  • React-free engine behavior, contracts, agents, or capability ports

Environment

  • Branch or commit: refactor @ 93555d4b
  • Run mode: Tauri desktop
  • OS + version: Windows 11
  • Node + pnpm versions: n/a (static parity audit, main vs refactor)
  • Rust version, if relevant: n/a
  • Remote Runtime URL configured? not relevant

Regression notes

Worked in legacy (main @ c49f1d95). main: packages/server/src/services/prompt/marker-expander.ts:154-160 (resolveCharacterScopedMacros with per-character profile). refactor @ 93555d4b: src/engine/generation/prompt-assembly.ts:1126-1145 (renderCharacters renders raw values) + :2870 (section resolved against global macros). Narrow/edge-case; self-referential field macros in groups are uncommon and [ ] bracket scoping is available as a workaround.

Originally created by @Romuromylus on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2162 Originally assigned to: @cha1latte on GitHub. ## Summary In a multi-character group, the legacy app resolved each character card field through a macro context bound to that specific character, so a self-referential macro such as `{{personality}}` or `{{description}}` inside one character's field expanded to that same character's own value. The refactor renders character field values raw and macro-resolves the whole assembled section once against the global (first-character) macro context, so a bare self-reference inside a non-first character's field resolves against the first character. ## Expected behavior A self-referential card macro inside a character's field resolves to that character's own field value, even when multiple characters are active. ## Actual behavior In a multi-character group, a bare unbracketed `{{personality}}`/`{{description}}` inside a non-first character's field resolves against the first character's fields. The standard `{{user}}`/`{{char}}` macros and the per-character depth-prompt path are unaffected; the refactor's explicit `[ ... ]` bracket syntax is an opt-in workaround. ## Steps to reproduce 1. Create a group chat with two characters; in the second character's description embed a bare `{{personality}}`. 2. Generate; the macro expands to the first character's personality, not the second's. ## Impact area - [x] React-free engine behavior, contracts, agents, or capability ports ## Environment - Branch or commit: refactor @ 93555d4b - Run mode: Tauri desktop - OS + version: Windows 11 - Node + pnpm versions: n/a (static parity audit, main vs refactor) - Rust version, if relevant: n/a - Remote Runtime URL configured? not relevant ## Regression notes Worked in legacy (main @ c49f1d95). main: `packages/server/src/services/prompt/marker-expander.ts:154-160` (resolveCharacterScopedMacros with per-character profile). refactor @ 93555d4b: `src/engine/generation/prompt-assembly.ts:1126-1145` (renderCharacters renders raw values) + `:2870` (section resolved against global macros). Narrow/edge-case; self-referential field macros in groups are uncommon and `[ ]` bracket scoping is available as a workaround.
bsakaguchi 2026-10-21 05:26:20 +07:00
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#1072
No description provided.