[PR #814] [MERGED] Show lorebook budget skips in Active World Info #4787

Closed
opened 2026-10-22 04:10:39 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/814
Author: @cha1latte
Created: 5/14/2026
Status: ✅ Merged
Merged: 5/14/2026
Merged by: @cha1latte

Base: main ← Head: feat/issue-743-lorebook-budget-diagnostics


📝 Commits (3)

  • 47d8266 Show lorebook budget skip diagnostics
  • f14c88f Address review feedback for lorebook budget diagnostics
  • f1a7145 Merge remote-tracking branch 'upstream/main' into fix/pr-814-review-feedback

📊 Changes

7 files changed (+364 additions, -38 deletions)

View changed files

➕ docs/pr-evidence/issue-743-active-world-info.png (+0 -0)
📝 packages/client/src/components/chat/ActiveWorldInfoButton.tsx (+5 -2)
📝 packages/client/src/components/chat/ChatRoleplayPanels.tsx (+88 -3)
📝 packages/client/src/hooks/use-lorebooks.ts (+15 -0)
📝 packages/server/src/routes/lorebooks.routes.ts (+1 -0)
📝 packages/server/src/services/lorebook/index.ts (+184 -33)
📝 packages/server/test/lorebook-processing.test.ts (+71 -0)

📄 Description

Linked issue

Closes #743

Why this change

  • Lorebook entries can match but still be omitted when either the per-lorebook token budget or chat-level lorebook token budget is exhausted. This makes Active World Info look like the entries never triggered, so users have to guess whether keys, activation rules, or budgets are responsible.

What changed

  • Tracks matched lorebook entries skipped specifically by token budget during lorebook selection.
  • Returns skipped-entry diagnostics from the Active World Info scan endpoint.
  • Shows a compact expandable warning in Active World Info with the skipped entry, lorebook name, matched key, estimated tokens, and budget used/cap.
  • Adds server coverage for per-lorebook and chat-level budget skip diagnostics.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Codex ran pnpm --filter @marinara-engine/server exec tsx --import ./test/setup-env.ts --test test/lorebook-processing.test.ts; all 29 lorebook processing tests passed.
  • Codex ran pnpm check; impeccable context, lint, and build passed.
  • Codex ran the app locally with seeded proof data: one lorebook entry injected and one matching entry skipped by the lorebook token budget.
  • Codex verified the Active World Info panel in Chromium: the skipped-entry warning expands to show Skipped Lore, matched key budget-key, estimated ~30 tokens, and budget used/cap 40 / 50.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

No docs, release metadata, schema, dependency, or version files changed.

UI evidence (if applicable)

Active World Info budget skip diagnostics

Summary by CodeRabbit

  • New Features
    • World Info panel now shows entries skipped due to budget limits, with expandable lists of skipped lorebook items and matched keys.
    • Each skipped entry displays reason (lorebook, chat, or both), estimated tokens, and per-entry budget-usage attribution.
    • The World Info button visually treats skipped-entries as active so it reflects skipped content availability.

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/814 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/14/2026 **Status:** ✅ Merged **Merged:** 5/14/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `main` ← **Head:** `feat/issue-743-lorebook-budget-diagnostics` --- ### 📝 Commits (3) - [`47d8266`](https://github.com/Pasta-Devs/Marinara-Engine/commit/47d826613a750d12fd5bdc1060532a14ff157372) Show lorebook budget skip diagnostics - [`f14c88f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f14c88f81aca0842d5bc7cf660d931a037577278) Address review feedback for lorebook budget diagnostics - [`f1a7145`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f1a7145514ddce5dedd201e689871452c6907724) Merge remote-tracking branch 'upstream/main' into fix/pr-814-review-feedback ### 📊 Changes **7 files changed** (+364 additions, -38 deletions) <details> <summary>View changed files</summary> ➕ `docs/pr-evidence/issue-743-active-world-info.png` (+0 -0) 📝 `packages/client/src/components/chat/ActiveWorldInfoButton.tsx` (+5 -2) 📝 `packages/client/src/components/chat/ChatRoleplayPanels.tsx` (+88 -3) 📝 `packages/client/src/hooks/use-lorebooks.ts` (+15 -0) 📝 `packages/server/src/routes/lorebooks.routes.ts` (+1 -0) 📝 `packages/server/src/services/lorebook/index.ts` (+184 -33) 📝 `packages/server/test/lorebook-processing.test.ts` (+71 -0) </details> ### 📄 Description ## Linked issue Closes #743 ## Why this change - Lorebook entries can match but still be omitted when either the per-lorebook token budget or chat-level lorebook token budget is exhausted. This makes Active World Info look like the entries never triggered, so users have to guess whether keys, activation rules, or budgets are responsible. ## What changed - Tracks matched lorebook entries skipped specifically by token budget during lorebook selection. - Returns skipped-entry diagnostics from the Active World Info scan endpoint. - Shows a compact expandable warning in Active World Info with the skipped entry, lorebook name, matched key, estimated tokens, and budget used/cap. - Adds server coverage for per-lorebook and chat-level budget skip diagnostics. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Codex ran `pnpm --filter @marinara-engine/server exec tsx --import ./test/setup-env.ts --test test/lorebook-processing.test.ts`; all 29 lorebook processing tests passed. - Codex ran `pnpm check`; impeccable context, lint, and build passed. - Codex ran the app locally with seeded proof data: one lorebook entry injected and one matching entry skipped by the lorebook token budget. - Codex verified the Active World Info panel in Chromium: the skipped-entry warning expands to show `Skipped Lore`, matched key `budget-key`, estimated `~30 tokens`, and budget used/cap `40 / 50`. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) No docs, release metadata, schema, dependency, or version files changed. ## UI evidence (if applicable) ![Active World Info budget skip diagnostics](https://raw.githubusercontent.com/cha1latte/Marinara-Engine/47d826613a750d12fd5bdc1060532a14ff157372/docs/pr-evidence/issue-743-active-world-info.png) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * World Info panel now shows entries skipped due to budget limits, with expandable lists of skipped lorebook items and matched keys. * Each skipped entry displays reason (lorebook, chat, or both), estimated tokens, and per-entry budget-usage attribution. * The World Info button visually treats skipped-entries as active so it reflects skipped content availability. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/814) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:10:39 +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#4787
No description provided.