[GH-ISSUE #1545] [Issue]: Chat-scoped lorebooks show active in UI but are not loaded for prompts #791

Closed
opened 2026-10-20 17:33:25 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Xelvanis on GitHub (May 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1545

Originally assigned to: @Xelvanis on GitHub.

Found during the 2026-05-29 native Tauri Lorebooks QA pass on origin/refactor commit f120eb33.

Proof method: seeded disposable lorebook/chat records through the app's Tauri storage API, then ran the app's own prompt-preview assembly from the native WebView. The same pass included positive controls for selected, global, character-scoped, persona-scoped, and roleplay-trigger-filtered entries.

What happened

A lorebook with chatId set to the current chat did not activate unless it was also explicitly listed in chat metadata activeLorebookIds.

Repro

  1. Create a roleplay chat.
  2. Create an enabled lorebook with chatId equal to that chat id and isGlobal: false.
  3. Add a constant entry with marker LQA_CHAT_SCOPED_CONTENT_SHOULD_APPEAR.
  4. Do not add the lorebook id to metadata.activeLorebookIds.
  5. Run prompt preview / active world-info scan.

Expected

The chat-scoped lorebook should apply to that chat. The Chat Settings drawer already treats lorebook.chatId === chat.id as an active Chat reason.

Actual

The chat-scoped entry did not appear in prompt preview and was not returned by scanActiveLorebookEntries(...).

Likely owner

lorebookAppliesToContext(...) in src/engine/generation/prompt-assembly.ts checks enabled/global, character scope, persona scope, and metadata.activeLorebookIds, but does not check lorebook.chatId === chat.id.

The UI active-reason logic in src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx does include the chat-id check, so the UI and runtime contract can disagree.

Acceptance criteria

  • Prompt assembly treats lorebook.chatId === chat.id as an active chat-scoped lorebook.
  • The Chat Settings active list and prompt activation agree for chat-scoped books.
  • Add a regression test for a chat-scoped lorebook that is not pinned in activeLorebookIds.
Originally created by @Xelvanis on GitHub (May 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1545 Originally assigned to: @Xelvanis on GitHub. Found during the 2026-05-29 native Tauri Lorebooks QA pass on `origin/refactor` commit `f120eb33`. Proof method: seeded disposable lorebook/chat records through the app's Tauri storage API, then ran the app's own prompt-preview assembly from the native WebView. The same pass included positive controls for selected, global, character-scoped, persona-scoped, and roleplay-trigger-filtered entries. ## What happened A lorebook with `chatId` set to the current chat did not activate unless it was also explicitly listed in chat metadata `activeLorebookIds`. ## Repro 1. Create a roleplay chat. 2. Create an enabled lorebook with `chatId` equal to that chat id and `isGlobal: false`. 3. Add a constant entry with marker `LQA_CHAT_SCOPED_CONTENT_SHOULD_APPEAR`. 4. Do not add the lorebook id to `metadata.activeLorebookIds`. 5. Run prompt preview / active world-info scan. ## Expected The chat-scoped lorebook should apply to that chat. The Chat Settings drawer already treats `lorebook.chatId === chat.id` as an active `Chat` reason. ## Actual The chat-scoped entry did not appear in prompt preview and was not returned by `scanActiveLorebookEntries(...)`. ## Likely owner `lorebookAppliesToContext(...)` in `src/engine/generation/prompt-assembly.ts` checks enabled/global, character scope, persona scope, and `metadata.activeLorebookIds`, but does not check `lorebook.chatId === chat.id`. The UI active-reason logic in `src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx` does include the chat-id check, so the UI and runtime contract can disagree. ## Acceptance criteria - Prompt assembly treats `lorebook.chatId === chat.id` as an active chat-scoped lorebook. - The Chat Settings active list and prompt activation agree for chat-scoped books. - Add a regression test for a chat-scoped lorebook that is not pinned in `activeLorebookIds`.
bsakaguchi 2026-10-20 17:33:25 +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#791
No description provided.