mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7373] [MERGED] fix(memory): end Decision-model scenes and add Re-scan scenes #7704
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#7704
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/7373
Author: @SpicyMarinara
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/memory-scene-cuts-rescan📝 Commits (3)
5a65cf7fix(memory): end Decision-model scenes and add a range re-scanb2b5539docs(memory): describe scene cuts and Re-scan scenesa848c35fix(memory): make re-scans safe to stop and refuse protected scenes📊 Changes
11 files changed (+448 additions, -157 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
docs/agents/memory.md(+6 -2)📝
packages/client/src/components/chat/AdvancedMemorySettings.tsx(+69 -0)📝
packages/client/src/hooks/use-advanced-memory.ts(+3 -0)📝
packages/client/src/localization/locales/en.json(+6 -0)📝
packages/server/src/routes/advanced-memory.routes.ts(+9 -0)📝
packages/server/src/services/advanced-memory-decisions.ts(+58 -24)📝
packages/server/src/services/advanced-memory.ts(+147 -92)📝
packages/shared/src/types/advanced-memory.ts(+1 -1)📝
scripts/regressions/advanced-memory-decisions.regression.ts(+145 -32)📝
scripts/regressions/advanced-memory-post-generation.regression.ts(+2 -6)📄 Description
Linked issue
Closes #7371
Why this change
With Use Decision model on (hosted Jev), Advanced Memory never ended a scene. In the reporting chat, the open scene ran from #1162 to #1260 with no summary, while the status said Memory Ready. That range had a
***scene break with a POV switch, an out-of-character "POV switch" note and several location changes.I replayed the production questions against hosted Jev on that chat's real messages: 158 requests, which reproduce the saved diagnostics within ±0.03. The cause was three things together, and none of it is a regression; it has been this way since #6750.
***+ POV switch (→1245)Two numbers per row are two different check alignments.
backend.calibration.defaultThreshold(0.5 for System One, 0.1 for the Open-Jev sidecar), which every other Decision gate uses. No real transition reached 0.8 with the old question.The maintainer's chat also needs its backlog fixed, and nothing could re-check a range while the status said Ready. A full preparation run had already marked #1162–#1199 as classified, using the 0.8 cut-off.
What changed
detectDecisionSceneStartsreplacesdetectDecisionSceneBoundaries. It asks one measured question per message: does this message cut to a new scene (another place or time, characters elsewhere, a***line or OOC POV note)? It asks in groups of 5, each after the 3 messages before it, with speaker names. It uses the backend's own threshold. Diagnostics rows arescene_start("Scene start").classify()(history preparation) sends speakers and uses the new question and threshold.POST …/advanced-memory/initializetakesrange: {start, end}(message numbers). The preparation run re-detects boundaries strictly inside the range, keeps every boundary outside it, and summarizes the scenes that changed. Unchanged summaries are reused. Classifier and reply-cadence checkpoints are left alone. Like Fix, it waits for running work instead of joining it. It is refused before history is prepared or for an out-of-range number. A hand-edited summary whose scene would change stops it with the existing review error.docs/agents/memory.md) and CHANGELOG. Translations follow in #7372.Out of scope, possible follow-ups: when one turn adds more messages than the scene-check interval, the oldest unchecked ones are still never candidates. The Helper scene check (
SCENE_CHECK_PROMPT) keeps its own seam blind spot. Both would change the "exactly N recent messages" behaviour chosen in #6499, so I left them for a decision.Validation
pnpm checkpasses locallyCONTRIBUTING.mdAutomated evidence (the boxes above are for a human):
pnpm checkpassed locally (localization, formatting, lint, types, full build).advanced-memory-decisionsregression: an unlikely cut (0.3) leaves the scene open. A 0.6 cut is selected on a 0.5 System One threshold; the old code required 0.8. The request carries the 3 earlier messages with speakers. A cut at the first checked message closes the scene on the previous check's last message (the seam). Re-scan splits a previously missed cut into its own summarized scene, keeps outside summaries byte-identical, keeps the boundary after the range, and leavessceneCheckMessageIdalone. An out-of-range number is refused.advanced-memory-post-generationregression passes; its wording assertion now expects the cut question.calibrationevery real backend has.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)Two CHANGELOG entries, a new docs section, follow-up #7372 for translations.
UI evidence (if applicable)
Not captured yet; see the manual checks above.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.