[GH-ISSUE #1547] [Issue]: Lorebook token budget controls are saved but not applied to prompts #790

Closed
opened 2026-10-20 17:33:25 +07:00 by bsakaguchi · 0 comments
Owner

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

Originally assigned to: @Xelvanis on GitHub.

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

Proof method: seeded disposable lorebook/chat records through the app's Tauri storage API, then ran the app's own prompt-preview assembly from the native WebView. The same pass included positive controls for selected, global, character-scoped, persona-scoped, and roleplay-trigger-filtered entries.

What happened

Lorebook token-budget controls are saved but not applied by prompt activation.

Repro

  1. Create a chat with metadata.lorebookTokenBudget: 1.
  2. Attach multiple active lorebook entries whose combined content is well over one estimated token.
  3. Run prompt preview / active world-info scan.

Expected

The chat's lorebook token budget should limit injected lorebook entries, or the UI should not present the setting as controlling prompt activation.

Actual

Prompt preview still injected all active lorebook entries. In QA, the preview included direct, disabled-folder, scan-depth, recursion-parent, roleplay-trigger, global, character-scoped, and persona-scoped lore markers despite the chat metadata budget being 1.

This is distinct from #1533, which tracks tokenizer-backed estimates. This bug is about the configured budget not being read/applied at all.

Likely owner

src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx saves metadata.lorebookTokenBudget, but src/engine/generation/prompt-assembly.ts calls:

processActivatedEntries(activated, readNumber(input.request.lorebookTokenBudget, 0));

The prompt-preview input and generation request schema do not appear to pass the chat metadata value into input.request.lorebookTokenBudget.

Per-lorebook tokenBudget is also saved on lorebook records, but the prompt assembly path does not use that value when processing selected books.

Acceptance criteria

  • The chat-level lorebook token budget saved in metadata is applied to prompt assembly for preview and generation, or the UI contract is changed.
  • Clarify or implement per-lorebook tokenBudget behavior so the record field is not misleading.
  • Add regression coverage proving over-budget lore entries are skipped from assembled prompts.
Originally created by @Xelvanis on GitHub (May 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1547 Originally assigned to: @Xelvanis on GitHub. Found during the 2026-05-29 native Tauri Lorebooks QA pass on `origin/refactor` commit `f120eb33`. Proof method: seeded disposable lorebook/chat records through the app's Tauri storage API, then ran the app's own prompt-preview assembly from the native WebView. The same pass included positive controls for selected, global, character-scoped, persona-scoped, and roleplay-trigger-filtered entries. ## What happened Lorebook token-budget controls are saved but not applied by prompt activation. ## Repro 1. Create a chat with `metadata.lorebookTokenBudget: 1`. 2. Attach multiple active lorebook entries whose combined content is well over one estimated token. 3. Run prompt preview / active world-info scan. ## Expected The chat's lorebook token budget should limit injected lorebook entries, or the UI should not present the setting as controlling prompt activation. ## Actual Prompt preview still injected all active lorebook entries. In QA, the preview included direct, disabled-folder, scan-depth, recursion-parent, roleplay-trigger, global, character-scoped, and persona-scoped lore markers despite the chat metadata budget being `1`. This is distinct from #1533, which tracks tokenizer-backed estimates. This bug is about the configured budget not being read/applied at all. ## Likely owner `src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx` saves `metadata.lorebookTokenBudget`, but `src/engine/generation/prompt-assembly.ts` calls: ```ts processActivatedEntries(activated, readNumber(input.request.lorebookTokenBudget, 0)); ``` The prompt-preview input and generation request schema do not appear to pass the chat metadata value into `input.request.lorebookTokenBudget`. Per-lorebook `tokenBudget` is also saved on lorebook records, but the prompt assembly path does not use that value when processing selected books. ## Acceptance criteria - The chat-level lorebook token budget saved in metadata is applied to prompt assembly for preview and generation, or the UI contract is changed. - Clarify or implement per-lorebook `tokenBudget` behavior so the record field is not misleading. - Add regression coverage proving over-budget lore entries are skipped from assembled prompts.
bsakaguchi 2026-10-20 17:33:25 +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#790
No description provided.