[GH-ISSUE #3375] [Issue]: 'Remove from chat' on a lorebook that's also active via persona/character/global only unpins it — it keeps injecting, and 'Disable in this chat' is hidden while pinned #1823

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

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

Originally assigned to: @SpicyMarinara on GitHub.

What's wrong

In Chat Settings → Lorebooks, each active lorebook row has a single action button with three mutually-exclusive states. For a book that is both pinned to the chat and also active via a persona (or character/global) link, the row shows only the 🗑️ "Remove from chat" button — not the 👁️ "Disable in this chat" button. Clicking "Remove from chat" only removes the chat pin; the book keeps injecting because the persona link still activates it. There is no single action that fully turns the book off, and "Remove from chat" reads as "this book is gone" when it isn't.

This is the likely cause of the user report "I unlinked lorebook A from the chat and it still behaved like it had read A." Unlinking (Remove from chat) does not stop a persona-linked book — only the separate "Disable in this chat" (👁️, which writes the per-chat exclusion) does. And that eye is hidden while the book is pinned, so the user has to: click trash → not realize the book is still active → later spot the "Persona" pill → click the now-appeared eye.

(To be clear about scope: the row already shows why a book is active via small pills — "Chat", "Persona", "Character", "Global" — so the persona activation is not invisible; and the injection gate itself works correctly. The gap is purely this confusing two-step control and the misleading "Remove from chat" label for a book kept alive by another source.)

How to reproduce (try it yourself)

  1. Assign a lorebook to a persona (Persona editor → Lorebooks → Assign).
  2. Start a chat with that persona, and also pin the same lorebook to the chat, so the row shows both a "Chat" and a "Persona" pill and a 🗑️ trash button.
  3. Click the trash ("Remove from chat").

You'll see: the pin is removed, but the book is still listed as active (now just the "Persona" pill) and still injects — and the button silently changes to a 👁️ "Disable in this chat". Nothing told you it was still active.
Expected: one clear way to fully turn a book off for this chat — or, at minimum, after "Remove from chat" on a still-active book, a signal that it's still active via the persona and how to disable it.

Where it is

packages/client/src/features/chat-settings/sections/LorebooksSection.tsx:127-151 — the per-row control:

  • isExcluded → 👁️ "Enable in this chat" (onSetLorebookExcluded(id, false)), lines 127-134
  • else isPinned → 🗑️ "Remove from chat" (onToggleLorebook(id), unpin only), lines 135-142
  • else → EyeOff "Disable in this chat" (onSetLorebookExcluded(id, true)), lines 143-150

Because the isPinned branch wins over the exclude branch, a pinned + persona-active book never shows the disable control. The "why" pills are rendered at 110-125 (lorebook.activeReasons). Unpin writes activeLorebookIds; disable writes excludedLorebookIds (ChatSettingsDrawer.tsx setLorebookExcluded ~2387). The server injection gate honors excludedLorebookIds correctly (packages/server/src/services/lorebook/index.ts:246, dropped before the persona check), so "Disable in this chat" genuinely stops injection in every mode — it's just hard to reach for a pinned book.

What's happening

The single-button, three-way design assumes a book is either pinned, excluded, or auto-active — not pinned and auto-active-via-another-source at once. So it offers "Remove from chat" (unpin) but hides "Disable in this chat" (exclude) for exactly the case where unpinning alone doesn't stop injection.

Suggested fix

For a book active via a non-chat source (persona/character/global), make the full-disable reachable in one step: show the 👁️ "Disable in this chat" control even when the book is pinned (e.g. render both a "Remove pin" and a "Disable" action, or make a single "Disable in this chat" that also clears the pin by adding to excludedLorebookIds). At minimum, after "Remove from chat" on a book still active via another source, surface an inline hint — "Still active via persona — Disable in this chat?" — wired to setLorebookExcluded. No server change needed; the exclusion gate already works.


AI-investigated against the current tree (v2.0.9); the control branches, the reason pills, and the server exclusion gate all read and confirmed. Please verify before fixing.

Originally created by @kolacheee on GitHub (Jul 8, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3375 Originally assigned to: @SpicyMarinara on GitHub. **What's wrong** In Chat Settings → Lorebooks, each active lorebook row has a **single** action button with three mutually-exclusive states. For a book that is both **pinned to the chat** and **also active via a persona (or character/global) link**, the row shows only the 🗑️ **"Remove from chat"** button — not the 👁️ **"Disable in this chat"** button. Clicking "Remove from chat" only removes the chat pin; the book keeps injecting because the persona link still activates it. There is no single action that fully turns the book off, and "Remove from chat" reads as "this book is gone" when it isn't. This is the likely cause of the user report *"I unlinked lorebook A from the chat and it still behaved like it had read A."* Unlinking (Remove from chat) does not stop a persona-linked book — only the separate "Disable in this chat" (👁️, which writes the per-chat exclusion) does. And that eye is hidden while the book is pinned, so the user has to: click trash → not realize the book is still active → later spot the "Persona" pill → click the now-appeared eye. (To be clear about scope: the row already shows *why* a book is active via small pills — "Chat", "Persona", "Character", "Global" — so the persona activation is not invisible; and the injection gate itself works correctly. The gap is purely this confusing two-step control and the misleading "Remove from chat" label for a book kept alive by another source.) **How to reproduce (try it yourself)** 1. Assign a lorebook to a persona (Persona editor → Lorebooks → Assign). 2. Start a chat with that persona, and also pin the same lorebook to the chat, so the row shows both a **"Chat"** and a **"Persona"** pill and a 🗑️ trash button. 3. Click the trash ("Remove from chat"). **You'll see:** the pin is removed, but the book is still listed as active (now just the "Persona" pill) and still injects — and the button silently changes to a 👁️ "Disable in this chat". Nothing told you it was still active. **Expected:** one clear way to fully turn a book off for this chat — or, at minimum, after "Remove from chat" on a still-active book, a signal that it's still active via the persona and how to disable it. **Where it is** `packages/client/src/features/chat-settings/sections/LorebooksSection.tsx:127-151` — the per-row control: - `isExcluded` → 👁️ "Enable in this chat" (`onSetLorebookExcluded(id, false)`), lines 127-134 - else `isPinned` → 🗑️ "Remove from chat" (`onToggleLorebook(id)`, unpin only), lines 135-142 - else → EyeOff "Disable in this chat" (`onSetLorebookExcluded(id, true)`), lines 143-150 Because the `isPinned` branch wins over the exclude branch, a pinned + persona-active book never shows the disable control. The "why" pills are rendered at 110-125 (`lorebook.activeReasons`). Unpin writes `activeLorebookIds`; disable writes `excludedLorebookIds` (`ChatSettingsDrawer.tsx` `setLorebookExcluded` ~2387). The server injection gate honors `excludedLorebookIds` correctly (`packages/server/src/services/lorebook/index.ts:246`, dropped before the persona check), so "Disable in this chat" genuinely stops injection in every mode — it's just hard to reach for a pinned book. **What's happening** The single-button, three-way design assumes a book is either pinned, excluded, or auto-active — not pinned **and** auto-active-via-another-source at once. So it offers "Remove from chat" (unpin) but hides "Disable in this chat" (exclude) for exactly the case where unpinning alone doesn't stop injection. **Suggested fix** For a book active via a non-chat source (persona/character/global), make the full-disable reachable in one step: show the 👁️ "Disable in this chat" control even when the book is pinned (e.g. render both a "Remove pin" and a "Disable" action, or make a single "Disable in this chat" that also clears the pin by adding to `excludedLorebookIds`). At minimum, after "Remove from chat" on a book still active via another source, surface an inline hint — "Still active via persona <name> — Disable in this chat?" — wired to `setLorebookExcluded`. No server change needed; the exclusion gate already works. --- *AI-investigated against the current tree (v2.0.9); the control branches, the reason pills, and the server exclusion gate all read and confirmed. Please verify before fixing.*
bsakaguchi 2026-10-21 05:43:01 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jul 8, 2026):

Addressed in #3388 and merged to staging.

<!-- gh-comment-id:4918159179 --> @SpicyMarinara commented on GitHub (Jul 8, 2026): Addressed in #3388 and merged to staging.
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#1823
No description provided.