mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3359] [Issue]: No way to unembed a character lorebook; 🗑️ only unlinks; "Edit Linked Lorebook" edits the embedded copy #1818
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#1818
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 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3359
Originally assigned to: @kolacheee on GitHub.
Summary
The Character editor's Lorebook tab has no way to unembed a lorebook, and its embedded-vs-linked affordances are confusing. Once a lorebook is embedded in a card (
data.character_book), the row's 🗑️ button only unlinks the standalone copy — it does not clearcharacter_book, so the embedded lorebook silently persists in the card (still listed, still exports). Separately, "Edit Linked Lorebook" opens the standalone mirror, which — because it is kept in sync withcharacter_book— reads as "editing the embedded lorebook," so the linked-vs-embedded distinction is unclear.Expected behavior
character_book), available whenevercharacter_bookis present.Actual behavior
No unembed affordance. Clicking 🗑️ on an "Embedded" lorebook row runs the unassign path (
unassignLorebookinpackages/client/src/components/lorebooks/LorebookAssignmentSection.tsx), which just removes the character from the standalone'scharacterIds. It never clearscharacter_book. The embedded lorebook persists — its entries still render below ("World-building entries embedded in this character…") and it still exports with the card — yet the toast says "Removed ", implying full removal.character_bookisclearCharacterEmbeddedLorebook, and it is triggered solely by fully deleting the standalone lorebook from the Lorebooks panel (packages/server/src/routes/lorebooks.routes.ts:496). That is non-obvious, and impossible when the character has an embeddedcharacter_bookbut no standalone — e.g. a freshly-imported card whose embedded book was never "imported," or (per #2 below) after unlinking — leaving an orphaned embedded book with no removal path at all.Confusing dead state after unlink. After the 🗑️ unlink, the forward pointer (
extensions.importMetadata.embeddedLorebook.lorebookId) still points at the now-unlinked standalone, so "Reimport Embedded Lorebook" + "Edit Linked Lorebook" still appear and the embedded entries still show as Active — even though nothing injects them anymore (the standalone is no longer linked to this character, andcharacter_bookis inert at runtime)."Edit Linked Lorebook" naming. The button opens the standalone lorebook (
openLorebookDetail(linkedLorebookId)inpackages/client/src/components/characters/CharacterEditor.tsx), which is a synced mirror ofcharacter_book. Editing it effectively edits the embedded content, so the "Linked" label vs. the section's "embedded in this character" framing is muddled — users can't tell whether they are editing the linked standalone or the baked-in copy.Steps to reproduce
character_book), or embed one via Embed into card.Environment
Logs, screenshots, or video
Before/after screenshots of clicking 🗑️ on the "Embedded" row: the row is removed from the assigned list but the embedded entries (Kaz: Speech, Instruction, Kaz: Expressions) and the Reimport/Edit-Linked buttons persist. (Attach on the GitHub issue.)
Additional context
This is a UX/labeling problem, not a data-integrity / double-injection bug. Verified in code: an embedded
character_bookis inert at generation time — no prompt-assembly or activation path reads it. The runtime lorebook scan (listActiveEntriesinpackages/server/src/services/storage/lorebooks.storage.ts, invoked frompackages/server/src/services/lorebook/index.ts) reads only the standalonelorebooks/lorebookEntriestables filtered by owner links; the assembler never touchescharacter_book. So when a lorebook is BOTH embedded and linked, a keyword match injects exactly once (from the standalone) — the embedded copy never double-injects. The problem is purely that users cannot cleanly remove/manage the embedded copy and the linked-vs-embedded labels are ambiguous.One adjacent edge case surfaced while verifying the above (worth designing against in the same pass, though not the reported symptom): the single-standalone guarantee relies on the forward pointer
importMetadata.embeddedLorebook.lorebookIdsurviving. If that pointer is ever dropped while a standalone still exists — e.g. a dirty-editor save that shallow-mergesdataand replacesextensions.importMetadatawholesale — then clicking Import Embedded Lorebook again wouldcreatea second standalone (st-lorebook.importer.ts:405-406), and two standalones would then genuinely double-inject. That is a duplicate-standalone bug, not the embedded copy activating — but the same "add an explicit unembed + tighten pointer handling" work would address it.Suggested direction:
character_book+ the forward pointer (reuseclearCharacterEmbeddedLorebookor add a dedicatedDELETE …/embedded-lorebookendpoint), available whenevercharacter_bookis present — including the orphaned no-standalone case.character_book), or spell out the relationship in the helper text.Template check