mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3384] [Issue]: Lorebook Keeper "Proposed Text" omits the proposed newFacts for updates to existing entries #1831
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#1831
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 (Jul 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3384
Originally assigned to: @SpicyMarinara on GitHub.
Reported against v2.1.0; confirmed still present on v2.1.1 (verified against source).
What's wrong
When Lorebook Keeper proposes an update to an existing lorebook entry, the "Proposed Text" in the review modal shows the entry's existing/echoed content and leaves out the actual facts being proposed (
newFacts). So you review roughly what the entry already says, not what's being added. Brand-new entries preview correctly — it's only updates to existing entries where the newFacts go missing from the preview. (You can confirm the newFacts exist by checking the agent's response in the console:"newFacts": [...]— those items aren't in the Proposed Text.)How to reproduce (try it yourself)
You'll see: the Proposed Text shows the existing/echoed entry content; the proposed
newFacts(visible in the console response) are absent.Expected: the Proposed Text shows what will actually be committed — the existing entry plus the new facts.
Where it is
packages/server/src/routes/generate/agent-write-approval.ts— the preview is built byformatLorebookWriteApprovalText(61-77) →readUpdateContent(24-33), which returnsupdate.content(orupdate.entry.content) if present and only falls back to formattingnewFactswhen there is no content:The Lorebook Keeper is instructed (
packages/shared/src/constants/agent-prompts.ts~165-174) to return onlynewFactsfor updates and usecontentonly for empty/malformed entries — but the model frequently returns acontenttoo (echoing/rewriting the current entry). When it does, the preview shows that content and drops thenewFacts.By contrast, the commit path merges:
persistLorebookKeeperUpdates(lorebook-keeper-utils.ts:409-416) usesmergeLorebookKeeperUpdateContent(271-305) with existing + replacement + newFacts. So the preview is built by a different, incomplete path than the commit — it doesn't reflect what will be saved. The proposal is assembled from the raw agent updates (generate.routes.ts:3097, 3135) with no existing-entry lookup.⚠️ Also worth verifying — possible newFacts loss at commit (not just preview): when an update has
action:"update"and a non-emptycontent, the commit takes thegetExplicitUpdateReplacementContentbranch (lorebook-keeper-utils.ts:409-411→307-315), which treats that content as a wholesale replacement and also dropsnewFacts. If the model's echoedcontentdoesn't already contain the new facts, they may not just be hidden from the preview — they may not be saved at all. Please check whether newFacts survive to the committed entry in this case.What's happening
The approval preview and the commit use different content logic. The preview is content-first and treats
newFactsas a fallback, so any update carrying acontenthides itsnewFacts. New entries put their real text incontent, so they preview fine; updates (whose delta lives innewFacts) don't.Suggested fix
Build the preview from the same merge the commit uses — resolve the existing entry and show
mergeLorebookKeeperUpdateContent(existing, replacement, newFacts), so "Proposed Text" is exactly what will be committed (existing + new facts). This means the proposal builder (buildLorebookWriteApprovalProposal/ its call site atgenerate.routes.ts:3135) needs the existing entry content, which it doesn't currently fetch. Also reconsider whether an update carryingcontentshould dropnewFactsat commit at all (the instructions reservecontentfor empty/malformed entries).Related enhancement (also requested): once the newFacts are shown, highlight/diff them against the original so it's clear what's new vs. original text (render the appended facts distinctly, or a small diff view). Even when displayed, it's hard to tell new from existing.
AI-investigated against v2.1.1 (
git describe= v2.1.1); the preview builder, the keeper output schema, and the commit merge/replace paths were all read and confirmed. The preview-drops-newFacts behavior is verified from the code; the commit-loss angle depends on the model includingcontent— please verify on a real proposal before fixing.@SpicyMarinara commented on GitHub (Jul 8, 2026):
Addressed in #3388 and merged to staging.