mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1930] [Issue]: Long-Term Memory: every later chat piece's thread and relationship updates must be accepted one at a time #1825
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#1825
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 30, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1930
Originally assigned to: @Promansis on GitHub.
Summary
Since #1782, each chat-messages piece after the first sees the previous piece's open threads and continues them in place. Apply treats such an in-place section update as a "rewrite", and a rewrite may not be applied together with anything else. So accepting a later piece's draft in one go applies the safe rows and leaves every continued thread and every relationship state change behind a red "blocked" notice, to be accepted one by one. Auto-apply (API only) applies nothing from such a draft.
Affected package
long-term-memory(1.5.15)Expected behavior
A section the extractor replaces on purpose is that section's normal way of changing, not a destructive edit:
rolling_until_resolvedlifecycle),state, a character'sitemsandprogression(superseding).Accepting a draft with several rows, including such updates, applies them together. The row still shows as Rewrite with its before/after diff, so the reader sees what is replaced. The one-at-a-time rule stays for the changes that remove or re-label something:
set_status(archive, resolve),set_title,set_subjects, and any section update on an anchor note.Actual behavior
Review queue, a chat with two imported pieces, the second piece's draft has 6 rows: 4 new events, 1 thread continuation (
update_sectionon the existing thread's section), 1 relationshipstateupdate. Select all, Accept:blockedwithdestructive_disposition_requires_explicit_review; the panel turns red with "Destructive disposition requires explicit review: Rewrite and other destructive changes must be reviewed and applied one at a time." (there is no label key for the code, so the raw message shows);With auto-apply on (
autoApplyLowRiskOnly, API only): apply throws the same 409 for the whole batch;source-processing.tscatches it since #1782 and leaves the entire draft for review, so none of the piece's rows apply, not even the new events (the OT-3 case).Where the rule lives
server/src/services/long-term-memory/drafts/draft-projector.tsdispositionForMutation(~403), mirrored bydrafts/reconciliation.tsfallbackDisposition(~235):update_section/append_sectionis a "rewrite" wheneverisAdditiveLtmSection(draft-projector.ts~158) is false, which is exactly the set of sections the compiler replaces on purpose plus any section on an anchor-tagged note.extraction/evidence-unit-compiler.tslifecycleForUnit(~537) gives threadsrolling_until_resolvedand relationship state / items / progressionsuperseding;shouldAppend(~525) then emitsupdate_section(~185) instead ofappend_section. The rewrite is the design, not a model mistake.reconciliation.ts~611:bulkApply = selected.length > 1anddisposition === "rewrite"→ blocker on the row.reconciliation.ts~955:userSelectedCount > 1and any projected row withdisposition === "rewrite"→LtmDraftApplyError409 for the whole batch.client/src/features/long-term-memory/review/ReviewQueue.tsx~1256 sends onlyreadyMutationIds, so the UI already applies the safe rows and keeps the blocked ones.Minimal fix
One helper next to
isAdditiveLtmSectionindraft-projector.ts:returns
falseunlessdisposition === "rewrite"; forupdate_section/append_sectionreturnsBoolean(note?.tags.includes("anchor")); for every other kind returnstrue.Both guard sites in
reconciliation.tstest it instead ofdisposition === "rewrite":isDestructiveLtmRewrite(existing.get(mutationTargetId(mutation)) ?? null, mutation, disposition);existingalready holds the targets (~601).selectedand the group's existing note (the projector'sbefore; or fetch the targets withstorage.getNotesByIdsas preflight does).DESTRUCTIVE_DISPOSITION_MESSAGE, the error code, the disposition values and the client stay as they are.source-processing.ts~473 keeps its catch (status changes and anchor rewrites still need it); shorten its comment to say which cases remain.Changelog (
## Unreleased, patch): "Review: a later chat piece's thread and relationship updates apply together with the rest of the draft instead of one at a time."Regression
tests/long-term-memory-storage.regression.ts, in the destructive block (~2650–2750,destructiveTargetis a thread with aset_statusrow):update_sectionon the thread's section plus anadd_link:preflightLongTermMemoryDraftwith both ids has no blockers and the update row still reportsdisposition: "rewrite";applyLongTermMemoryDraftwith both ids applies both and the section text is replaced.update_sectionon a note taggedanchor, selected with another row: still blocked withdestructive_disposition_requires_explicit_review, apply still rejects.set_status+add_linkcase keeps its blocker and rejection (already asserted ~2725–2740).Steps to reproduce
Environment
Logs, screenshots, or video
Preflight row blocker:
{ code: "destructive_disposition_requires_explicit_review", message: "Rewrite and other destructive changes must be reviewed and applied one at a time." }. Apply: HTTP 409 with the same code.Additional context
"update"): changes a shared enum the client labels and filters on; the before/after diff already tells the reader what happens.mediumunit risk (evidence-unit-validation.ts~93), which keeps it out of auto-apply on its own.Template check