mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3344] [Bug]: Native export double-counts a character's/persona's embedded lorebook (character_book + re-linked standalone) #1813
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#1813
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 (Jul 7, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3344
Summary
Native (
.marinara.json) export of a character (or persona) whose lorebook is embedded — i.e. it has adata.character_bookand a standalone linked copy (the "Edit Linked Lorebook" state you get after clicking Import Embedded Lorebook) — now includes that lorebook twice: once ascharacter_bookin the card data, and once as a bundled standalone. #3342 added the bundle vialistByCharacter, which doesn't exclude the character's own embedded copy. On import this produces a duplicated, confusing state.Expected behavior
The lorebook is represented once. A character's embedded lorebook is already carried by
character_book, so the native export bundle should exclude the standalone that corresponds to it — the one whose id ===data.extensions.importMetadata.embeddedLorebook.lorebookId.Actual behavior
The export envelope contains both
data.character_bookand alorebooks: [{ lorebook, entries, folders }]bundle for the same lorebook. On native import the imported character ends up with:character_bookentries (shown in the Lorebook tab), plusimportMetadata.embeddedLorebook.lorebookIdpointing at the old (now non-existent) standalone id, plusIt is not a runtime double-injection —
character_bookhas no prompt-scan consumer server-side (only the standalone activates, via its character link) — so it's survivable, but it's a duplicated/confusing imported state that invites extra copies.Steps to reproduce
.marinara.json:data.character_bookand a top-levellorebooksbundle both contain the lorebook.Environment
bb26008b9)Logs, screenshots, or video
N/A (data-shape issue). Code refs:
readAttachedLorebooksForCharacter/readAttachedLorebooksForPersona/readLorebookBundles(packages/server/src/routes/characters.routes.ts) calllistByCharacter/listByPersona(packages/server/src/services/storage/lorebooks.storage.ts), neither of which excludes the embedded standalone;buildNativeCharacterEnvelopethen serializes bothdata.character_bookand the bundle.Additional context
Introduced by #3342 (native lorebook export). Suggested fix: in
readLorebookBundles(or the two callers), skip the lorebook whose id === the owner'simportMetadata.embeddedLorebook.lorebookId, so an embedded lorebook is carried only once (ascharacter_book). This also keeps the native export coherent with the Embed into card work in #3341 / #3343, which writescharacter_book+ links a standalone and would hit the same double-count under #3342.Template check
@kolacheee commented on GitHub (Jul 7, 2026):
Superseded by #3345. On clarification: linked (assigned) lorebooks are not supposed to export at all — only the embedded
character_bookshould travel with a card. So the correct fix is not "exclude the embedded standalone from the bundle" (this issue's suggestion, which keeps the linked bundle) but removing the linked-lorebook bundling from native export entirely (#3345). The embedded double-count described here is just one symptom of exporting linked lorebooks at all, so #3345's fix resolves it too. Closing in favor of #3345.