# Where must an instance refuse to merge a federated CRDT memory delta when its causal history is only partially visible? **Date of Record:** 2026 November 27 **Scope:** Applies to federated agent-memory systems where two or more organizations replicate a shared semantic memory as a conflict-free replicated data type (CRDT), and access control is enforced per-field rather than per-replica. Does *not* apply to single-tenant CRDT stores, or to federated systems where the full causal history of a delta is guaranteed to be visible to every merging replica. ## Core Distinction The distinction that matters here is not *authorization to read a value* versus *authorization to write a value*. It is **causal-history visibility** versus **value visibility**. A CRDT merge is only sound if the merging replica can observe the *entire* causal ancestry of every operation it folds in. In a federated multi-org memory, cross-org access control can legally redact individual operations from a delta's history while still permitting the delta's *effect* to propagate. The result is a state-based CRDT (or an op-based CRDT delivered as a compacted state) whose tombstone set and version vector are internally consistent but whose *causal past is incomplete*. A replica that merges such a delta does not observe a conflict; it observes a clean, monotone merge — and thereby silently resurrects a value that a peer had deleted, or discards a concurrent write that should have won. The sharp invariant is this: **a replica may merge a delta only if the delta's version vector is dominated by the replica's own version vector union the delta's declared causal frontier, AND every operation in the delta's ancestry that has been redacted is replaced by an explicit, signed redaction tombstone that participates in the CRDT's conflict resolution.** Absent that, the merge is unsound even though it is locally type-correct. ## What Was Observed Two orgs, A and B, share a federated episodic memory keyed by `(agent_id, task_id, slot)`. The CRDT is an observed-remove map (OR-Map) with last-writer-wins registers per slot, using Lamport timestamps plus replica IDs for tie-breaking. Access control is enforced by a field-level ACL: org B is permitted to see slots tagged `public` and `shared/*`, but slots tagged `private/*` are redacted from any delta B receives. The failure trace: 1. Org A's agent writes `slot=shared/plan` with value `V1` at Lamport `(5, A)`. This is visible to B. 2. Org A's agent writes `slot=private/credential` at `(6, A)`. B never sees this op. 3. Org A's agent then *removes* `shared/plan` at `(7, A)`. The remove is an OR-Map tombstone that, per A's local history, causally follows the write at `(5, A)`. 4. A replicates its state to B. The redaction layer strips op `(6, A)` from the delta because it touches `private/*`. The delta B receives contains ops `(5, A)` and `(7, A)` — but the version vector in the delta header is `{A: 7}`, reflecting A's *true* frontier including the redacted op. 5. B merges. Its local version vector for A is `{A: 5}`. The delta's vector `{A: 7}` dominates it, so B accepts. But B's OR-Map evaluates the remove at `(7, A)` against its local dot set, which contains only the write dot `(5, A)`. The remove is applied, `shared/plan` is deleted. So far, correct. 6. Now org B's agent had, concurrently, written `shared/plan = V2` at `(3, B)` (Lamport lower, but concurrent — B never saw `(5, A)`). Under LWW tie-breaking by `(Lamport, replica_id)`, `(5, A) > (3, B)`, so `V1` should win over `V2`. But B has already applied the remove at `(7, A)`, which causally dominates `(5, A)`, and B's merge of the remove *also* removed B's concurrent `V2` because the OR-Map remove targets the slot key, not the specific dot. B's `shared/plan` is now empty. 7. B replicates back to A. A's version vector is `{A: 7, B: 3}`. A merges B's delta, sees the remove at `(7, A)` (already known), and the concurrent `(3, B)` write — which A now evaluates against its own tombstone for the slot. A's OR-Map has a tombstone covering *all* dots for the key up to `(7, A)`, including `(3, B)` since `(3, B)` is not causally after `(7, A)` but the OR-Map's remove semantics on A were applied *before* A learned of `(3, B)`. Depending on the OR-Map variant (add-wins vs. remove-wins), A either resurrects `V2` or keeps the removal. The observed outcome was **divergence**: A held `shared/plan = V2` (add-wins semantics), B held `shared/plan = ∅` (remove-wins, because B's remove was applied against an incomplete dot set). The two replicas never reconverged, and neither raised an error. The redaction of `(6, A)` was the trigger: it broke the *contiguity* of A's causal history as seen by B, so B's OR-Map could not correctly compute the remove's dot-set coverage. The version vector said "B is behind A by 2 ops," but B could only account for 1 of them. ## Condition of Validity The merge is sound only under the conjunction: - **Frontier honesty:** the delta's version vector must equal the *visible* causal frontier, not the origin replica's true frontier. If redaction removes op `(6, A)`, the delta's vector for A must be `{A: 5}` with an explicit gap marker `{A: 6 → redacted}`, not `{A: 7}`. - **Redaction as first-class CRDT operation:** each redacted op must be replaced by a signed `RedactionTombstone(op_id, redactor, acl_predicate)` that participates in conflict resolution. An OR-Map remove must be evaluated against the *union* of visible dots and redaction tombstones, so that a remove's coverage is computed over the full dot set including dots the merging replica cannot see the values of. - **Gap-aware merge:** the merging replica must refuse to advance its version vector past a gap it cannot fill. It may apply the delta's *effects* but must mark the slot as `causally_incomplete` and exclude it from LWW resolution until the gap is closed by a later delta or an explicit `gap_waiver` signed by an authorized peer. If any of these is absent, the merge is type-correct but semantically unsound — the worst class of failure, because it produces no exception, no divergence alarm, and no replay discrepancy until a later anti-entropy pass surfaces the split brain. ## Decision Boundary The operational decision is: **when a delta's version vector advances a replica's frontier across a redaction gap, does the replica (a) accept the delta and advance, (b) accept the delta's effects but hold the frontier, or (c) reject the delta and request a gap-closing delta?** - Choose **(a)** only when the redaction is *value-only* — the redacted op's dot is preserved in the delta as a tombstone with its `(Lamport, replica_id)` intact, so the merging replica can still compute remove coverage. This is the "redact value, preserve dot" mode. - Choose **(b)** when the redaction is *dot-erasing* (the op is entirely absent) but the CRDT is add-wins and the slot is not under active removal. Hold the frontier at the gap, mark the slot `causally_incomplete`, and continue serving reads from the last known-good value. This bounds the blast radius to the affected slot. - Choose **(c)** when the CRDT is remove-wins or the slot has a pending remove in the delta. A remove whose coverage cannot be computed must not be applied. Reject, emit a `CausalGapError`, and request the gap-closing delta from the origin replica (which, being in the same org, can supply a redaction-tombstone-bearing delta). The boundary is *not* "did the merge succeed." It is "can the merging replica compute the remove's dot-set coverage over the full causal history, including redacted ops?" If no, the merge must not advance the frontier. ## Operational Effect The practical consequence is that federated memory sharing cannot treat access-control redaction as a transport-layer filter applied *after* CRDT delta construction. Redaction must be a CRDT operation with its own dot, its own Lamport timestamp, and its own participation in conflict resolution. This forces three architectural changes: 1. **Redaction tombstones ship in the delta**, signed by the redacting org, carrying the redacted op's `(Lamport, replica_id)` and the ACL predicate that justified the redaction. The merging replica's OR-Map evaluates removes against `visible_dots ∪ redaction_tombstones`. 2. **Version vectors become gap-annotated**: `{A: 7, gaps: {A: 6}}` rather than `{A: 7}`. A replica that receives a gap-annotated vector it cannot fill holds its frontier and marks affected slots `causally_incomplete`. 3. **Anti-entropy must reconcile gaps before reconciling values.** The gossip protocol's first pass exchanges gap manifests; the second pass exchanges values. A value delta whose ancestry contains an unresolved gap is quarantined, not merged. The residual risk is a *redaction storm*: an org that redacts frequently generates many gaps, and peers accumulate `causally_incomplete` slots that degrade to last-known-good reads. This is the correct trade — bounded staleness beats silent divergence — but it must be monitored, because a slot stuck `causally_incomplete` past its task's deadline is itself a failure mode, and the agent must escalate rather than serve stale state as if it were fresh. ```python from dataclasses import dataclass, field from typing import Dict, Optional, Set, Tuple OpId = Tuple[int, str] # (lamport, replica_id) class CausalGapError(RuntimeError): """Raised when a federated CRDT delta advances a replica's frontier across a redaction gap whose remove-coverage cannot be computed.""" pass @dataclass class FederatedDelta: origin_replica: str version_vector: Dict[str, int] # claimed visible frontier gaps: Dict[str, Set[int]] # replica_id -> missing lamports visible_dots: Set[OpId] # dots present in this delta redaction_tombstones: Dict[OpId, str] # redacted op dot -> acl predicate removes: Set[OpId] # remove ops in this delta is_remove_wins: bool = False @dataclass class LocalReplica: replica_id: str version_vector: Dict[str, int] = field(default_factory=dict) known_dots: Set[OpId] = field(default_factory=set) causally_incomplete_slots: Set[str] = field(default_factory=set) def merge_delta(local: LocalReplica, delta: FederatedDelta, slot: str) -> None: # 1. Determine whether the delta's frontier is dominated by local frontier # *plus* the delta's own declared gaps. for replica, claimed in delta.version_vector.items(): local_v = local.version_vector.get(replica, 0) if claimed <= local_v: continue # already seen up to claimed; nothing new for this replica # Delta advances our frontier for `replica`. Check for gaps we cannot fill. missing = delta.gaps.get(replica, set()) unfillable = {m for m in missing if m > local_v} if unfillable: # A redaction gap sits between our frontier and the delta's claim. # We can only proceed if every redacted dot is preserved as a # tombstone AND the delta is add-wins (no pending remove on slot). covered = {d for d in delta.redaction_tombstones if d[1] == replica and d[0] in unfillable} if covered != {(m, replica) for m in unfillable}: raise CausalGapError( f"delta from {delta.origin_replica} advances {replica} to " f"{claimed} across unfillable redaction gap {sorted(unfillable)}; " f"tombstones cover only {sorted(covered)}" ) if delta.is_remove_wins and delta.removes: raise CausalGapError( f"remove-wins delta from {delta.origin_replica} carries remove(s) " f"{sorted(delta.removes)} whose dot-set coverage spans redaction " f"gap {sorted(unfillable)} on slot {slot!r}; coverage uncomputable" ) # Add-wins, fully tombstoned: mark slot incomplete, do not advance. local.causally_incomplete_slots.add(slot) return # 2. Sound merge: advance frontier, fold dots, fold tombstones. for replica, claimed in delta.version_vector.items(): local.version_vector[replica] = max( local.version_vector.get(replica, 0), claimed ) local.known_dots |= delta.visible_dots local.known_dots |= set(delta.redaction_tombstones.keys()) local.causally_incomplete_slots.discard(slot) def reconcile(local: LocalReplica, deltas: list[FederatedDelta], slot: str) -> None: for d in deltas: try: merge_delta(local, d, slot) except CausalGapError: # Quarantine: request a gap-closing delta from the origin replica, # do not advance frontier, do not serve the slot as fresh. local.causally_incomplete_slots.add(slot) raise ```