mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #6131] Turning a spent one-shot lorebook entry back on for a chat makes it fire on every turn forever #3408
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#3408
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/6131
Originally assigned to: @SpicyMarinara on GitHub.
A lorebook entry set to fire a limited number of times (the Ephemeral field) turns its own chat switch off once it has fired that many times. If you turn that switch back on, the entry stops being limited: it fires on every single turn for the rest of that chat, and nothing turns it off again. Going back to the lorebook and setting Ephemeral again has no effect in that chat either, so there is no way to get the one-shot behaviour back.
How to reproduce (try it yourself)
Docks loreand turn ON its Global switch.Dockmaster rumor, Keysdock, ContentTHE DOCKMASTER WHISPERS ABOUT THE TIDE.(all caps so you can spot it in the prompt). Expand the entry and, in the Timing group (Sticky / Cooldown / Delay / Ephemeral), setEphemeralto1, leaveStickyat0. Save.I walk to the dock.The entry fires - the all-caps line appears in the world-info block of the prompt inspector.I walk to the dock.again. It does not fire. Correct - it was a one-shot.Docks lore(Edit lorebook entries). TheDockmaster rumorswitch is now OFF, with no explanation of why.I walk to the dock.four more times.Ephemeralto1again. Return to the chat and sendI walk to the dock.twice more.What you'll see: from step 8 onward the entry fires on every turn, the switch never turns itself off again, and the re-authored Ephemeral value in step 9 changes nothing - it still fires every turn.
What should happen: an entry the author marked
Ephemeral 1should fire at most once more after being re-enabled and then switch itself off again, or the switch should tell the player that turning it on makes this entry constant for the chat. Re-setting Ephemeral in the lorebook should at minimum take effect.Where it is
At staging
52799569c:packages/server/src/services/lorebook/index.ts:1296-1303- when the countdown runs out the chat override is written as{ ephemeral: 0, enabled: false }, and the decrement guard isa.entry.ephemeral > 0.packages/server/src/services/lorebook/index.ts:1135-1137-if (ov && ov.ephemeral !== undefined) return { ...e, ephemeral: ov.ephemeral }- the per-chat value replaces the authored one unconditionally.packages/server/src/routes/chats.routes.ts:1379-1384-PATCH /api/chats/:id/lorebook-entries/:entryIdmerges onlyenabled:{ ...overrides[entryId], enabled: parsed.data.enabled }, soephemeral: 0stays behind.packages/client/src/features/chat-settings/inline-editors/InlineLorebookEntriesEditor.tsx:177-180- the chat switch that the player clicks, which calls that route.What's happening
Each chat keeps its own copy of an entry's remaining activations. When the budget runs out, the chat's copy is saved as "0 left, off". The switch in chat settings only ever writes the on/off flag, so turning it back on leaves the remaining count at 0. On every later turn, that 0 replaces the author's value before the countdown code looks at it; the code only counts down when the number is above zero, so it never counts down and never switches the entry off again. Nothing else in the lorebook service reads that number, and nothing anywhere in the app can clear or edit a chat's copy - which is why re-setting Ephemeral in the shared lorebook is silently ignored in that chat.
The same route already returns a 409 ("Enable this entry in its lorebook first") specifically so a chat-level override can never overrule the shared lorebook's on/off state - but the same override does permanently overrule the shared lorebook's Ephemeral value, which looks unintended rather than designed.
Suggested fix
On a manual per-chat enable, the route should stop leaving a stale remaining count behind. The maintainer call to make is which of these:
ephemeralkey from the chat override so the authored value is read fresh from the lorebook - this also fixes the "author's edits are ignored in that chat" half;Note that (a) and (b) both change the contract stated in PR #5981 ("the server merges one flag atomically so ephemeral counters survive"), so this is a deliberate decision, not a silent patch. Whichever is chosen, the existing regression lane needs a case at zero:
scripts/regressions/chat-lorebook-entry-scope.regression.tsonly ever seedsephemeral: 3/2(lines 42, 50, 60, 63), which is the case that already works.Context
Introduced by PR #5981 ("keep chat entry toggles scoped to their chat", merged 2026-09-09), which implemented FR #5954. #5954 only asked for a per-chat enable/disable and says nothing about limited-activation entries, so this case was never specified; PR #5981's own regression and end-to-end lanes never seed a spent counter, so they pass while this is live. Related: #2975 (an entry firing fewer times than authored) was accepted and fixed - this is the same class in the other direction. Unreleased on staging (latest release tag is v2.4.4; PR #5981 landed after it). Chat-local: the shared lorebook row is never modified and other chats are unaffected, and the player can still turn the entry off again.
Found by an AI-assisted sweep of merged PR #5981 against issue #5954, then re-verified against staging
52799569con 2026-09-13. Please verify before fixing.@SpicyMarinara commented on GitHub (Sep 13, 2026):
@SpicyMarinara is taking this report through the issue sweep in draft PR #6137, with Codex assisting. The affected current-code path has been checked; implementation and focused regression verification are in progress.
@SpicyMarinara commented on GitHub (Sep 13, 2026):
Fixed in #6137, now merged to staging (
e044997a2). Re-enabling an exhausted lore entry resets its authored activation limit instead of making it unlimited.