mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1778] [Issue]: Prompt snapshots are never evicted — unbounded per-chat storage growth (regression vs 1.6.1, all modes) #861
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#861
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 @JorgeLTE on GitHub (Jun 1, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1778
Originally assigned to: @JorgeLTE on GitHub.
Summary
In the refactor, a full generation prompt snapshot is saved on every assistant message (and every swipe) and is never evicted, so per-chat storage grows without bound. v1.6.1 kept the snapshot only for the last 2 assistant messages; that eviction was dropped during the migration.
Expected behavior
Match v1.6.1: retain the saved prompt snapshot only for the most recent assistant messages (last 2). Older messages keep their text but drop the snapshot, and the prompt inspector shows "No saved prompt snapshot" for them.
Actual behavior
Every assistant message keeps its full prompt snapshot forever, in all three modes (conversation, roleplay, game). Because each snapshot embeds the entire assembled prompt up to that point (system + cards + lorebook + full history-to-date), storage grows roughly quadratically with conversation length, and the per-message
generationPromptSnapshotsBySwipemap plus per-swipe copies compound it. This bloats the local DB and especially the Download Backup. (Imported 1.6.1 chats are unaffected — 1.6.1 already evicted to last-2 before export.)Steps to reproduce
extra.generationPromptSnapshot(and agenerationPromptSnapshotsBySwipemap), and backup size grows disproportionately with chat length.Environment
Logs, screenshots, or video
N/A — observable as growing DB / backup size and as old messages retaining inspectable prompts.
Additional context
Root cause: v1.6.1 evicted
extra.cachedPromptfrom all but the last 2 assistant messages on every generation (generate.routes.ts:8103), inside the shared persistence block (not mode-gated, so it applied to all three modes). The refactor renamed the field toextra.generationPromptSnapshot/generationPromptSnapshotsBySwipebut never ported the eviction, so native chats accumulate a snapshot per message and per swipe.Separately noted:
generationPromptSnapshotsBySwipeis written on every generation but stripped from every read path that reaches the inspector (Rust timeline whitelist + TSsanitizeTimelineMessageRecord/savedGenerationEventData), so it is effectively vestigial/half-wired — a candidate for a separate cleanup.Fix: re-introduce v1.6.1's keep-last-2 eviction at the shared generation-commit path, clearing snapshots from older assistant messages (message extra + by-swipe map + each swipe's extra), non-destructive to legacy
cachedPrompt.Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@JorgeLTE commented on GitHub (Jun 1, 2026):
Merged!