mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2702] [Issue]: Marinara chat jsonl export→import silently deletes narrator/system messages, drops swipes and per-message metadata #1347
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#1347
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 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2702
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Marinara's own chat export→import (the "SillyTavern-compatible"
.jsonl) is lossy in several ways, the worst being that re-importing an exported chat silently deletes every narrator and/sys(system) message. Swipes, message metadata (reasoning/model/tokens/attachments), and branch identity are also lost.Expected behavior
Exporting a Marinara chat to
.jsonland re-importing it should reproduce the chat faithfully — all messages (including narrator/system), all swipes, and per-message metadata.Actual behavior
serializeChatTranscriptwritesis_system: msg.role === "system" || msg.role === "narrator"— so narrator rows are exported asis_system:true. The Marinara jsonl importer then runsif (stMsg.is_system && !stMsg.is_user) continue;, discarding exactly those rows. Export→import drops every narrator message (often the bulk of RP scene text) and every/sysmessage.mes: msg.content(the active swipe) with noswipes[]/swipe_id; the importer has no swipe handling. All regenerated alternate swipes are lost on export, and multi-swipe messages collapse to one on import.mesdiscarded for regex display_text. When a message has a regexdisplay_text, the importer keeps the display text and discards the originalmes.chat_metadata: {}and emits no per-messageextra, so branch name, reasoning blocks, model/token usage, and attachments are dropped.How it breaks the pipeline
Code trace (staging @
b826f8f4):packages/server/src/routes/chats.routes.ts:2272-2273(is_user/is_system; narrator→is_system:true). Import:packages/server/src/services/import/st-chat.importer.ts:153(if (stMsg.is_system && !stMsg.is_user) continue;). Round-trip wired viaimport.routes.ts:508/:584. Roles enum:shared/types/chat.ts:48.mes: msg.content(chats.routes.ts:2274), no swipes; import reads onlymes/extra.display_text(st-chat.importer.ts:156). Swipe storage exists (chats.storage.ts,getSwipes).display_texthandling (st-chat.importer.ts:156).chat_metadata: {}(chats.routes.ts:2264); per-message object (:2270-2276) omitsextra; richextrapersisted atchats.storage.ts:624,688-746.Steps to reproduce
/sys) message → Export as jsonl → Import that exact file → the narrator/system messages are gone.chat_metadatais{}and no message carries reasoning/model/attachment data.Suggested fix
extra.type='narrator'or arolefield) so the importer can reconstruct it, and/or make the importer not unconditionally dropis_systemrows that carry recoverable role info. Round-trip the role explicitly.swipes: [...],swipe_id: <active>) and teach the importer to recreate them via the swipe storage APIs.mes(store both raw anddisplay_text) so the regex original isn't lost.chat_metadata(at least{ branchName }) and a per-messageextra(reasoning/model/tokens/attachment refs); have the importer read them back.Environment
b826f8f4)Additional context
Found via a systematic multi-agent audit of import/export round-trips. (1) is the highest-severity finding in the audit — Marinara's own export→import silently deletes user content. Part of a set of import/export fidelity issues filed together.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jun 21, 2026):
Fixed on the issue sweep branch. Marinara JSONL export now writes explicit message roles, branch/chat metadata, per-message extra, swipe contents, active swipe index, and per-swipe metadata. Import now preserves narrator/system messages instead of dropping pure system rows, keeps mes as canonical content while translating display_text into display metadata, and restores swipes/active swipe/metadata through the existing batch storage path. Final pnpm validation is deferred until the full sweep is complete.