[GH-ISSUE #2158] [Issue]: Edits to a linked embedded lorebook no longer sync back into the character's character_book #1067

Closed
opened 2026-10-21 05:26:16 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Romuromylus on GitHub (Jun 4, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2158

Originally assigned to: @Promansis on GitHub.

Summary

When a character is imported with an embedded character_book, the importer creates and links a standalone lorebook. In the legacy app, editing or deleting entries on that linked lorebook mirrored the change back into the character's data.character_book. On the refactor branch that sync-back is gone, so the character editor's Lorebook tab (which reads character_book) shows stale entries and the user's edits appear to revert.

Expected behavior

After importing a character with an embedded lorebook, editing/deleting entries via "Edit Linked Lorebook" should update data.character_book so the change is reflected when the character editor's Lorebook tab is reopened. This is exactly what the legacy character-book-sync.ts was written to guarantee.

Actual behavior

Entry create/update/delete on the linked lorebook updates only the standalone lorebook-entries rows. data.character_book is never re-synced, so CharacterLorebookTab shows the frozen import-time book; edits/deletes appear to roll back on reopen, and the standalone lorebook and embedded book diverge permanently (exports carry the stale book).

Steps to reproduce

  1. Import a SillyTavern character whose card has an embedded character_book with at least one entry.
  2. Open "Edit Linked Lorebook" and add, edit, or delete an entry.
  3. Reopen the character editor's Lorebook tab.
  4. The change is not reflected; the originally embedded entries are shown.

Impact area

  • Catalog resources
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime

Environment

  • Branch or commit: refactor @ 93555d4b
  • Run mode: Tauri desktop
  • OS + version: Windows 11
  • Node + pnpm versions: n/a (static parity audit, main vs refactor)
  • Rust version, if relevant: n/a
  • Remote Runtime URL configured? not relevant

Regression notes

Worked in legacy (main @ c49f1d95). main: packages/server/src/services/lorebook/character-book-sync.ts:115-137 (syncCharacterBookFromLorebook) invoked after every entry create/update/delete/bulk/move at packages/server/src/routes/lorebooks.routes.ts:407,422,436,453,508,510. refactor @ 93555d4b: no equivalent mirror-back exists; entry mutations route through generic storageApi.create/update/delete('lorebook-entries') (src/features/catalog/lorebooks/hooks/use-lorebooks.ts:275-310) which never touches character data; the only character_book write-back in Rust is the clear-on-whole-lorebook-delete path (src-tauri/src/commands/storage/commands/entities.rs:995). CharacterLorebookTab.tsx:21-22 reads from formData.character_book.

Originally created by @Romuromylus on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2158 Originally assigned to: @Promansis on GitHub. ## Summary When a character is imported with an embedded `character_book`, the importer creates and links a standalone lorebook. In the legacy app, editing or deleting entries on that linked lorebook mirrored the change back into the character's `data.character_book`. On the refactor branch that sync-back is gone, so the character editor's Lorebook tab (which reads `character_book`) shows stale entries and the user's edits appear to revert. ## Expected behavior After importing a character with an embedded lorebook, editing/deleting entries via "Edit Linked Lorebook" should update `data.character_book` so the change is reflected when the character editor's Lorebook tab is reopened. This is exactly what the legacy `character-book-sync.ts` was written to guarantee. ## Actual behavior Entry create/update/delete on the linked lorebook updates only the standalone lorebook-entries rows. `data.character_book` is never re-synced, so `CharacterLorebookTab` shows the frozen import-time book; edits/deletes appear to roll back on reopen, and the standalone lorebook and embedded book diverge permanently (exports carry the stale book). ## Steps to reproduce 1. Import a SillyTavern character whose card has an embedded `character_book` with at least one entry. 2. Open "Edit Linked Lorebook" and add, edit, or delete an entry. 3. Reopen the character editor's Lorebook tab. 4. The change is not reflected; the originally embedded entries are shown. ## Impact area - [x] Catalog resources - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime ## Environment - Branch or commit: refactor @ 93555d4b - Run mode: Tauri desktop - OS + version: Windows 11 - Node + pnpm versions: n/a (static parity audit, main vs refactor) - Rust version, if relevant: n/a - Remote Runtime URL configured? not relevant ## Regression notes Worked in legacy (main @ c49f1d95). main: `packages/server/src/services/lorebook/character-book-sync.ts:115-137` (syncCharacterBookFromLorebook) invoked after every entry create/update/delete/bulk/move at `packages/server/src/routes/lorebooks.routes.ts:407,422,436,453,508,510`. refactor @ 93555d4b: no equivalent mirror-back exists; entry mutations route through generic `storageApi.create/update/delete('lorebook-entries')` (`src/features/catalog/lorebooks/hooks/use-lorebooks.ts:275-310`) which never touches character data; the only `character_book` write-back in Rust is the clear-on-whole-lorebook-delete path (`src-tauri/src/commands/storage/commands/entities.rs:995`). `CharacterLorebookTab.tsx:21-22` reads from `formData.character_book`.
bsakaguchi 2026-10-21 05:26:16 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1067
No description provided.