[GH-ISSUE #1548] [Issue]: Lorebook timing controls are saved but not wired into runtime activation #793

Closed
opened 2026-10-20 17:33:27 +07:00 by bsakaguchi · 1 comment
Owner

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

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

What happened

Lorebook entry timing controls are exposed in the editor and stored on entries, but the runtime prompt activation path does not persist or reuse timing state. ephemeral appears to be saved/normalized but not consumed by activation at all.

Expected

  • sticky keeps an entry active for N messages after it triggers.
  • cooldown prevents immediate reactivation until N messages pass.
  • delay waits N messages before first activation and then allows activation once the delay state counts down.
  • ephemeral auto-disables or decrements per chat after N activations, matching the type comment for per-chat overrides.

Actual

The active prompt path calls scanForActivatedEntries(...) without passing timingStates, and no generation/prompt path found by source search calls updateTimingStatesForScan(...) or writes chat.metadata.entryTimingStates / entryStateOverrides after activation.

Consequences from the current code path:

  • sticky has no prior state to keep an entry active.
  • cooldown has no persisted state, so activations are not throttled across turns.
  • delay entries can be blocked forever because the delay state is never initialized/decremented by the runtime path.
  • ephemeral is normalized from storage but not checked or decremented by scanForActivatedEntries(...).

Evidence

Relevant code paths inspected:

  • src/engine/generation/prompt-assembly.ts normalizes sticky, cooldown, delay, and ephemeral, then calls scanForActivatedEntries(...) without timing-state options.
  • src/engine/generation-core/lorebooks/keyword-scanner.ts defines updateTimingStatesForScan(...), but repo search found no runtime caller.
  • src/engine/contracts/types/chat.ts defines entryStateOverrides and entryTimingStates, but repo search found no prompt-generation writeback path.
  • src/features/catalog/lorebooks/components/LorebookEntryRow.tsx exposes the Timing controls and autosaves those fields.

Acceptance criteria

  • Runtime generation loads per-chat lorebook timing state before scanning and persists the updated state after scanning.
  • sticky, cooldown, and delay behave across turns in a focused prompt-generation test.
  • ephemeral either receives a real per-chat decrement/disable implementation or is removed/hidden from the active behavior contract.
  • Prompt preview behavior is explicit: either debug-only/no mutation, or a clear read-only projection of the current timing state.
Originally created by @Xelvanis on GitHub (May 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1548 Found during the 2026-05-29 native Tauri Lorebooks QA/code-path audit on `origin/refactor` commit `f120eb33`. ## What happened Lorebook entry timing controls are exposed in the editor and stored on entries, but the runtime prompt activation path does not persist or reuse timing state. `ephemeral` appears to be saved/normalized but not consumed by activation at all. ## Expected - `sticky` keeps an entry active for N messages after it triggers. - `cooldown` prevents immediate reactivation until N messages pass. - `delay` waits N messages before first activation and then allows activation once the delay state counts down. - `ephemeral` auto-disables or decrements per chat after N activations, matching the type comment for per-chat overrides. ## Actual The active prompt path calls `scanForActivatedEntries(...)` without passing `timingStates`, and no generation/prompt path found by source search calls `updateTimingStatesForScan(...)` or writes `chat.metadata.entryTimingStates` / `entryStateOverrides` after activation. Consequences from the current code path: - `sticky` has no prior state to keep an entry active. - `cooldown` has no persisted state, so activations are not throttled across turns. - `delay` entries can be blocked forever because the delay state is never initialized/decremented by the runtime path. - `ephemeral` is normalized from storage but not checked or decremented by `scanForActivatedEntries(...)`. ## Evidence Relevant code paths inspected: - `src/engine/generation/prompt-assembly.ts` normalizes `sticky`, `cooldown`, `delay`, and `ephemeral`, then calls `scanForActivatedEntries(...)` without timing-state options. - `src/engine/generation-core/lorebooks/keyword-scanner.ts` defines `updateTimingStatesForScan(...)`, but repo search found no runtime caller. - `src/engine/contracts/types/chat.ts` defines `entryStateOverrides` and `entryTimingStates`, but repo search found no prompt-generation writeback path. - `src/features/catalog/lorebooks/components/LorebookEntryRow.tsx` exposes the Timing controls and autosaves those fields. ## Acceptance criteria - Runtime generation loads per-chat lorebook timing state before scanning and persists the updated state after scanning. - `sticky`, `cooldown`, and `delay` behave across turns in a focused prompt-generation test. - `ephemeral` either receives a real per-chat decrement/disable implementation or is removed/hidden from the active behavior contract. - Prompt preview behavior is explicit: either debug-only/no mutation, or a clear read-only projection of the current timing state.
bsakaguchi 2026-10-20 17:33:27 +07:00
Author
Owner

@Promansis commented on GitHub (May 29, 2026):

Closing issue with PR #1565

<!-- gh-comment-id:4580599146 --> @Promansis commented on GitHub (May 29, 2026): Closing issue with PR #1565
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#793
No description provided.