mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #156] [MERGED] Fix {{user}} / {{char}} macro substitution in Game Mode #4485
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#4485
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/156
Author: @Romuromylus
Created: 4/21/2026
Status: ✅ Merged
Merged: 4/21/2026
Merged by: @SpicyMarinara
Base:
main← Head:fix-game-mode-user-macro📝 Commits (2)
21d0798Fix {{user}} / {{char}} macro substitution in Game Mode29487bcMerge branch 'main' into fix-game-mode-user-macro📊 Changes
1 file changed (+28 additions, -3 deletions)
View changed files
📝
packages/client/src/components/game/GameNarration.tsx(+28 -3)📄 Description
Summary
In Game Mode,
{{user}}and{{char}}macros appear literally in the rendered narration instead of resolving to the active persona/character.Root cause
GameNarration.tsxis the rendering chokepoint for Game Mode narration and player-action segments, but it never runs display-time macro replacement. The chat path handles this inChatMessage.tsx(around line 650,text.replaceAll(\"{{user}}\", userName)), andGameNarration.tsxdoes not call into that path. The server-sideresolveMacrosengine doesn't catch it either, since Game Mode replaces the system prompt entirely withbuildGmSystemPrompt(gmCtx)(ingenerate.routes.ts), whose output never goes throughresolveMacros. Net effect:{{user}}/{{char}}survive end-to-end and render verbatim in the UI.This is a missing feature, not a regression — Game Mode shipped without macro display-substitution from v1.5.0 onward.
Fix
Apply the substitution at segment-build time inside the
segmentsandsideLineMapuseMemos inGameNarration.tsx. Doing it there (rather than insideformatNarration) means every downstream render path —formatNarration,animateTextHtml, side-line overlays — receives already-resolved text without changing the renderer's signature.{{user}}→personaInfo.name(fallback"You"), matchingChatMessage.tsx.{{char}}→seg.speakerwhen present, otherwise the first character incharacterMap. Left literal if neither is available.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.