[PR #2456] [MERGED] Fix lorebook budget skip selection #5613

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2456
Author: @Promansis
Created: 6/6/2026
Status: ✅ Merged
Merged: 6/6/2026
Merged by: @Promansis

Base: refactor ← Head: fix/issue-2448-lorebook-budget-selection


📝 Commits (1)

  • 9c26a8c Fix lorebook budget skip selection

📊 Changes

2 files changed (+12 additions, -42 deletions)

View changed files

📝 src/engine/generation/active-lorebook-scanner.test.ts (+10 -12)
📝 src/engine/generation/active-lorebook-scanner.ts (+2 -30)

📄 Description

Linked issue

Closes #2448

Why this change

  • Refactor lorebook budget selection treated the first over-budget lorebook entry as exhausting that lorebook/chat budget, which dropped later smaller candidates that still fit remaining budget.

What changed

  • Removed persistent per-lorebook/chat budget exhaustion flags from active lorebook selection.
  • Kept budget skip diagnostics for oversized entries while allowing later fitting entries through.
  • Updated scanner regression coverage for lorebook budget, chat budget, and recursive frontier selection.

Refactor impact

Primary owner:

engine generation

Impact areas reviewed:

  • Active lorebook scanning and budget selection.
  • Prompt assembly consumers that receive activated/skipped lorebook entries.
  • Recursive lorebook frontier selection.

Boundary notes:

  • Engine-only change; no React, shared API, Tauri/Rust, storage adapter, or remote runtime boundary changes.

Pressure points touched:

  • None of ModeSurface, GameSurface, shared mode UI, src-tauri command registration, or import modules.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • pnpm exec vitest run src/engine/generation/active-lorebook-scanner.test.ts passed: 1 test file, 13 tests.
  • pnpm typecheck passed.
  • Durable test rationale: this fixes a known prompt assembly regression where later lorebook entries could be silently dropped; existing type checks cannot prove budget selection semantics, and the updated scanner tests are narrow owner-level coverage for lorebook/chat budget behavior and skipped diagnostics.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Bugfix for existing lorebook budget selection behavior.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

  • Not applicable; engine-only prompt selection fix.

🔄 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/2456 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 6/6/2026 **Status:** ✅ Merged **Merged:** 6/6/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `fix/issue-2448-lorebook-budget-selection` --- ### 📝 Commits (1) - [`9c26a8c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9c26a8c26c34f1d2878320dc485d078b94ca327d) Fix lorebook budget skip selection ### 📊 Changes **2 files changed** (+12 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/active-lorebook-scanner.test.ts` (+10 -12) 📝 `src/engine/generation/active-lorebook-scanner.ts` (+2 -30) </details> ### 📄 Description ## Linked issue Closes #2448 ## Why this change - Refactor lorebook budget selection treated the first over-budget lorebook entry as exhausting that lorebook/chat budget, which dropped later smaller candidates that still fit remaining budget. ## What changed - Removed persistent per-lorebook/chat budget exhaustion flags from active lorebook selection. - Kept budget skip diagnostics for oversized entries while allowing later fitting entries through. - Updated scanner regression coverage for lorebook budget, chat budget, and recursive frontier selection. ## Refactor impact Primary owner: engine generation Impact areas reviewed: - Active lorebook scanning and budget selection. - Prompt assembly consumers that receive activated/skipped lorebook entries. - Recursive lorebook frontier selection. Boundary notes: - Engine-only change; no React, shared API, Tauri/Rust, storage adapter, or remote runtime boundary changes. Pressure points touched: - None of ModeSurface, GameSurface, shared mode UI, src-tauri command registration, or import modules. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `pnpm exec vitest run src/engine/generation/active-lorebook-scanner.test.ts` passed: 1 test file, 13 tests. - `pnpm typecheck` passed. - Durable test rationale: this fixes a known prompt assembly regression where later lorebook entries could be silently dropped; existing type checks cannot prove budget selection semantics, and the updated scanner tests are narrow owner-level coverage for lorebook/chat budget behavior and skipped diagnostics. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Bugfix for existing lorebook budget selection behavior. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence - Not applicable; engine-only prompt selection fix. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:17:49 +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#5613
No description provided.