[GH-ISSUE #2182] [Issue]: Decide lorebook schedule behavior when game-state fields are missing #1083

Closed
opened 2026-10-21 05:26:29 +07:00 by bsakaguchi · 0 comments
Owner

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

Originally assigned to: @Promansis on GitHub.

Summary

Batch 2 lorebooks parityscan found a refactor-vs-legacy behavior mismatch for scheduled lorebook entries. Refactor blocks schedule-gated entries when the relevant game-state field is missing; legacy passed those entries when the game state or field was absent.

This may be the desired stricter behavior, but it needs a product decision or documentation because it differs from main legacy behavior.

Expected behavior

Either:

  • Match legacy: schedule gates only constrain activation when the corresponding game-state field exists, so missing time, date, or location does not block the entry; or
  • Document the stricter refactor behavior as intentional and add focused proof around missing game-state fields.

Actual behavior

Refactor treats missing schedule fields as a failed gate:

  • activeTimes requires a non-empty gameState.time.
  • activeDates requires a non-empty gameState.date.
  • activeLocations requires a non-empty gameState.location.

Legacy only checked these gates when the corresponding game-state value existed, so missing fields did not block the entry.

Steps to reproduce

  1. On refactor, create or import a lorebook entry with a matching keyword and a schedule gate such as activeTimes: ["morning"].
  2. Attach the lorebook to a chat where the entry otherwise matches, but the scan game state has no time value.
  3. Generate or run Active World Info scan.
  4. Compare with main: legacy scanner allows the entry through when time is missing; refactor blocks it.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor at ec2dab6e59e282111333370b001fe2e8676f8dba
  • Run mode: generation lorebook scanner / Active World Info static trace
  • OS + version: not OS-specific
  • Node + pnpm versions: not captured; static trace only
  • Rust version, if relevant: not relevant
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: any text generation provider using lorebook schedule gates

Logs, screenshots, or video

Static parity evidence:

Refactor:
src/engine/generation-core/lorebooks/keyword-scanner.ts:132-164

Legacy main:
packages/server/src/services/lorebook/keyword-scanner.ts:120-145

Refactor evaluateSchedule returns false when a schedule has activeTimes, activeDates, or activeLocations and the corresponding game-state field is missing. Legacy returned true when the field was missing because each schedule check was guarded by both schedule.*.length > 0 and gameState.*.

Regression notes

Found during Batch 2 parityscan for target 7 lorebooks:

  • 07-LB-CONTRACT-scope-and-filters
  • Parent target detail: #2181
  • Tracker: #1904

Related prior closed issue: #1249 fixed the inverse fail-open risk for activation gates. This issue is narrower: scheduled lorebook fields now fail closed when legacy allowed missing schedule fields to pass.

Additional context

This is currently classified as Unknown/product decision, not a confirmed regression, because the stricter refactor behavior may be intentional. It still needs a durable decision so future parity scans do not re-raise the same mismatch.

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 @Promansis on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2182 Originally assigned to: @Promansis on GitHub. ## Summary Batch 2 lorebooks parityscan found a refactor-vs-legacy behavior mismatch for scheduled lorebook entries. Refactor blocks schedule-gated entries when the relevant game-state field is missing; legacy passed those entries when the game state or field was absent. This may be the desired stricter behavior, but it needs a product decision or documentation because it differs from `main` legacy behavior. ## Expected behavior Either: - Match legacy: schedule gates only constrain activation when the corresponding game-state field exists, so missing `time`, `date`, or `location` does not block the entry; or - Document the stricter refactor behavior as intentional and add focused proof around missing game-state fields. ## Actual behavior Refactor treats missing schedule fields as a failed gate: - `activeTimes` requires a non-empty `gameState.time`. - `activeDates` requires a non-empty `gameState.date`. - `activeLocations` requires a non-empty `gameState.location`. Legacy only checked these gates when the corresponding game-state value existed, so missing fields did not block the entry. ## Steps to reproduce 1. On `refactor`, create or import a lorebook entry with a matching keyword and a schedule gate such as `activeTimes: ["morning"]`. 2. Attach the lorebook to a chat where the entry otherwise matches, but the scan game state has no `time` value. 3. Generate or run Active World Info scan. 4. Compare with `main`: legacy scanner allows the entry through when `time` is missing; refactor blocks it. ## Impact area - [ ] App shell, navigation, startup, or providers - [x] Catalog resources - [ ] Chat mode - [ ] Roleplay mode - [x] Game mode - [ ] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [x] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [ ] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `refactor` at `ec2dab6e59e282111333370b001fe2e8676f8dba` - Run mode: generation lorebook scanner / Active World Info static trace - OS + version: not OS-specific - Node + pnpm versions: not captured; static trace only - Rust version, if relevant: not relevant - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: any text generation provider using lorebook schedule gates ## Logs, screenshots, or video Static parity evidence: ```text Refactor: src/engine/generation-core/lorebooks/keyword-scanner.ts:132-164 Legacy main: packages/server/src/services/lorebook/keyword-scanner.ts:120-145 ``` Refactor `evaluateSchedule` returns false when a schedule has `activeTimes`, `activeDates`, or `activeLocations` and the corresponding game-state field is missing. Legacy returned true when the field was missing because each schedule check was guarded by both `schedule.*.length > 0` and `gameState.*`. ## Regression notes Found during Batch 2 parityscan for target 7 lorebooks: - `07-LB-CONTRACT-scope-and-filters` - Parent target detail: #2181 - Tracker: #1904 Related prior closed issue: #1249 fixed the inverse fail-open risk for activation gates. This issue is narrower: scheduled lorebook fields now fail closed when legacy allowed missing schedule fields to pass. ## Additional context This is currently classified as `Unknown/product decision`, not a confirmed regression, because the stricter refactor behavior may be intentional. It still needs a durable decision so future parity scans do not re-raise the same mismatch. ## 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:29 +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#1083
No description provided.