mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1087] [Issue]: Reconciliation uses a stale preparation index and misses concurrent or same-batch commits #554
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#554
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 (Sep 26, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1087
Originally assigned to: @Promansis on GitHub.
Summary
The bounded post-extraction reconciliation added for #1085 matches candidates against the recall index captured before the provider call, so any note committed after preparation is invisible to it. A concurrent import, or a sibling source in the same import batch, can therefore create a duplicate note under a second id — the defect class #1085 adds reconciliation to prevent. This is the residual "F4" finding from the #1085 repair review.
Affected package
long-term-memory(Long-Term Memory, server)engine.min2.4.1)staging/mainhave no reconciliation pass, so this is a pre-merge follow-up rather than a shipped regression.Expected behavior
Reconciliation must not silently create a note when a compatible note already exists at commit time — including notes committed after preparation by a concurrent import or by another source in the same batch.
Actual behavior
source-extraction.tscapturesrecallIndex(loadOrRebuildLongTermMemoryIndexes) before the provider call and passes it toreconcileEvidenceUnitCandidates.retrieveLongTermMemorydoes not re-load or re-scan when anindexis supplied.plausible.length === 0-> no remap -> acreate_noteunder a new id.processLongTermMemorySourceBatchprepares all items concurrently and commits only after every preparation finishes, so each item in a batch reconciles against the pre-batch index deterministically (no timing race required). Direct game-mode shares this via its preparation-timelistNotessnapshot.Steps to reproduce
Mechanism reproduction (executed, exit 0):
world_cobalt_archive; rebuild indexes.loadOrRebuildLongTermMemoryIndexes(root).world_cobalt_archive_twinunder a different id.index: onlyworld_cobalt_archiveis returned.index(fresh load):world_cobalt_archive_twinis returned.An import-level end-to-end reproduction of the batch case has not been written yet; batch reachability is established by the reproduced mechanism plus the prepare-all/commit-all control flow in
processLongTermMemorySourceBatch.Environment
41d5d12cdba43efddd8d94d45657bef0fb8b07d7tsxrunner)Logs, screenshots, or video
Additional context
Related: #1085.
Blocking constraint for a fix: loading the index calls
listNotes(), andtests/long-term-memory-extraction-reliability.regression.ts:483-487,533-535require exactly one preparation snapshot plus one deferred rebuild scan, and forbid a vault re-scan after the provider responds. A reload-before-reconciliation was attempted during the #1085 repair and reverted because it broke that contract.Impact: a duplicate note/draft under a second id;
applyLowRiskcan auto-apply it without review. Not data loss. Subsequent extractions self-heal because the index is rebuilt after commit, and the existingmaintenance.tsduplicate scan plus fork repair can merge duplicates after the fact.Options to decide:
lastMutationId) captured after the index load against the value before reconciliation; on change, add a diagnostic and setreviewRequired. Cheap and contract-safe, detects the concurrent-import race, but cannot detect the batch case and gates rather than resolves.B is the only option that closes the deterministic batch case; the contract decision should be made first.
Scope: read-only investigation of the #1085 residual; no source changes in this issue yet.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: