mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5953] World generation shouldn't cap how much lorebook a player can feed it #3294
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#3294
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/5953
Originally assigned to: @SpicyMarinara on GitHub.
Maintainer call: there shouldn't be a cap here. If a player wants to throw a 200k-token lorebook at world generation, that's their prerogative.
Three walls stand between a selection and the model today, and removing the obvious one barely helps.
EXPERIENCE_LORE_TOKEN_BUDGET(packages/server/src/routes/game.routes.ts:10772), passed ascurrentLocationTokenBudgetand applied inapplyCurrentLocationLoreBudget(services/lorebook/index.ts:641-673). Whole entries are dropped once the running total exceeds it.0disables it, following the same convention as every other budget in that file.tokenBudget— default 2,048 (db/schema/lorebooks.ts:13), applied after the first wall intrySelectBudgetedLorebookEntry(services/lorebook/index.ts:692-694), and not overridable by any caller: there's no field for it on theprocessLorebooksoptions bag, and every read comes straight off the DB row. It's editable by the book's owner in the lorebook editor (LorebookEditor.tsx:2302-2318,0= unlimited and persists as0).game.routes.ts:10818) and each book'sentryLimit(default 100). Neither is about tokens.So raising or deleting the constant in (1) buys nothing once a selection exceeds 2,048 tokens from a single book — the book's own wall cuts it, and the player has no way to know why. The route also never wires the chat's own configured lorebook budget (
resolveLorebookTokenBudget), silently using the 8,192 default instead — worth deciding deliberately while we're here.Suggested shape: an explicitly picked entry bypasses both budget walls. Those budgets exist to stop automatic keyword/semantic activation from eating a chat's context. An entry the player ticked by hand isn't automatic — it's an instruction. That makes the feature behave the way the picker's UI already implies, without asking players to go edit the token budget of every book they own.
Prerequisite: #5952, or this fails badly instead of failing usefully. Nothing else in the Engine binds first — there's no per-entry content cap, the request body limit never sees the lore (the server resolves it from storage), and the output cap is independent. The first real wall is the model's own context window, and this route never calls
fitMessagesToModelAccessContextthe way its six siblings do. Today an oversized prompt comes back as a generic provider rejection →422withtruncated: false(game.routes.ts:11089-11101), which is not the truncation shape that triggers a retry. Pixelforge then shows "The world didn't finish being written… a shorter, plainer setting description is the likeliest thing to change it" (packages/pixelforge/src/60-save.js:291-293) — blaming the player's typed setting when the real cause was their lore picks, which are never mentioned and only visible in devtools.So either land context-fitting first, or uncap and fix that failure message in the same change so an over-large selection says so plainly.
Package side follows, not leads: Pixelforge 0.16.2's picker computes its own running counts against these same walls so it never promises a selection the server will trim. Whatever the server does here, the picker's arithmetic has to move with it or it will start refusing selections the server would happily accept.
@SpicyMarinara commented on GitHub (Sep 8, 2026):
Ownership: @SpicyMarinara, implemented by Codex in this sweep together with #5952. The Engine draft on fix/worldgen-selected-lore-context-5952-5953 will preserve explicit selections in full and enforce the model context boundary. Pixelforge picker arithmetic and error copy belong to Marinara-Agents and will be updated there in a linked staging PR.