mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8800] [MERGED] fix(roleplay): keep merged narrator avatars on the roster each reply was written with #8813
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#8813
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/8800
Author: @SpicyMarinara
Created: 11/3/2026
Status: ✅ Merged
Merged: 11/4/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/merged-chat-historical-avatars📝 Commits (5)
f6f38a2fix(roleplay): keep merged narrator avatars on the roster each reply was written with7b1a86cfix(roleplay): keep inactive members off older merged replies and hold the roster through Continue10953f4fix(roleplay): keep an older merged reply's expression avatars through Continuee40b11cfix(roleplay): keep departed members on a continued merged reply's roster6ea7473fix(roleplay): keep a continued reply's roster in a chat left with one member📊 Changes
9 files changed (+433 additions, -6 deletions)
View changed files
📝
packages/client/src/components/chat/ChatMessage.tsx(+12 -3)📝
packages/client/src/components/chat/ChatRoleplaySurface.tsx(+5 -2)➕
packages/client/src/components/chat/merged-avatar-roster.ts(+38 -0)📝
packages/server/src/routes/generate.routes.ts(+17 -0)📝
packages/shared/src/index.ts(+1 -0)📝
packages/shared/src/types/chat.ts(+2 -0)➕
packages/shared/src/utils/merged-avatar-roster.ts(+22 -0)➕
scripts/regressions/merged-chat-historical-avatars.regression.ts(+335 -0)📝
scripts/regressions/open-issues.regression.ts(+1 -1)📄 Description
Linked issue
Closes #8762
Why this change
In merged Roleplay group chats with automatic active-character selection, older replies lost avatars whenever the roster changed (#8762). Every reply took its avatars from the chat's current active roster. When auto-selection narrowed the scene to one character, every older reply showed only that avatar. Turning selection off did not bring the others back, even though those replies still carry speaker tags and per-character expression data for everyone. Auto-selection should affect only later generations: an older reply should keep the avatars it was generated with. It must also keep the rule from
7a2d104e94that merged Narrator avatars never show inactive Roleplay characters.What changed
Merged Roleplay replies now save the active roster they were generated with (
mergedRosterCharacterIds, per swipe), after automatic selection runs. Continue keeps the reply's own roster and adds the current one. Non-merged replies save an empty list, and every part of a split reply gets a copy.ChatMessage picks merged narrator avatars through a new pure helper,
resolveMergedAvatarRoster. A saved reply keeps its saved roster.Replies saved before this change show the chat members their own expression data names (
expressionSpriteIdsand thespriteExpressionskeys, which are character IDs), plus the live roster, and a Continue keeps them. Lost avatars come back, and inactive members still stay hidden. A new shared helper,mergedReplyRosterin packages/shared, works out a reply's own roster. That is its saved roster, or for an older reply the chat members its expression data names. Three places use it: the server's Continue merge, the Continue stream in RegeneratingMessageContent, andresolveMergedAvatarRoster.A streaming reply follows the live roster. A Continue streams with the reply's own roster plus the live one, which is exactly what the server saves, so nothing drops or jumps. A regeneration streams with the old swipe's roster cleared, so it follows the live roster.
Added the
scripts/regressions/merged-chat-historical-avatars.regression.tsregression. It narrows the roster through real Character Tracker auto-selection. It covers Continue, non-merged replies, and Continue and regeneration of both kinds of older reply (an expression sprite list, andspriteExpressionskeys only) with the roster narrowed, checking both what the stream shows and what the server saves. One assertion message in open-issues.regression.ts was updated to describe the new behaviour.Continue keeps a reply's saved roster as saved, including characters who have left the chat since. A reply continued while a character was out shows them again once they are added back (Dottore Review on #8800). This holds even when a character's leaving takes a merged chat down to one member, which is no longer a merged group. In that case Continue keeps the saved roster instead of clearing it. A new reply or a regeneration there still saves none, so no swipe inherits a stale one.
mergedReplyRosterreturns the savedmergedRosterCharacterIdswithout filtering them to current members. Only a reply with no saved roster (saved before this change, or saved outside a merged group) falls back to its expression data. That fallback still returns only chat members, never the persona or a non-member. An older reply continued in a one-member chat keeps no roster, so its expression data keeps deciding, rather than being pinned to the one remaining member.The server's Continue merge, every part of a split reply, and the Continue stream in RegeneratingMessageContent use the same rule, so the stream still matches what gets saved. The client still shows only current chat members, so a departed character stays hidden until they rejoin. A saved roster whose characters have all left the chat shows the live roster, the same as after a Continue.
The regression covers two cases:
It checks that Ben stays on the saved roster and that the older reply stays without one. It checks that Ben is hidden while he is out and shows again once he is back. (This replaces the earlier wording that
mergedReplyRoster"returns only chat members".)Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Agent-run checks (for reference; the regression was shown to fail without each part of the fix):
node ./scripts/pnpm-runner.mjs build:shared: passnode ./scripts/run-regressions.mjs --filter merged-chat-historical-avatars: 1/1 passed with the fix. Failed in each of the 9 fails-before cases (server from staging, helper with whole-chat fallback, helper with live-only fallback, live branch ignoring the saved roster, ChatRoleplaySurface without clearing, ChatMessage from staging, helper removed, generate.routes.ts from7b1a86c458, ChatRoleplaySurface.tsx from7b1a86c458); every file restored and confirmed with cmp.PLAYWRIGHT_ONLY_PROJECT=desktop PLAYWRIGHT_CLIENT_PORT=5388 PLAYWRIGHT_SERVER_PORT=7988 PLAYWRIGHT_MOBILE_CLIENT_PORT=5389 PLAYWRIGHT_MOBILE_SERVER_PORT=7989 np: 6/6 passed (run before and after the final commit)PLAYWRIGHT_ONLY_PROJECT=mobile ... npx playwright test e2e/narrator-macro-avatars.e2e.ts --project=mobile-chromium --project=mobile-webkit: 2 passed (the inactive-member test on both mobile projects), 10 desktop-only cases skipped by the specnode ./scripts/run-regressions.mjs --filter merged / open-issues / character-id-macro / active-character / narrator-avatar / scene-presence / avatar / group / e: 4/4, 1/1, 1/1, 1/1, 1/1, 1/1, 27/27, 11/11, 3/3 passedcd packages/client && node ../../scripts/pnpm-runner.mjs exec tsc --noEmit -p .: exit 0cd packages/client && node ../../scripts/pnpm-runner.mjs exec eslint src/components/chat/ChatMessage.tsx src/components/chat/merged-avatar-roster.ts src/compone: exit 0cd packages/server && node ../../scripts/pnpm-runner.mjs run lint: exit 0npx prettier --check <all 7 changed files>: all formattedIndependent adversarial review: changes (1 blocker, 3 minor), all addressed in
7b1a86c458. Dottore Review (LOW, Continue on an older reply) addressed in10953f4187; a second independent review of that commit asked for 3 PR-text corrections, applied here. Fullpnpm checkpassed on10953f4187. Dottore Review (LOW, Continue dropped characters who had left the chat) addressed ine40b11cac3; a third independent review found Continue still cleared the roster in a chat left with one member, fixed in6ea7473d86with a regression that fails without it.Known limits and risks:
ponytail:): replies saved before this change have no saved roster. They show their expression-data characters plus the live roster, and a Continue keeps those expression-data characters.expressionSpriteIdsand thespriteExpressionskeys, as the Dottore suggestion asked. A retried Expression Engine run with an empty result writes an emptyexpressionSpriteIdsbut leaves the earlierspriteExpressionsmap in place. Such a reply still shows the chat members of its earlier expression result, and keeps them through Continue. The sprite display treats the list as final, but this fallback does not.everyPartcopy asreferencedCharacterIds; I checked that by reading the code.mergedRosterCharacterIds: []on non-merged replies, the same way it already writesreferencedCharacterIds.e2e/narrator-macro-avatars.e2e.tsran in Playwright but does not exercise Continue, and no other browser check was done. The Playwright data directory.tmp/playwright-datain the worktree is gitignored.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.