mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #6143] Lore attached to the place you are standing in can vanish from the prompt even when you type its keyword #3414
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#3414
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 13, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6143
Originally assigned to: @SpicyMarinara on GitHub.
When a location carries more attached lore than its reserved slice can hold, the entries that do not fit are not just left out of the location's own contribution, they are removed from the rest of the turn entirely. An entry whose keyword the player literally typed, an entry in the middle of an open sticky window, or an entry another entry would have pulled in, all stay out of the prompt while the player stands in that place, and all arrive normally the moment the entry is detached from the location. Being somewhere makes the model know less about it.
How to reproduce (try it yourself)
You need a Roleplay chat with World Maps enabled and a saved map with at least one location. No model reply is needed: the prompt peek shows the drop.
dragon, and paste about 1600 characters containing the marker word DRAGONMARK.I ask the innkeeper about the dragon.What you'll see: the five constant entries are in the prompt, the dragon entry is not. It is listed as skipped with blockedBy "location" and matchType "keyword". Total lore is about 2000 tokens against the chat's 8192 token lorebook budget, so there was plenty of room. Detach only the dragon entry from the location, leave everything else the same, and send the identical message: it now arrives through its keyword alongside the same five constants.
What should happen: the dragon entry arrives through its keyword either way. The location reserve should decide how much the location contributes, not whether the entry is allowed to activate at all.
Two more variants of the same drop, if you want to see the range:
ledger, Sticky 3. Send a message containingledgerwhile the location is not current, so the sticky window opens. Then make the location current and send a message that does not containledger. The entry is withheld even though its window is still open, and the window still counts down that turn.gate, untick its Prevent Recursion (it defaults to on, the repro fails without this), and give it content mentioningObsidian Order. Key the sixth entryObsidian Order. SendI approach the gate.: the parent arrives, the child does not. Detach the child from the location and it arrives as a recursive activation.Where it is
packages/server/src/services/lorebook/index.ts, inprocessLorebooksat stagingac14dd704:locationBudgetSkippedIdsfrom the location budget's skipped entries and filter them out ofallEntriesintoscannableEntries. There is no check for whether the entry was constant.scannableEntriestoscanForActivatedEntries(before PR #5976 this wasallEntries), which is the ordinary keyword, semantic and sticky scan.scannableEntriesas the entry pool for recursive activation.CURRENT_LOCATION_LORE_TOKEN_BUDGET = 2_048. No production caller overrides it, so it binds on every chat turn.What's happening
The location reserve is applied first, and every entry it declines is then deleted from the pool that the rest of the turn scans. Constants sort ahead of everything in the selection order, so the entries the reserve declines are structurally the non constant ones, which are exactly the entries that had another legitimate way into the prompt. Losing the location source therefore also loses the keyword match, the open sticky window, and recursion reachability.
Suggested fix
Make the location reserve bound the contribution of the location source only, and leave the entry eligible for everything else. An entry the reserve declines should still enter the ordinary keyword and semantic scan, should still be delivered by its own open sticky window, and should still be reachable as a recursive child. If it activates that way it should be charged against the ordinary chat wide lorebook budget and reported with its real activation source, and no "location" skip record should be left behind for an entry that is present in the prompt. That accounting change is what issue #5943's second complaint (an entry reported as set aside while being present) actually needs. The specific escape hatch #5943 named was a constant entry re activating with zero messages, so suppressing the constant re activation alone would close it.
This also matches the design documents:
docs/development/hierarchical-locations-prd-v3.mdline 76 calls a location attachment "an explicit chat-scoped activation source", line 356 calls the 2048 figure a total reserved cap per owner prompt, and line 357 says an entry activated by both location and ordinary keyword, semantic, recursive or constant rules is injected once and reports every activation source.One open question before anyone patches this: the discussion on #5943 said the patch would preserve the shared location budget across ordinary and recursive scans. Was removing location budget drops from the keyword, semantic, sticky and recursive sources intended, or was the target only the constant re activation? If the narrow shape is the intended one, note that the regression lane the PR added (
scripts/regressions/experience-lore-entries.regression.ts:255 to 281) pins only a dropped forced constant and a recursive child that is not in the forced selection, so narrowing the filter would not fight an existing assertion. The CHANGELOG line atCHANGELOG.md:227 says the change keeps rejected constant entries out of later scans, which is narrower than what the code does, so it would need a word either way.Context
Introduced by merged PR #5976, which closed issue #5943. PR #6137 did not touch this area: it changed only the per chat entry scope files, and nothing since has touched
services/lorebook/index.tsorkeyword-scanner.ts. Unreleased on staging (latest release tag is v2.4.4).Found by an AI-assisted sweep and re-verified against staging
ac14dd704on 2026-09-13. Please verify before fixing.@SpicyMarinara commented on GitHub (Sep 13, 2026):
Codex is addressing this report on behalf of @SpicyMarinara in draft PR #6168 as part of the requested issue sweep. I will verify the reported path against staging and preserve existing behavior outside the narrow fix.