mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3022] [Issue]: Conversation-mode generation permanently deletes character memories older than today, destroying "permanent" scene memories and breaking weekly schedule continuity #1592
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#1592
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?
Originally created by @kolacheee on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3022
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
Every conversation-mode generation silently and permanently deletes any character memory created on a previous calendar day. These memories are explicitly created as permanent — scene-conclusion memories ("[Scene on ...]") and in-chat
[memory]commands — and other features depend on them lasting for at least a week. After the first next-day conversation generation, a character's prior-day memories are gone from durable storage, and weekly schedule continuity stops working.How to reproduce (try it yourself)
[memory:]command, socharacter.extensions.characterMemoriesgets an entry withcreatedAt= yesterday.characterMemories.You'll see: the prior-day memory is permanently gone;
mergeConversationCharacterMemoriescomputedvalidMemories = []and wrote the pruned (empty) array back viachars.update. Subsequent weekly-schedule regeneration no longer sees it.Expected: same-day memories surface in the prompt's
<awareness>block, but stored memories are left intact so scene history, the[memory]command, and schedule continuity keep working.Where it is
packages/server/src/services/generation/conversation-memory-context.ts:44-48— line 44 filters to today-or-newer (validMemories), and lines 45-48 write that pruned list back to durable storage viachars.update. The function spans lines 15-62; the emit loop is 50-52.Supporting:
chars.update->mergeCharacterData(packages/server/src/services/storage/characters.storage.ts:47-67) overwrites the array becausemergeExtensionsdefaults to true, and persists viaJSON.stringify(lines 203-249). Sole caller:generate.routes.ts:4354-4360(gated onchatMode === "conversation"). Durable producers:scene.routes.ts:437-459,generate.routes.ts:9638-9653. Broken consumer:buildScheduleContinuityContextatconversation.routes.ts:326-338, which reads back to the start of the previous week.What's happening
The function conflates "which memories to surface in today's awareness block" with "which memories to keep in storage." The today-midnight cutoff is correctly used to choose prompt lines, but the same filtered array is also persisted back to the character store. Because the memories carry full ISO timestamps from arbitrary prior days and are treated as durable by the rest of the system, writing the pruned array back is data loss, not a view filter.
Suggested fix
Delete the storage write-back; keep the today filter as an in-prompt freshness selector only. In
packages/server/src/services/generation/conversation-memory-context.ts, remove lines 45-48:Keep line 44 (
const validMemories = memories.filter((memory) => new Date(memory.createdAt) >= today);) and the emit loop at 50-52 unchanged, so only same-day memories still surface in the<awareness>## Memories section while the stored array is left intact. This is the minimal surgical change; nothing in the system depends on the destructive write-back. Do not substitute a different retention/pruning policy here — durable retention is not this function's responsibility, and any destructive policy risks the same data loss against scene history and the[memory]command.AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed on staging in PR #3031 (merged as
f542e282). Closing manually because GitHub auto-close keywords only close issues when merged into the default branch (main), not staging.