mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2448] [Issue]: 12-PROMPT-RUNTIME-lorebook-injection-budget-depth drops later smaller entries after budget skip #1202
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1202
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Promansis on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2448
Originally assigned to: @Promansis on GitHub.
Summary
12-PROMPT-RUNTIME-lorebook-injection-budget-depthparity gap from #2442 Batch 5: refactor treats the first over-budget lorebook entry as exhausting that lorebook/chat budget, so later smaller entries can be dropped. Legacy skips the over-budget entry but continues evaluating later candidates.Expected behavior
Legacy behavior: lorebook budget selection skips an entry that exceeds the per-lorebook or chat token budget, records diagnostics, and continues checking later candidates that may still fit.
Acceptance criteria:
Actual behavior
Refactor sets
exhaustedLorebookIdsorchatBudgetExhaustedwhen an entry is skipped, and subsequent candidates are treated as over budget even if they would fit remaining budget.Steps to reproduce
Impact area
Environment
Logs, screenshots, or video
Proof:
lorebookBudget > 0 && lorebookTokens + entryTokens > lorebookBudgetandtokenBudget > 0 && state.totalTokens + entryTokens > tokenBudget, then returns a skipped diagnostic without marking the entire budget exhausted:main:packages/server/src/services/lorebook/index.ts:428-456.state.exhaustedLorebookIds.has(...)andstate.chatBudgetExhaustedto the over-budget checks, and sets those flags on a skip:src/engine/generation/active-lorebook-scanner.ts:653-664,src/engine/generation/active-lorebook-scanner.ts:679-717.src/engine/generation/prompt-assembly.ts:3485-3488.Files inspected:
main:packages/server/src/services/lorebook/index.tsmain:packages/server/src/services/lorebook/prompt-injector.tsmain:packages/server/src/routes/generate.routes.tsmain:packages/server/src/services/prompt/assembler.tssrc/engine/generation/active-lorebook-scanner.tssrc/engine/generation-core/lorebooks/prompt-injector.tssrc/engine/generation/prompt-assembly.tssrc/engine/generation-core/lorebooks/active-lorebook-scope.tsRegression notes
Legacy
mainbehavior was traced as source of truth for #2442. This is a refactor parity gap in prompt assembly lorebook injection budgeting.Additional context
Linked tracker: #2442
Surface:
12-PROMPT-RUNTIME-lorebook-injection-budget-depthBatch 5 also scanned
12-PROMPT-RUNTIME-lorebook-scan-activationand found no gap; no issue filed for that surface.Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: