mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7275] [MERGED] feat(memory): let the Helper combine related summaries when compacting #7658
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#7658
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/7275
Author: @SpicyMarinara
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @SpicyMarinara
Base:
staging← Head:feat/compaction-combine-summaries📝 Commits (7)
b887afffeat(memory): let the Helper combine summaries with private sections when compactingec9044dMerge remote-tracking branch 'origin/staging' into feat/compaction-combine-summariesd49b6e0Merge origin/staging into feat/compaction-combine-summaries813b2bffix(memory): reject a combined summary that copies a private sentence into shared text0aaa4cdMerge remote-tracking branch 'origin/feat/compaction-combine-summaries' into feat/compaction-combine-summaries11a0693Merge origin/staging into feat/compaction-combine-summaries892ef8dMerge origin/staging into feat/compaction-combine-summaries📊 Changes
4 files changed (+232 additions, -14 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
docs/agents/memory.md(+1 -1)📝
packages/server/src/services/advanced-memory.ts(+72 -12)📝
scripts/regressions/advanced-memory-post-generation.regression.ts(+158 -1)📄 Description
Linked issue
Closes #7270
Why this change
{{#if char == "Name"}}…{{/if}}section. Advanced Memory's own scene recaps put private facts in exactly those sections, so in group chats most constants were never combined or shortened. In merged group chats every summary with a character condition was skipped. A character could stay over the 70% share while later replies kept paying to shorten the plain summaries again.What changed
packages/server/src/services/advanced-memory.ts(updateConstantSummariesAfterGeneration):origin: "automated"), nobody changed it since (createdAt === updatedAt), and its sections differ only by character conditions. That group is sent with its conditions kept. The group's plain summaries are wrapped in the group's own reader condition. Summaries you wrote or edited, legacy summaries, and templates with other macros stay skipped, as before.summarize()getskeepConditions: one sentence added after the existing Combine prompt. Debug prompt logging (logDebugOverride,debugMode/DEBUG_AGENTS) is unchanged and shows it.scopeCharacterSummary's reader callback): the same groups of readers, none dropped, none added, no other macros, and no private sentence of four or more words copied into a section more characters read. If any check fails, nothing is saved, a Pino warning is logged, the paid result stays cached (no repeat for the same summaries), and the group's plain summaries are shortened on their own exactly as before. A reworded private fact moved into a wider section cannot be caught this way (ponytail:note in the code).combineChatSummaryEntryHistory, cache cleared.docs/agents/memory.md,CHANGELOG.md. Translation follow-up: #7274.Before / after (regression fixture: Maukie + Pantalone, budget 1000 → 700 share)
Entries:
{{#if char == "Maukie" || "Pantalone"}}SHARED_WALK… {{#if char == "Maukie"}}MAUKIE_SECRET hid the key.{{/if}}{{/if}}(#1) and{{#if char == "Maukie" || "Pantalone"}}SHARED_TWO…{{/if}}(#2), both automated.Before (
origin/staging): one call. The user message is onlySHARED_TWO …, the target is 333 tokens, and the #1 recap is never sent or shortened.After: one call. The system prompt ends:
User message:
Saved as one automated entry, Messages #1–#2, with both sources inactive:
Maukie's prepared memory includes the secret; Pantalone's does not.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdAgent-run checks (for the reviewer to confirm, not proof):
scripts/regressions/advanced-memory-post-generation.regression.ts(fake Helper that records prompts) fails onorigin/stagingand passes here. It covers: one combine call with the raw condition and Combine prompt; combined entry IDs, range and title; per-character recall; no further calls once within budget; a result that copies the private sentence into shared text rejected, with the template unchanged while the plain summary is still shortened; a result that drops the private section rejected and not paid for again; a hand-edited summary left alone; merged group chats.advanced-memory-*,memory-recall-*,conversation-summary,merged-chat-summary,semantic-summary-*,roleplay-regeneration-context,roleplay-interrupt-generationregressions;pnpm regression:prompt;pnpm check.Local CodeRabbit (
coderabbit review --agent --committed): 1 finding (major), asking for a fact-level guard so a private sentence copied into shared text is rejected. Valid. Fixed in813b2bff0, with a regression case that fails without the guard. GitHub CodeRabbit re-reviewed the fixed code and asked for reworded private facts to be caught too. I didn't change that: it needs a second paid model call, and the Helper already gets the same trust, unchecked, when it writes scene recaps. Reasoning is in the thread, which is left open for the maintainer's call.Manual verification notes
{{#if char == "Name"}}section in their Chat Summary, so the constants pass 70% of Summary and recall budget. After the next reply, check that Chat Summaries shows one new Messages #a–#b entry replacing the summaries the same characters read, with every private section still under its original character condition.DEBUG_AGENTS=true) that the server log shows the compaction prompt with the Combine prompt and the "Keep each fact inside a section with exactly its original condition" sentence.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.mdandCHANGELOG.mdupdated; translation follow-up #7274.UI evidence (if applicable)
No UI change.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.