[GH-ISSUE #3376] [Issue]: Game-mode world generation ignores the per-chat 👁️ lorebook disable (excludedLorebookIds not passed to processLorebooks) #1824

Closed
opened 2026-10-21 05:43:02 +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/3376

Originally assigned to: @SpicyMarinara on GitHub.

What's wrong

Every lorebook resolution in the app honors the per-chat 👁️ "Disable in this chat" toggle (excludedLorebookIds) — except one: Game-mode world generation. A lorebook you disabled with the eye can still be scanned into game world-gen.

How to reproduce (try it yourself)

  1. In a Game-mode chat, have a persona/character/global lorebook active, and click 👁️ "Disable in this chat" on it in Chat Settings → Lorebooks.
  2. Trigger game setup / world generation.

You'll see: the disabled lorebook's content is still pulled into world generation (verify via debug / Peek Prompt). Everywhere else (normal turns, previews, voice calls) it's correctly excluded.
Expected: the 👁️ disable applies to game world-gen too.

Where it is

packages/server/src/routes/game.routes.ts:5594-5600 — the world-gen call:

const lorebookResult = await processLorebooks(app.db, [], null, {
  characterIds: setupConfig.partyCharacterIds,
  personaId: setupPersonaId,
  activeLorebookIds: setupConfig.activeLorebookIds,
  generationTriggers: ["game_setup", "game"],
  resolveContent: resolveSetupLorebookMacrosForFinal,
});

passes no excludedLorebookIds, so filterRelevantLorebooks (packages/server/src/services/lorebook/index.ts:246) receives an empty exclusion set and drops nothing. Contrast the roleplay path (generate.routes.ts:1229 builds lorebookScopeExclusions = resolveLorebookScopeExclusions(chatMode, chatMeta) and passes excludedLorebookIds at every resolution call site, e.g. 1512).

What's happening

This is the one lorebook-resolution call site that was never wired to the per-chat exclusion set.

Suggested fix

Near the game setup config assembly, call resolveLorebookScopeExclusions(chatMode, chatMeta) (as generate.routes.ts:1229 does) and add excludedLorebookIds: lorebookScopeExclusions.excludedLorebookIds to the processLorebooks options at game.routes.ts:5594-5600. Check for any other game-mode processLorebooks / listActiveEntries call sites with the same omission.

Note: this is a distinct bug found while diagnosing a persona-lorebook report — it is NOT the cause of that report (that turned out to be a UX issue in roleplay, filed separately). This game-mode gap is real on its own.


AI-investigated against the current tree (v2.0.9); the world-gen call and the exclusion gate 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/3376 Originally assigned to: @SpicyMarinara on GitHub. **What's wrong** Every lorebook resolution in the app honors the per-chat 👁️ "Disable in this chat" toggle (`excludedLorebookIds`) — except one: **Game-mode world generation**. A lorebook you disabled with the eye can still be scanned into game world-gen. **How to reproduce (try it yourself)** 1. In a Game-mode chat, have a persona/character/global lorebook active, and click 👁️ "Disable in this chat" on it in Chat Settings → Lorebooks. 2. Trigger game setup / world generation. **You'll see:** the disabled lorebook's content is still pulled into world generation (verify via debug / Peek Prompt). Everywhere else (normal turns, previews, voice calls) it's correctly excluded. **Expected:** the 👁️ disable applies to game world-gen too. **Where it is** `packages/server/src/routes/game.routes.ts:5594-5600` — the world-gen call: ``` const lorebookResult = await processLorebooks(app.db, [], null, { characterIds: setupConfig.partyCharacterIds, personaId: setupPersonaId, activeLorebookIds: setupConfig.activeLorebookIds, generationTriggers: ["game_setup", "game"], resolveContent: resolveSetupLorebookMacrosForFinal, }); ``` passes no `excludedLorebookIds`, so `filterRelevantLorebooks` (`packages/server/src/services/lorebook/index.ts:246`) receives an empty exclusion set and drops nothing. Contrast the roleplay path (`generate.routes.ts:1229` builds `lorebookScopeExclusions = resolveLorebookScopeExclusions(chatMode, chatMeta)` and passes `excludedLorebookIds` at every resolution call site, e.g. 1512). **What's happening** This is the one lorebook-resolution call site that was never wired to the per-chat exclusion set. **Suggested fix** Near the game setup config assembly, call `resolveLorebookScopeExclusions(chatMode, chatMeta)` (as `generate.routes.ts:1229` does) and add `excludedLorebookIds: lorebookScopeExclusions.excludedLorebookIds` to the `processLorebooks` options at `game.routes.ts:5594-5600`. Check for any other game-mode `processLorebooks` / `listActiveEntries` call sites with the same omission. *Note: this is a distinct bug found while diagnosing a persona-lorebook report — it is NOT the cause of that report (that turned out to be a UX issue in roleplay, filed separately). This game-mode gap is real on its own.* --- *AI-investigated against the current tree (v2.0.9); the world-gen call and the exclusion gate read and confirmed. Please verify before fixing.*
bsakaguchi 2026-10-21 05:43:02 +07:00
Author
Owner

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

Addressed in #3388 and merged to staging.

<!-- gh-comment-id:4918159196 --> @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#1824
No description provided.