mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1533] [Issue]: Long-Term Memory: extraction writes a private copy instead of updating a shared memory #1510
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#1510
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 @Promansis on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1533
Originally assigned to: @Promansis on GitHub.
Summary
When you share a memory with a character, and the chat it came from keeps adding to it, extraction never updates the shared memory. It silently writes a private copy for that chat instead. From then on the chat recalls two versions: the shared memory, frozen at the moment you shared it, and the copy, which keeps changing. The character's other chats only ever see the frozen version, and nothing tells you this happened.
With the fix, the chat's new content is offered in Review as a change to the shared memory, with a note that accepting it also adds it where the memory is shared. Nothing reaches the shared memory without your review, and a review writes only the rows you selected. A chat that already has its own copy keeps updating that copy, so its updates don't split between two memories.
Affected package
long-term-memory1.4.69 (upstream/staging5984f0784).S=packages/long-term-memory/src/engine/packages/server/src/services/long-term-memoryC=packages/long-term-memory/src/engine/packages/client/src/features/long-term-memoryExpected behavior
Actual behavior
resolveChatLtmWriteScope,S/identity/chat-scope.ts:74).canUpdateLtmScopedTarget(S/extraction/scoped-targets.ts:33-44, #1037) lets a source update a note only when the note's scope is inside the source's scope. A note shared with a character is broader than the chat, so the chat can't update it.resolveScopedEvidenceUnitTargets(S/extraction/scoped-targets.ts:69-150) then remaps the unit to a scope-suffixed copy id (scopedVariantNoteId,:62; resolver:114) and adds atarget_note_scoped_variantdraft diagnostic (:133). That diagnostic only shows in the draft's extraction details, not on the Review row.S/drafts/draft-projector.ts:249) and apply'spreflight(S/drafts/reconciliation.ts:338) both reject the target with "belongs to another scope".canUpdate(S/extraction/candidate-reconciliation.ts:270) and is listed (S/extraction/source-extraction.ts:351); the shared memory never is. Any fix has to agree with them, or updates split between the two.S/drafts/reconciliation.ts:839-852). Once a shared event can carry this chat's changes, a fix must not let that path write it.Evidence
Private T6 harness, reduced3 runs: about a fifth of "new" world notes per run (9–14) are such copies, 129 in all.
The harness never writes, so it re-creates the copies every run. In real use it is one copy per shared memory per chat.
Private vault copy, aggregates only:
Steps to reproduce
Example (anonymised):
Minimal fix
No new suggestion kind, no new UI surface, no schema change. Three conditions must all hold, and the privacy rule stays as it is for everything else.
S/extraction/scoped-targets.ts: addisSharedLtmScopedTarget(existing, incoming). It is true when the source may not update the note but the note includes every scope link of the source:!canUpdate(existing, incoming) && canUpdate(incoming, existing). InresolveScopedEvidenceUnitTargets, such a note stays the target (no copy) when there is no identity conflict and the source has no copy of it yet. An existing copy (scopedVariantNoteIdor the legacy id) stays the target, so this pass agrees with reconciliation and the prompt.S/extraction/evidence-unit-compiler.ts: changes to a note the source may not update are never low risk. They are raised tomedium, so low-risk auto-apply (APIapplyLowRisk,S/extraction/source-processing.ts:420) skips them.S/drafts/draft-projector.ts:249: project shared targets, so Review can show the before and after.S/drafts/reconciliation.ts, three changes:preflighttakes the ids the caller named:mutationIds, or all ids when none are given, ornullfor auto-apply. It admits a shared target only when every mutation on it is named, so auto-apply and auto-included rows fail closed.preflightLongTermMemoryDraftpasses its selected ids, so Review shows such a row as blocked.applyInner's event auto-include skips shared events: their changes wait for their own rows.S/drafts/draft-review.ts: add ashared_memory_updatewarning to every Review row on a shared memory. It is read at review time, so a memory shared after extraction also shows the warning.C/review/ReviewQueue.tsx:1788-1798already shows row diagnostics.The client already names the grounding
add_linkrow and the event create that go with a selected row (C/review/review-state.ts:175), so normal Review accepts are not blocked.Unchanged:
remapDraftCreatesForProjection,S/extraction/source-extraction.ts:153).source-extraction.ts:351).note-fork-repairnever merges a copy into a memory with different availability.CHANGELOG (user-visible), five points:
Regression proof
Write first; it must fail on the current code.
tests/long-term-memory-delta-review.regression.ts, after thecanUpdateLtmScopedTargetcases (:74): truth table forisSharedLtmScopedTarget.tests/long-term-memory-extraction-graph.regression.ts, end to end after the event-shaped review block (:1176). Setup: a chat-only source, and a world memory from that chat shared with a character. The model fixture returns new evidence for that memory, andprocessLongTermMemorySourceruns withapplyLowRisk: true.shared_memory_update.:1983-1996).Environment
staging87d1ccadc)upstream/staging5984f0784)Logs, screenshots, or video
None. The counts come from private harness runs and a private vault copy, so only aggregates are shared.
Additional context
Tracker item EX-I14, found in the T6 harness runs. Related: #1028 and #1037 (LTM 1.3.14).
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: