mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5943] Constant forced lorebook entries escape the location budget via the scan-then-merge seam, and the skip records overstate drops #3286
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#3286
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 @kolacheee on GitHub (Sep 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5943
Originally assigned to: @SpicyMarinara on GitHub.
Found while verifying the #5942 branch; the defect predates it and affects existing callers.
In
processLorebooks(packages/server/src/services/lorebook/index.ts, ~:1199-1200 on staging0d66e67a4), forced entries go throughapplyCurrentLocationLoreBudget— but the ordinary scan runs right after overallEntries, and a constant entry activates there with zero messages (keyword-scanner.ts:~562).mergeActivatedEntriesthen re-admits the very entry the location budget just dropped, while the skip record for it is still emitted unconditionally.Consequences for the existing forced-entry callers (
/setup's block and the spatial-projection caller, both on the 2,048-token default budget):The #5942 branch closes this for its own route (the new
forcedEntriesOnlymode skips the ordinary scan outright), but the shared shape stays as-is for the older callers — fixing it for them changes long-standing prompt-assembly behavior and deserves its own decision rather than riding along.@kolacheee commented on GitHub (Sep 8, 2026):
Additional measured instance of the same shape, found while closing the #5942 branch — folding it here so the issue carries the full map:
resolveBudgetAndRecursivelyActivateLorebookEntriesWithDiagnostics(index.ts:907-910) opens with the same scan-then-merge —frontier = mergeActivatedEntries(scanForActivatedEntries(messages, entries, scanOptions), initialActivatedEntries)— one level below the site described above. So when any participating book hasrecursiveScanningon,anyRecursiveis legitimately true and the location-budget drops are re-admitted there, even after the top-level scan is suppressed.Measured live through the experience-generation route on the #5942 branch (10 forced constants × 400 tokens against a 3,000-token wall, book budget 8,000, picked book with
recursiveScanning: true):present [0..9], includedEntries 10, skipped ["vault 7","vault 8","vault 9"]— 13 accounted for out of a 10-id selection; the non-recursive control gives the correctpresent [0..6], included 7, skipped 3.The branch documents this door in its route comment rather than patching it, because the only local gate (forcing
anyRecursiveoff under the exact-selection flag) would leave the book-filter suppression with no observable and the shape genuinely belongs to this issue: it hits/setupand the spatial-projection caller identically today.@SpicyMarinara commented on GitHub (Sep 8, 2026):
The new Experience exact-selection path is now guarded in #5944 (
6b611eb88): forcedEntriesOnly skips recursive activation, because explicitly chosen entries have already passed the selection budget. A red/green route regression covers a selected recursive book as well as a non-recursive one and requires included/skipped totals to reconcile. This does not change legacy /setup or spatial caller behavior, so this issue remains open for those shared scan-then-merge paths.@SpicyMarinara commented on GitHub (Sep 8, 2026):
Ownership: @SpicyMarinara, implemented by Codex for this issue sweep. No existing open PR or issue-linked branch covers this fix. Work is on fix/lorebook-location-budget-5943 with a draft PR targeting staging; the patch will preserve the shared location budget across ordinary and recursive scans.