[GH-ISSUE #2699] [Issue]: Character card import field loss — RisuAI drops post-history/book/extensions; V3-only fields dropped; embedded-book fields flattened #1344

Closed
opened 2026-10-21 05:31:53 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

The character-card importer drops fields on several paths: a RisuAI card loses its post-history instructions, embedded character_book, character_version, and all extensions; all V3-only top-level fields (group_only_greetings, nickname, assets, creation_date, source, creator_notes_multilingual) are silently dropped so they never survive import or round-trip; and normalizeCharacterBook drops per-entry trigger fields on the character-stored/re-exported copy of an embedded book.

Expected behavior

Every card field present on the source (V1/V2/V3/CharX/RisuAI) should be preserved on import and survive a round-trip export.

Actual behavior

  • RisuAI: convertRisuToV2 hardcodes post_history_instructions: "", character_book: null, and extensions: {} — so a RisuAI card's post-history, embedded lorebook, and every extension (depth_prompt, talkativeness, world, regex_scripts, …) are discarded.
  • V3-only fields: normalizeV2/normalizeCharacterData extract only the V2 field set; V3-only top-level fields (group_only_greetings, nickname, assets, creation_date, source, creator_notes_multilingual) are never read, so they're lost at import and can never be re-exported.
  • Embedded book copy: normalizeCharacterBook maps each entry's position to only before_char/after_char (loses at-depth) and re-derives id from uid, dropping per-entry trigger fields (depth, role, probability, selectiveLogic, sticky/cooldown/delay, group) on the copy stored on the character record (which is what a re-export would emit).

How it breaks the pipeline

Code trace (staging @ b826f8f4) — packages/server/src/services/import/st-character.importer.ts:

  • RisuAI: convertRisuToV2 :730-748 (post_history_instructions: "" :740, character_book: null :746, extensions: {} :745).
  • V3-only: normalizeV2 :612-646 (only V2 fields); normalizeCharacterData :478-494.
  • Embedded book: normalizeCharacterBook :666-707 (position→before/after :671-677; id from uid :690; no depth/role/probability/selectiveLogic/timing/group). (The functional lorebook trigger mapping is filed #2690/#2691; this is the character-stored/re-exported copy.)

Steps to reproduce

  • Import a RisuAI character with post-history instructions, an embedded lorebook, and extensions → the imported character has none of them.
  • Import a V3 card with group_only_greetings/assets/nickname → those fields are absent on the imported character and on any re-export.
  • Import a card with an embedded book using at-depth entries → the character-stored book copy flattens them.

Suggested fix

  • In convertRisuToV2, map RisuAI's post-history, lorebook, and extension fields instead of hardcoding empty.
  • In normalizeV2, carry V3-only top-level fields through (store them, even if unmodeled, so re-export is lossless).
  • In normalizeCharacterBook, preserve the full entry parameter set (at-depth position, depth, role, probability, selectiveLogic, sticky/cooldown/delay, group) rather than flattening.

Environment

  • Marinara Engine version: 2.0.0 (staging @ b826f8f4)
  • Install type: source
  • OS + version: All (code-level defect, platform-independent)
  • Browser or app shell: All

Additional context

Found via a systematic multi-agent audit of import/export round-trips. 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:

  • I DID NOT read this template and provide the requested details.
Originally created by @kolacheee on GitHub (Jun 21, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2699 Originally assigned to: @SpicyMarinara on GitHub. ## Summary The character-card importer drops fields on several paths: a **RisuAI** card loses its post-history instructions, embedded character_book, character_version, and **all** extensions; **all V3-only top-level fields** (`group_only_greetings`, `nickname`, `assets`, `creation_date`, `source`, `creator_notes_multilingual`) are silently dropped so they never survive import or round-trip; and `normalizeCharacterBook` drops per-entry trigger fields on the character-stored/re-exported copy of an embedded book. ## Expected behavior Every card field present on the source (V1/V2/V3/CharX/RisuAI) should be preserved on import and survive a round-trip export. ## Actual behavior - **RisuAI:** `convertRisuToV2` hardcodes `post_history_instructions: ""`, `character_book: null`, and `extensions: {}` — so a RisuAI card's post-history, embedded lorebook, and every extension (depth_prompt, talkativeness, world, regex_scripts, …) are discarded. - **V3-only fields:** `normalizeV2`/`normalizeCharacterData` extract only the V2 field set; V3-only top-level fields (`group_only_greetings`, `nickname`, `assets`, `creation_date`, `source`, `creator_notes_multilingual`) are never read, so they're lost at import and can never be re-exported. - **Embedded book copy:** `normalizeCharacterBook` maps each entry's `position` to only `before_char`/`after_char` (loses at-depth) and re-derives `id` from `uid`, dropping per-entry trigger fields (depth, role, probability, selectiveLogic, sticky/cooldown/delay, group) on the copy stored on the character record (which is what a re-export would emit). ## How it breaks the pipeline Code trace (staging @ `b826f8f4`) — `packages/server/src/services/import/st-character.importer.ts`: - RisuAI: `convertRisuToV2` `:730-748` (`post_history_instructions: ""` `:740`, `character_book: null` `:746`, `extensions: {}` `:745`). - V3-only: `normalizeV2` `:612-646` (only V2 fields); `normalizeCharacterData` `:478-494`. - Embedded book: `normalizeCharacterBook` `:666-707` (position→before/after `:671-677`; id from uid `:690`; no depth/role/probability/selectiveLogic/timing/group). (The *functional* lorebook trigger mapping is filed #2690/#2691; this is the character-stored/re-exported copy.) ## Steps to reproduce - Import a RisuAI character with post-history instructions, an embedded lorebook, and extensions → the imported character has none of them. - Import a V3 card with `group_only_greetings`/`assets`/`nickname` → those fields are absent on the imported character and on any re-export. - Import a card with an embedded book using at-depth entries → the character-stored book copy flattens them. ## Suggested fix - In `convertRisuToV2`, map RisuAI's post-history, lorebook, and extension fields instead of hardcoding empty. - In `normalizeV2`, carry V3-only top-level fields through (store them, even if unmodeled, so re-export is lossless). - In `normalizeCharacterBook`, preserve the full entry parameter set (at-depth position, depth, role, probability, selectiveLogic, sticky/cooldown/delay, group) rather than flattening. ## Environment - Marinara Engine version: 2.0.0 (staging @ `b826f8f4`) - Install type: source - OS + version: All (code-level defect, platform-independent) - Browser or app shell: All ## Additional context Found via a systematic multi-agent audit of import/export round-trips. 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: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@SpicyMarinara commented on GitHub (Jun 21, 2026):

Fixed in branch codex/spicy-issue-sweep-2026-06-21.

What changed:

  • RisuAI cards are detected before the generic V1/name path and now preserve post-history instructions, character version, extensions, and embedded lorebooks.
  • Risu camelCase extension aliases are normalized into the compatible extension keys where needed.
  • V3-only character data fields are carried through normalization instead of being dropped.
  • Character data and embedded character-book entry schemas now pass through unmodeled fields so round-trips remain lossless.
  • Embedded character-book entries preserve additional trigger parameters such as probability, selective logic, timing, group, regex/match flags, and recursion flags. The at-depth/depth/role preservation was already addressed in the preceding embedded-book placement fix.

Final repo checks will run after the full issue sweep.

<!-- gh-comment-id:4761559251 --> @SpicyMarinara commented on GitHub (Jun 21, 2026): Fixed in branch `codex/spicy-issue-sweep-2026-06-21`. What changed: - RisuAI cards are detected before the generic V1/name path and now preserve post-history instructions, character version, extensions, and embedded lorebooks. - Risu camelCase extension aliases are normalized into the compatible extension keys where needed. - V3-only character data fields are carried through normalization instead of being dropped. - Character data and embedded character-book entry schemas now pass through unmodeled fields so round-trips remain lossless. - Embedded character-book entries preserve additional trigger parameters such as probability, selective logic, timing, group, regex/match flags, and recursion flags. The at-depth/depth/role preservation was already addressed in the preceding embedded-book placement fix. Final repo checks will run after the full issue sweep.
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#1344
No description provided.