Skip to content

Isolate revision#134

Open
Jasonya wants to merge 6 commits into
mainfrom
isolate_revision
Open

Isolate revision#134
Jasonya wants to merge 6 commits into
mainfrom
isolate_revision

Conversation

@Jasonya
Copy link
Copy Markdown
Collaborator

@Jasonya Jasonya commented May 29, 2026

No description provided.

Jasonya added 6 commits May 29, 2026 06:47
Introduces a deterministic conflict-resolution path for semantic memory
inserts, with source provenance (turn_id / chunk_id / serial / occurred_at)
flowing from /memory/add through to stored records. Enabled per meta-agent
via the new `enable_conflict_resolution` flag; legacy free-form inserts
remain the default.

Schema:
- `users.turn_counter`, `users.chunk_counter` — per-user monotonic counters
  used by `/memory/add` to fill in fallback provenance when the client does
  not provide source_meta.
- `episodic_memory.source_refs`, `semantic_memory.source_refs` —
  provenance pointers from stored memories back to their source units.
- `semantic_memory.prior_values` — history of values that have been
  superseded under the conflict-resolution path.

Services:
- `UserManager.reserve_source_ids` — atomic counter bump used by the
  /memory/add fallback.
- New `semantic_memory_upsert_fact` tool gated by the agent flag.
- `MetaAgent` system prompt augmentation when the flag is on.

Docs: `docs/mab_conflict_resolution_and_provenance.md`,
      `docs/mab_raw_chunk_side_channel.md`,
      `docs/mab_user_id_isolation_fix.md`.
(cherry picked from commit 2a172e5)
1. episodic_memory_manager: pgvector embedding-search SELECT was missing
   source_refs, causing to_pydantic() to receive None for a non-nullable
   List field — every episodic search threw a Pydantic ValidationError
   and silently returned no memories. Add source_refs to the explicit
   select() column list.

2. semantic_memory_manager: same bug on the semantic side, plus
   prior_values. Add both to the embedding-search SELECT.

3. memory_tools.semantic_memory_insert: indexed item['source'] directly,
   so any LLM call that omitted the source field (which it commonly
   does — source is the least essential field) crashed with KeyError
   and lost the whole item. Switch to item.get('source', '').

Net effect on LoCoMo conv-26 with 0201c config: 20.4% -> 80.3% (the
SELECT fix alone). The source KeyError was masking real semantic
memory writes in graph-mode LongMemEval ingest.

Also ignores evals/snapshots/ — local-only memory dumps, large and
regenerable.

(cherry picked from commit 20c2b05)
MAB caller (memory_tools.episodic_memory_merge) passes additional_source_ref
but update_event lacked the param on this base (it lived in the v4-graph
commit ccb419f). Port the param + source_refs-append handling from main so
the merge tool stops raising TypeError.
@Jasonya Jasonya requested a review from wangyu-ustc May 29, 2026 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant