[GH-ISSUE #2277] [Issue]: Lorebook entries with game-state activation conditions are silently suppressed in plain (non-game) chats #1113

Closed
opened 2026-10-21 05:26:58 +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/2277

Originally assigned to: @cha1latte on GitHub.

Summary

A lorebook entry that carries an activation condition (a game-state field gate) no longer activates in plain roleplay/conversation chats, even when it keyword-matches. The web app activated it; the refactor blocks it with no error or indication.

Expected behavior

When no game state is present (the normal situation in a plain chat), an entry that has activation conditions but otherwise keyword-matches should still activate and inject its world info, matching main's permissive behavior.

Actual behavior

In the refactor the entry is blocked whenever no game state is present, so a user who adds a game-state field gate to an otherwise normal lorebook entry finds that entry never injects in ordinary chats.

Steps to reproduce

  1. Create a lorebook entry with a primary key that matches the conversation, and add any activation condition (a game-state field gate).
  2. Use it in a plain conversation or roleplay chat (no active game state).
  3. Send a message containing the key. Observe the entry does not inject (it would have on main).

Impact area

  • Chat mode
  • Roleplay mode
  • React-free engine behavior, contracts, agents, or capability ports
  • Runtime systems: generation, world-state, visuals, tracker, or haptics

Regression notes

Worked on main. Main evaluateConditions returns permissively with no game state: packages/server/src/services/lorebook/keyword-scanner.ts:87 (if (!gameState) return true), and plain-chat callers pass null gameState (packages/server/src/routes/generate.routes.ts:3582 conversation, :3638 preset-less roleplay/visual_novel). In the refactor the unified scan path builds gameState = parseRecord(...) which returns {} (not null) when absent (src/engine/generation/active-lorebook-scanner.ts:794, src/engine/.../runtime-records.ts:13-22); the truthy empty record skips src/engine/generation-core/lorebooks/keyword-scanner.ts:81 but the per-condition loop then hits getGameStateValue({}, field) === null and line 85 returns false. Conditions are preserved verbatim on import (active-lorebook-scanner.ts:211) and Rust only stores/normalizes the field (contracts.rs:70, normalization.rs:306), so no permissive path exists anywhere in the refactor.

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/2277 Originally assigned to: @cha1latte on GitHub. ## Summary A lorebook entry that carries an activation condition (a game-state field gate) no longer activates in plain roleplay/conversation chats, even when it keyword-matches. The web app activated it; the refactor blocks it with no error or indication. ## Expected behavior When no game state is present (the normal situation in a plain chat), an entry that has activation conditions but otherwise keyword-matches should still activate and inject its world info, matching main's permissive behavior. ## Actual behavior In the refactor the entry is blocked whenever no game state is present, so a user who adds a game-state field gate to an otherwise normal lorebook entry finds that entry never injects in ordinary chats. ## Steps to reproduce 1. Create a lorebook entry with a primary key that matches the conversation, and add any activation condition (a game-state field gate). 2. Use it in a plain conversation or roleplay chat (no active game state). 3. Send a message containing the key. Observe the entry does not inject (it would have on main). ## Impact area - [x] Chat mode - [x] Roleplay mode - [x] React-free engine behavior, contracts, agents, or capability ports - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics ## Regression notes Worked on main. Main evaluateConditions returns permissively with no game state: `packages/server/src/services/lorebook/keyword-scanner.ts:87` (`if (!gameState) return true`), and plain-chat callers pass null gameState (`packages/server/src/routes/generate.routes.ts:3582` conversation, `:3638` preset-less roleplay/visual_novel). In the refactor the unified scan path builds `gameState = parseRecord(...)` which returns `{}` (not null) when absent (`src/engine/generation/active-lorebook-scanner.ts:794`, `src/engine/.../runtime-records.ts:13-22`); the truthy empty record skips `src/engine/generation-core/lorebooks/keyword-scanner.ts:81` but the per-condition loop then hits `getGameStateValue({}, field) === null` and line 85 returns false. Conditions are preserved verbatim on import (`active-lorebook-scanner.ts:211`) and Rust only stores/normalizes the field (`contracts.rs:70`, `normalization.rs:306`), so no permissive path exists anywhere in the refactor. ## 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:26:58 +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#1113
No description provided.