mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
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#7721
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7413
Author: @SpicyMarinara
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/mari-lorebook-entries-offset📝 Commits (4)
41f1534fix(mari): page lorebook.entries with offset and nextOffset (#7407)2d246d2fix(mari): pagemari lorebooks entriesthe same way546e281fix(mari): keep every lorebook.entries page usable8f3fa01fix(mari): flag shortened entry keys and list --offset in help📊 Changes
7 files changed (+273 additions, -38 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
packages/server/src/services/mari-db/mari-db.service.ts(+67 -27)📝
packages/server/src/services/professor-mari/workspace-agent.service.ts(+4 -3)📝
scripts/regressions/mari/db-review-durability.regression.ts(+4 -4)📝
scripts/regressions/mari/decision-authoring.regression.ts(+5 -3)➕
scripts/regressions/mari/lorebook-entries-paging.regression.ts(+191 -0)📝
scripts/regressions/open-issues.regression.ts(+1 -1)📄 Description
Linked issue
Closes #7407
Thanks to @bahaynes for the report and the repro script, which made this a quick fix.
Why this change
app_datalorebook.entriesreadlimitbut neveroffset, and it returned a bare array with nototalornextOffset. So every request for "the rest" returned the same first page. That page was also more than twice the 24k read budget (52k characters for 100 entries), so even its tail was cut off before she saw it.instruction.listandskill.listwere already paged for this reason.lorebook.entrieswas not.What changed
lorebook.entries(inpackages/server/src/services/mari-db/mari-db.service.ts) now pages likeinstruction.list. It honorsoffset(throughnormalizeOffset) and returns{ items, total, offset, nextOffset }. The shell commandmari lorebooks entries <id>had the same filter, sort and bug. It now shares the newpageLorebookEntrieshelper, accepts--offsetand returns the same pages. Entries are added until the next one would push the pretty-printed page pastMARI_READ_OUTPUT_BUDGET. The first entry is always kept, so paging always moves forward.limitstill caps a page (default 100, max 2000). On the reporter's 190-entry lorebook this gives pages of 43, 43, 43, 43 and 18 entries, each under 24k characters.Every field in the entry index row is now bounded:
descriptionis cut to 200 characters (ascontentalready was),nameto 200,tagto 100, andkeysto at most 50 keys of 100 characters each. Without this, one entry with a long description or a huge key list fills the page by itself, andboundReadObjecthides the wholeitemsarray, ids included. A row whose key list was cut carrieskeysTruncated: true, so Mari knows to read the entry before changing its keys (apatch.keysreplaces the whole list).lorebook.getEntrystill returns the full entry.normalizeLimitnow floors before its positivity check. A limit such as0.5falls back to the default instead of becoming 0. Before, it gave an empty page whosenextOffsetpointed back at the same offset, so a pager would loop forever. I checked every caller in the file: all of them use a positive fallback, except themari db listoffset, whose fallback of 0 gives the same result as before.Professor Mari's
app_datatool description, itsoffsetparameter and the "Lorebook reading" guidance in her system prompt now tell her to call again withoffset: nextOffsetuntil it is null. The guidance also tells her to read every page before deleting or reordering entries (that shifts later pages), and to calllorebook.getEntrybefore changing the keys of an entry markedkeysTruncated: true.mari lorebooks helpnow lists--offsetforentries.Consumers of the old array shape: three regressions (
open-issues,mari/db-review-durability,mari/decision-authoring) now read.items. Their assertions are unchanged. No client change was needed:listRecords/countMariListOutputinpackages/client/src/lib/mari-referenced-resources.tsalready read the first array in an object. The new regression pins that behaviour.New regression
scripts/regressions/mari/lorebook-entries-paging.regression.ts. It walks a 190-entry lorebook to the end and checks every entry once, in order, with distinct ids and every page under budget. It also checks:{ limit: 50, offset: 150 }call, a smalllimit, a0.5limit, and an offset past the end;lorebook.getEntrystill returns key 400;keysTruncated: trueon the 400-key entry and on an entry with one 140-character key, and no flag on ordinary entries or on 50 keys of exactly 100 characters;mari lorebooks helplists--offsetforentries.The regression fails on
origin/staging, which returns a bare array. It also fails with each hardening reverted: without the field bounds, the heavy entry's page is elided; without thenormalizeLimitchange, a fractional limit returns no entries; without thekeysTruncatedflag or the help line, their assertions fail.CHANGELOG.md: one entry under Unreleased.Validation
pnpm checkpasses locallyCONTRIBUTING.mdCommands run:
pnpm check;node ./scripts/run-regressions.mjs --filter scripts/regressions/mari/lorebook-entries-paging.regression.ts(also againstorigin/stagingcode, where it fails);--filterforscripts/regressions/open-issues.regression.ts,scripts/regressions/mari/db-review-durability.regression.ts,scripts/regressions/mari/decision-authoring.regression.ts,scripts/regressions/command-center.regression.ts,scripts/regressions/mari/instructions-memory.regression.ts;--filter scripts/regressions/mari/(15 files);--filter scripts/regressions/professor-mari(16 files);pnpm regression:prompt; and the other 12 regressions that use the Mari DB service, becausenormalizeLimitis shared:package-table-registration,chat-diagnose,mari-completion-frames,agent-home-widgets,lorebook-test-scan,persona-api-decoded-reads,experience-state-imported-anchors,extension-security,mari-write-readback,lorebook-entry-message-provenance,lorebook-decision-activation,storage-writer-lock. All of these were rerun after the review fixes in8f3fa0171, and the new regression fails with either the help line or thekeysTruncatedflag reverted.Manual verification notes
lorebook.entriesagain withoffsetand name entries from the end of the lorebook.lorebook.entriesstep reads "Read · · N entries", with N the entries on that page, and that entries she names in her answer still link to the lorebook editor.lorebook.getEntryfirst and keeps every existing key.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)No files under
docs/changed, so no[docs-i18n]follow-up is needed.CHANGELOG.mdhas one Unreleased entry.UI evidence (if applicable)
Not applicable. This is a server-side read and prompt change with no UI change.
Local CodeRabbit review
I ran local CodeRabbit reviews (
coderabbit review --agent --committed). Every finding was fixed and none was rejected.mari lorebooks entriesstill ignored--offsetand returned a bare array. Fixed in2d246d227with the sharedpageLorebookEntrieshelper.limitproduced an empty page whosenextOffsetdid not move, and an entry with a hugekeyslist could still overflow a page by itself. Both fixed in546e281ff(normalizeLimitfloors first, and every index field is bounded). Both are pinned by the regression.8f3fa0171: no findings.Adversarial review follow-up
All three findings were traced and fixed in
8f3fa0171; none was rejected.lorebook.updateEntrypatch.keysreplaces the whole list, so a keys edit built from the index could drop keys or save a cut regex. Fixed: such rows now carrykeysTruncated: true, and the "Lorebook reading" guidance says to calllorebook.getEntrybefore changing those keys. Pinned by the regression.offset, so an appliedlorebook.deleteEntryor anorderchange shifts later pages.instruction.listpages the same way, and staging could not reach later pages at all, so this is not a regression. Fixed with one guidance sentence telling Mari to read every page before deleting or reordering entries. A cursor (afterEntryId) would also break on reorders and adds a second paging scheme, so I kept the offset contract shared withinstruction.list. This is prompt guidance only, with no dedicated test.mari lorebooks helpdid not list--offset. Confirmed. Fixed in the help text, pinned by the regression.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.