mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7277] [MERGED] fix(memory): include decision-picked message excerpts and say why when they are left out #7657
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#7657
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/7277
Author: @SpicyMarinara
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/decision-recall-excerpts📝 Commits (3)
2077832fix(memory): include decision-picked message excerpts and say why when they are left out439f72aMerge remote-tracking branch 'origin/staging' into fix/decision-recall-excerptsd780bf8Merge origin/staging into fix/decision-recall-excerpts📊 Changes
8 files changed (+180 additions, -47 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
docs/agents/memory.md(+4 -4)📝
packages/client/src/components/chat/AdvancedMemoryInspector.tsx(+4 -1)📝
packages/client/src/components/chat/DecisionDebugPanel.tsx(+6 -0)📝
packages/client/src/localization/locales/en.json(+3 -0)📝
packages/server/src/services/advanced-memory.ts(+82 -42)📝
packages/shared/src/types/advanced-memory.ts(+2 -0)📝
scripts/regressions/advanced-memory-decisions.regression.ts(+78 -0)📄 Description
Linked issue
Closes #7269
Why this change
Mari, testing Advanced Memory with Use Decision model on (min 1, max 2 messages per excerpt): "three scene summaries were correctly picked, but none of them had any message excerpts included … I just want to be sure that everything works correctly."
Tracing the recall path found one real bug and one missing explanation:
Math.ceil(score). The Decision model's score is a 0..1 probability, so every excerpt held exactly Minimum messages per excerpt (at least one). Maximum was ignored. The model's other picks were thrown away and shown as Not selected in Decision diagnostics. Text matching (Decision off or failed) already reached Maximum, so Decision recall gave shorter excerpts than ordinary recall.{{#if char == "Name"}}parts. Each character still gets only their parts of the summary, but the raw messages stay narrator-only, because they can hold facts the summary kept from that character. In a group chat where characters reply one by one, the helper writes these sections, so this is the most likely cause of Mari's zero excerpts.Fixing only the size would make things worse in one way: a longer first excerpt could leave the next scene without its minimum. So every recalled scene now gets its minimum before any excerpt grows.
What changed
packages/server/src/services/advanced-memory.ts(recall excerpt build only):excerpt-no-room,excerpt-private-sceneorexcerpt-no-source. None is added when Maximum is 0 or Minimum 0 made the excerpt optional.decision-excerpt-fallback, asnotes. They are fixed codes with no names, section text or message text.packages/shared/src/types/advanced-memory.ts: optionalnoteson the saved Decision diagnostics, so older saved reports stay valid.AdvancedMemoryInspector.tsx/DecisionDebugPanel.tsx/en.json: the memory receipt and Peek Prompt → Decision diagnostics show the three new reasons in plain words. The panel reuses the receipt's reason keys.canRecallExcerpt(narrator-only raw excerpts from conditional recaps). Relaxing it, even only for readers who see every section, breaks the intent of three existing regressions (advanced-memory-summary.regression.ts"matching the narrator's recap text does not grant a character access to raw private source messages",advanced-memory-decisions.regression.ts"private recap conditions withhold raw excerpts", and the duo case inadvanced-memory-audience.regression.ts). That is a policy decision for Mari, so the receipt now says it happened instead.Before / after (regression fixture: 2 recalled scenes, the Decision model picks messages #3–#4 and #8–#9, min 1 / max 2)
Before (
origin/staging), recalled prompt block:Decision diagnostics: #4 and #9 scored 0.99 but were Not selected.
After:
Decision diagnostics: all four picks Selected.
Receipt reasons:
decision-recalldecision-recall,excerpt-no-room("Some recalled scenes have no message excerpt because no room was left after the summaries. Raise Summary and recall budget or lower Maximum recalled scenes to make room.")decision-recalldecision-recall,excerpt-private-scene("…their summaries have parts meant only for some characters. Each character still gets the parts meant for them, but only the narrator gets the original messages.")Validation
pnpm checkpasses locallyCONTRIBUTING.mdCommands the agent ran (results for the reviewer to confirm, not ticked boxes):
pnpm check: exit 0.node ./scripts/run-regressions.mjs --filter advanced-memory: 15/15 passed.--filter memory-recall5/5,--filter summary5/5,roleplay-user-private-memory1/1,native-export-memory1/1,pnpm regression:promptpassed.scripts/regressions/advanced-memory-decisions.regression.ts(added only; no existing assert changed) fail onorigin/staging. Removing the minimum-first pass also makes them fail.Manual verification notes
{{#if char == "Name"}}part: the summary still shows each character only their parts, the excerpt is missing for non-narrators, and the receipt and Decision diagnostics show the "parts meant only for some characters" reason.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.md(Moving context, Optional Decision model) andCHANGELOG.md[Unreleased]are updated. Translation follow-up: #7276.UI evidence (if applicable)
New text lines only, in the existing receipt list and Decision diagnostics recall section; no layout or colour change.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.