[GH-ISSUE #2280] [Issue]: Editing a linked lorebook's header metadata does not propagate into the character's embedded character_book (stale header in card exports) #1118

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

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

Originally assigned to: @cha1latte on GitHub.

Summary

The entry-level character_book sync added for #2158 mirrors entries correctly, but a lorebook-row metadata edit (name, scan depth, token budget, recursive scanning) is never re-synced into the linked character's embedded character_book header, so an exported character card ships a stale header.

Expected behavior

Editing a linked lorebook's header fields should re-derive the embedded character_book header on the linked character, matching main, so a later character PNG export carries the current values.

Actual behavior

A lorebook metadata update falls through to the generic storage patch with no character_book sync, and the entry-sync helper only rewrites the entries array (never the header) and only fires on entry CRUD. The embedded header keeps its import-time values and that stale header ships into the exported chara_card_v3.

Steps to reproduce

  1. Create a standalone lorebook linked to a character and export the character once (header matches).
  2. Edit the lorebook's name / scan depth / token budget / recursive scanning in the Lorebook tab.
  3. Re-export the character. The embedded character_book header still shows the old values.

Impact area

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

Regression notes

Worked on main. Main calls syncCharacterBookFromLorebook on every standalone mutation including the metadata PATCH (packages/server/src/routes/lorebooks.routes.ts:267), and toCharacterBook re-derives the full header plus entries (packages/server/src/services/lorebook/character-book-sync.ts:70-80). The refactor's sync_linked_character_books_for_lorebook_in_place only rewrites book["entries"] (src-tauri/src/commands/storage/commands/entities.rs:1217-1227) and fires only on entry CRUD; a lorebook metadata update routes through the generic state.storage.patch (entities.rs:498-502) with no sync. Header fields are written into character_book only at import (normalization.rs:432-434), and compatible_character_export emits data.character_book verbatim (exports.rs:401-407). Export-only and invisible in the Lorebook tab, hence minor.

Environment

  • Branch or commit: refactor @ 5ddb9840 (compared against main @ b4ab97f)
  • Run mode: Tauri desktop
  • OS + version: Windows 11
  • Node + pnpm versions: not relevant (static source comparison)
  • Rust version, if relevant: not relevant (static source comparison)
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: see body

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Romuromylus on GitHub (Jun 5, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2280 Originally assigned to: @cha1latte on GitHub. ## Summary The entry-level character_book sync added for #2158 mirrors entries correctly, but a lorebook-row metadata edit (name, scan depth, token budget, recursive scanning) is never re-synced into the linked character's embedded character_book header, so an exported character card ships a stale header. ## Expected behavior Editing a linked lorebook's header fields should re-derive the embedded character_book header on the linked character, matching main, so a later character PNG export carries the current values. ## Actual behavior A lorebook metadata update falls through to the generic storage patch with no character_book sync, and the entry-sync helper only rewrites the entries array (never the header) and only fires on entry CRUD. The embedded header keeps its import-time values and that stale header ships into the exported chara_card_v3. ## Steps to reproduce 1. Create a standalone lorebook linked to a character and export the character once (header matches). 2. Edit the lorebook's name / scan depth / token budget / recursive scanning in the Lorebook tab. 3. Re-export the character. The embedded character_book header still shows the old values. ## Impact area - [x] Catalog resources - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime ## Regression notes Worked on main. Main calls `syncCharacterBookFromLorebook` on every standalone mutation including the metadata PATCH (`packages/server/src/routes/lorebooks.routes.ts:267`), and `toCharacterBook` re-derives the full header plus entries (`packages/server/src/services/lorebook/character-book-sync.ts:70-80`). The refactor's `sync_linked_character_books_for_lorebook_in_place` only rewrites `book["entries"]` (`src-tauri/src/commands/storage/commands/entities.rs:1217-1227`) and fires only on entry CRUD; a lorebook metadata update routes through the generic `state.storage.patch` (`entities.rs:498-502`) with no sync. Header fields are written into character_book only at import (`normalization.rs:432-434`), and `compatible_character_export` emits `data.character_book` verbatim (`exports.rs:401-407`). Export-only and invisible in the Lorebook tab, hence minor. ## Environment - Branch or commit: refactor @ 5ddb9840 (compared against main @ b4ab97f) - Run mode: Tauri desktop - OS + version: Windows 11 - Node + pnpm versions: not relevant (static source comparison) - Rust version, if relevant: not relevant (static source comparison) - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: see body ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:27:06 +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#1118
No description provided.