mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[PR #1519] [MERGED] perf(long-term-memory): list the vault once per source batch (1.4.61) #1526
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#1526
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-Agents/pull/1519
Author: @Promansis
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @Promansis
Base:
staging← Head:fix(long-term-memory)/reconciliation-large-vaults📝 Commits (3)
10a45f2perf(long-term-memory): list the vault once per source batch (#1504)8ba56acMerge upstream/staging into fix(long-term-memory)/reconciliation-large-vaults; release long-term-memory 1.4.60722e7f5Merge upstream/staging into fix(long-term-memory)/reconciliation-large-vaults; release long-term-memory 1.4.61📊 Changes
18 files changed (+628 additions, -120 deletions)
View changed files
➕
artifacts/long-term-memory-1.4.61.zip(+0 -0)📝
catalog/catalog.json(+6 -6)📝
catalog/notes.json(+6 -6)📝
catalog/v2/catalog.json(+6 -6)📝
catalog/v2/notes.json(+6 -6)📝
catalog/v3/catalog.json(+6 -6)📝
catalog/v3/notes.json(+6 -6)📝
packages/long-term-memory/CHANGELOG.md(+4 -0)📝
packages/long-term-memory/manifest.json(+3 -3)📝
packages/long-term-memory/server.mjs(+41 -41)📝
packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/candidate-reconciliation.ts(+55 -30)📝
packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/extraction/source-processing.ts(+69 -5)📝
packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/persistence/mutation-transaction.ts(+6 -1)📝
packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/persistence/vault-snapshot.ts(+21 -2)📝
scripts/build-feature-packages.mjs(+1 -1)📝
tests/long-term-memory-candidate-reconciliation.regression.ts(+180 -0)📝
tests/long-term-memory-extraction-reliability.regression.ts(+158 -0)📝
tests/long-term-memory-storage.regression.ts(+54 -1)📄 Description
Pull request
Linked issue
Closes #1504
Why this change
What changed
long-term-memory: the batch lists the committed vault once and re-reads only the notes that later vault writes report (extraction/source-processing.ts). A write that names no files, or a failed re-read, lists the vault again.commitLtmMutationpasses the root-relative paths it writes toinvalidateLtmVaultSnapshot, which tells watchers registered with the newwatchLtmVaultWrites(persistence/mutation-transaction.ts,persistence/vault-snapshot.ts).extraction/candidate-reconciliation.ts). Same rules, 0.85 threshold and candidate order.candidateNotesrule table and a per-call read bound (candidate-reconciliation); the batch listing count, notes created and deleted by another writer mid-batch, and relists after writes that name no files (extraction-reliability); the write reports and watcher stop (storage).long-term-memory1.4.61, with the CHANGELOG entry, version, manifest, rebuiltserver.mjs, artifact and catalog entries, on top of staging653a20b11. Open #1516 also releases 1.4.61; whichever merges second is re-released on top of the other.Package and security impact
long-term-memoryValidation
node scripts/validate-catalog.mjspasses locallygit diff --checkpasses locallyCONTRIBUTING.mdManual verification notes
watchLtmVaultWritesdid not exist.await, thestop()guard), and each break fails its case.create()already validated; they only select which notes to re-read, throughgetNotesByIds(note-id schema,safeJoin); writers that bypasscommitLtmMutationreport no paths, which forces a full listing; legacy source quarantine runs only right after such a report and moves only source notes, which are never candidates; backup restore holds the vault lock, so it cannot run inside a batch; rollback is unchanged.Full validation notes (vault write path)
What can be written. Nothing new. No new write, file, folder or path built from input.
commitLtmMutationwrites the same files in the same order; the only change there is that the snapshot invalidation runs aftercreate()instead of before it, and carriesprepared.files[].path. Those paths already passedassertInsideDirectoryandltmSafeRelativePathSchemainsidecreate().create()is synchronous, so no read can run between it and the invalidation. Ifcreate()throws, nothing is written and nothing is reported; before, the snapshot was dropped anyway, which was harmless.What the paths are used for. Only to choose which notes to re-read.
batchCommittedNoteskeeps paths undervault/, takes the file name without.jsonas a note id, and re-reads throughstorage.getNotesByIds, which parses every id withltmNoteIdSchemaand reads onlyvault/<folder>/<id>.jsonthroughsafeJoin. A name that is not a valid note id throws there, and the batch falls back to a fulllistNotes().Freshness. The batch list stays equal to a fresh
listNotes()(same notes, same id order) as long as every vault write during the batch callsinvalidateLtmVaultSnapshot, which the parsed snapshot already relies on today:LongTermMemoryStorage(create, project, update, bulk, redirect, rename, section rename, delete) go throughcommitLtmMutation, as do scope links and rejected suggestions. They report their paths.invalidateLtmVaultSnapshotwithout paths, which forces a full listing: identity repair, note-fork repair, maintenance quarantine, journal recovery andstorage.cleanup(). A no-paths write that lands while an item re-reads changed notes is caught by the check after theawait.quarantineLegacyCapturedTurnSources(maintenance/legacy-source-quarantine.ts:15) moves captured-turn source files out ofvault/sources/. It runs only insideinitializeLtmStorefor a root that is not yet initialized: at first startup, or aftercleanup(), which has already reportedundefined. Either way the batch's nextlist()is a fulllistNotes(), and that call's owninitializeLtmStoreruns the quarantine before it reads. Source notes are also never reconciliation candidates.persistence/backup-restore.ts:149-151) swaps the whole root after itscleanup()has reported. It holds the vault lock for the whole restore, so it cannot run inside a batch. A batch waiting for the lock ignores writes until its first listing, which reads the restored root.Rollback. Unchanged. A failed
applyrestores thebeforestate as today. Watchers heard the paths before the write, so the next item re-reads those notes and sees the restored content. A committed mutation whose publish step fails is already on disk and was reported.Watcher lifetime. Registered before the batch waits for the lock; writes before the first listing are ignored. Stopped in
.finallyon the lock call, so a failed or aborted batch does not leak it. The per-root set is removed when empty, and only while it is still the root's registered set. Watchers run synchronously inside the invalidation; the batch's callback only adds to aSet.Documentation impact
UI evidence (if applicable)
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.