mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2980] [Issue]: Explicit Lorebook Keeper update is ignored for the nested-entry output shape, turning replacements into appends #1555
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#1555
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 (Jun 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2980
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
On the direct (non-approval) keeper path, when the model emits an explicit replacement using the nested-entry shape
{ action:"update", entryName:"X", entry:{ content:"..." } }, the keeper does not replace the entry.getExplicitUpdateReplacementContentonly inspects the top-levelupdate.contentand ignoresentry.content, so it returns null and the code falls through tomergeLorebookKeeperUpdateContent, which appends. An entry the model intended to fully rewrite (e.g. "the castle is now destroyed") ends up with old and new — often contradictory — content concatenated. The canonical prompt instructs the flat shape, so this fires only when the model drifts to the nested shape, which the codebase explicitly tolerates everywhere else.How to reproduce (try it yourself)
{"action":"update","entryName":"Castle","entry":{"content":"The castle has been destroyed and lies in ruins."}}.You'll see: the entry becomes "The castle stands proud and intact.\n\nThe castle has been destroyed and lies in ruins." — contradictory content.
Expected: a full replacement, as with the flat
{action:"update", entryName, content}shape.Where it is
packages/server/src/routes/generate/lorebook-keeper-utils.ts:307-313(getExplicitUpdateReplacementContentchecks only the top-levelupdate.content) vs:334-341(readKeeperUpdateContent, which is nested-aware viareadNestedEntry).:407-414; append behavior at:282-290.What's happening
All the other keeper field readers (
readKeeperUpdateName/Content/Keys/Tag) consult both the top-level update and the nestedupdate.entryobject, butgetExplicitUpdateReplacementContentonly checks the top-levelupdate.content. The two readers are inconsistent, so an explicit replacement in the supported nested shape is misclassified as a non-replacement and merged (appended) instead.Suggested fix
Make
getExplicitUpdateReplacementContentuse the same nested-aware read as the rest of the file (reusereadNestedEntry/readKeeperUpdateContent): treataction === "update"with non-empty resolved content (top-level orentry.content) as a full replacement.AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed in the v2.0.7 branch: explicit Lorebook Keeper update replacements now read nested entry.content as well as top-level content, so nested action:update proposals replace instead of append. Validated with pnpm check and pnpm regression:prompt.