mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7239] [MERGED] fix(memory): characters joining a merged group chat no longer hide earlier memories #7640
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#7640
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/7239
Author: @SpicyMarinara
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/merged-group-newcomer-recall📝 Commits (8)
345fd07fix(memory): characters joining a merged group chat no longer hide earlier memoriesaccf679Merge origin/staging into fix/merged-group-newcomer-recallff64c68fix(memory): check merged recall access and mixed conditions per character643d810fix(memory): read a merged narrator-and-one-character chat as that character3389a1aMerge origin/staging into fix/merged-group-newcomer-recallfbf2a7fMerge origin/staging into fix/merged-group-newcomer-recallbaeb23bfix: apply merged-recall excerpt exclusions to each scene's readersd7cb045Merge origin/staging into fix/merged-group-newcomer-recall📊 Changes
5 files changed (+398 additions, -49 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
docs/agents/memory.md(+2 -0)📝
packages/server/src/services/advanced-memory.ts(+118 -39)📝
packages/shared/src/utils/macro-engine.ts(+14 -4)📝
scripts/regressions/advanced-memory-audience.regression.ts(+263 -6)📄 Description
Linked issue
Closes #7237
Why this change
kociol21 reported on Discord that adding a character around message 930 of a merged group roleplay made Advanced Memory drop earlier memories from the prompt. The summaries were still saved, but their content was gone, even though the original characters should still remember those events.
There were two causes:
recallAudienceMatches). Once someone joined, no earlier scene qualified, so recall returnedno-recall-candidates.renderEntryresolved{{#if char == "…"}}withcharset to whichever character's random id sorted first. That could be the newcomer, so every Chat Summary that Advanced Memory had scoped to the original cast came out empty. Even before anyone joins, private sections were shown or hidden depending on id order, with no mark.Individual group chats recall separately for each responder, which is why this never showed up there.
Mari's design (2026-10-07): "In the merged group chat, this should not be happening. Things should not break. It's always one character responding. So the who-remembers-what is more informative for the model." A merged reply can voice any character, and the model picks the speaker, so no single character exists to check conditions against. The prompt should therefore keep what any present character remembers and say who remembers it.
What changed
recallAudienceMatches(packages/server/src/services/advanced-memory.ts): in merged mode, recall a scene or excerpt when any present non-narrator character is in its audience. Individual mode still needs every responder. Narrator-only scenes still stay out of a mixed group.Scene summary (known only to Maukie, Pantalone):. A scene everyone present remembers keeps the plainScene summary:heading. Each recap is rendered for the present characters who remember it, so its private sections are judged against them.renderEntry: when a merged prompt has two or more present characters, character conditions are no longer checked against one arbitrary character. Each section is kept when at least one present character qualifies for it. When not everyone qualifies, it is marked in place:[Known only to Maukie: …]. Sections only the narrator or absent characters qualify for are dropped. Whatever scoping leaves, such as a name mixed with a variable or{{char}}, is rendered once for each present character and marked the same way.renderEntrychecks a merged chat of the narrator and one other character as that character. It used to use whichever id sorted first, so when that was the narrator, narrator-only sections reached the shared prompt and the character's own sections were dropped.scopeCharacterSummary(packages/shared/src/utils/macro-engine.ts) takes an optionalmarkcallback. It reuses the existing branch evaluation, but each part goes to the callback instead of being wrapped in a{{#if char == …}}guard. Existing callers are unchanged.docs/agents/memory.md, and a CHANGELOG entry. Translation follow-up: #7238.Prompt text, before and after
Merged chat with Maukie and Pantalone, after Cara joins (her id sorts first):
Before (staging):
After:
Existing test assertion changed
In
scripts/regressions/advanced-memory-audience.regression.ts, the"shared"(merged) iteration of the"a mixed group cannot use narrator privilege for absent characters"check encoded the old merged rule: a scene was hidden unless everyone present had been there. Mari is replacing that rule, so this one expectation now also includes Maukie's own scene in merged mode. A comment explains the decision.The individual iteration keeps
[at(2), at(4)]. The narrator-only sceneat(6)stays excluded in both modes, so the assertion still checks that a mixed group gets no narrator privilege. No other assertion was changed.New regression coverage (same file)
A merged chat with Maukie, Pantalone and a narrator. Cara joins later, and her id (
aaa-newcomer) sorts first.a merged group recalls what any present character remembers.renderEntryfix it fails atthe duo's summary is read as Maukie.Review notes
Local CodeRabbit and the GitHub CodeRabbit review raised the same two findings. I first declined both, then fixed both in
ff64c6885after the orchestrator's review. Both now have regressions that failed before the fix.renderEntryrenders whatever scoping leaves, such as{{#if char == "Maukie" && getvar::ready == "yes"}}or{{char}}, once for each present character, using the chat variables. Each result is marked with who gets it, for example[Known only to Maukie: MIXED_SECRET]. Theponytail:ceiling comment was removed because that limit is now handled.Known limitation, not changed here
sceneVisibility()hashes the visibility of every chat character, so adding any character changes the saved visibility check of every scene that has a message hidden from someone. Until the next preparation summarizes those scenes again (one helper call per scene), a character who could see only part of such a scene is not named as remembering it. A scene where nobody could see every message is left out entirely. The same happens onstagingand in Individual group chats, and fixing it means changing the saved visibility format, so it needs its own issue.Validation
pnpm checkpasses locallyCONTRIBUTING.mdCommands the agent ran:
pnpm check: passed.node scripts/run-regressions.mjs --filter advanced-memory): passed.pnpm regression:prompt: passed.memory-recall-exclusivity,roleplay-user-private-memory,chat-branch-lineageandcapability-gm-verbsregressions: passed.pnpm regression(before the review fixes): 534/535 passed. The one failure,termux-sharp.regression.mjs, is environmental:ERR_PNPM_NO_OFFLINE_TARBALLfor@emnapi/runtime, because the offline store lacks that tarball. It is unrelated to this change.pnpm regression:prompt, the four related regressions andpnpm checkpassed again.roleplay-user-private-memory,native-export-memory,pnpm regression:promptandpnpm checkpassed. Prompt output for Individual chats, one-character chats, impersonation and narrator-only recall matchedstagingbyte for byte.Manual verification notes
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)docs/agents/memory.mdgains one paragraph, andCHANGELOG.mdgains an entry under[Unreleased]. Translation follow-up: #7238.UI evidence (if applicable)
No UI change. This changes prompt text only; see the before and after above.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.