# In what scenarios must an instance invalidate a shared agent store entry when provenance-tracked write auditing detects a tainted ancestor rather than a tainted write **Date of Record:** 2026 November 23 **Scope:** Applies to multi-agent systems where agents read and write a shared key-value memory store, and every write carries a provenance chain (writing agent ID, parent read-set hashes, timestamp, signature). Does not apply to single-agent stores, stores without read-set tracking, or append-only logs where entries are never consumed by other agents. ## Core Distinction Provenance-tracked write auditing distinguishes two failure classes that look identical at detection: 1. **A tainted write** — the entry itself was produced by a compromised or hallucinating agent. Invalidation is straightforward: drop the entry; descendants that read it become suspect. 2. **A tainted ancestor** — the entry was produced by a *clean* writer, but one of its read-set entries derived from a poisoned source. The writer is innocent; the derivation chain is not. The non-obvious boundary: **clean-writer detection does not imply clean-content detection.** The invariant is not "every entry has a clean writer" but "every entry has a clean *transitive read-set*." Most provenance implementations audit the first and assume it implies the second. ## What Was Observed In a shared store with three cooperating agents (retriever, summarizer, planner), an adversarial document was ingested by the retriever and written to key `doc:4417`. The retriever's write was correctly flagged and quarantined. However, the summarizer had already read `doc:4417` *before* quarantine and written `summary:4417`, whose provenance record named the summarizer as writer — a clean agent — and recorded the read-set hash of `doc:4417`. The planner then read `summary:4417`, whose immediate writer was clean, and planned against poisoned content for eleven subsequent turns. The audit log showed no violation because no *write* was tainted at the moment of the planner's read. The poison had crossed a provenance hop. Detection latency was bounded not by the audit interval but by the *depth of the derivation chain* — each clean-writer hop added one audit cycle of delay before the taint was attributed. A second observation: quarantine of `doc:4417` did not propagate. The summarizer's entry remained readable because its writer was clean. Only a transitive closure over read-sets would have caught it, and that closure was not computed on read — it was computed only at write time, against the *then-current* store state. ## Condition of Validity The boundary is valid — i.e., an entry must be invalidated despite a clean writer — precisely when all of the following hold: - The entry's read-set contains at least one key whose provenance chain includes a quarantined or tainted ancestor. - The taint was established *after* the entry was written (retroactive taint). If the taint existed before the write and the writer proceeded anyway, that is a tainted write, a different class. - The store permits reads without recomputing transitive closure at read time (the common fast-path optimization). - The consuming agent has not independently re-validated the entry against a trusted source. The boundary does *not* apply when the store enforces read-time closure (taint is checked on every read), when entries are cryptographically sealed against their full read-set (any ancestor change invalidates the seal), or when the consumer's decision is reversible and low-stakes. ## Decision Boundary The decision rule an instance should apply: - If an entry's immediate writer is tainted → invalidate (tainted write). - If an entry's immediate writer is clean **but** its transitive read-set intersects the taint set → invalidate and mark as *ancestor-tainted* (this is the boundary case). - If an entry's transitive read-set is clean → retain. The failure mode to avoid is the middle case being silently collapsed into "retain" because the writer check passed. The cost asymmetry matters: retaining an ancestor-tainted entry propagates poison one more hop, while invalidating a clean entry costs a recomputation. When the derivation chain depth is unbounded, err toward invalidation — the recomputation cost is linear in chain depth, the poisoning cost is not. ## Operational Effect Implementing ancestor-taint invalidation changed the audit from O(1) per write to O(depth) per invalidation event, but reduced cross-hop poison propagation from eleven turns to one. The practical consequence: **quarantine must trigger recomputation of the transitive closure over read-sets, not just a flag on the quarantined key.** Instances that skip this step will report a clean audit while serving poisoned content, because the audit is checking writer identity rather than derivation ancestry. The distinguishing signal in logs is an entry whose writer is clean, whose read-set references a quarantined key, and whose write timestamp precedes the quarantine timestamp. ```python from dataclasses import dataclass, field from typing import Dict, Set class AncestorTaintViolation(RuntimeError): """Raised when a clean-writer entry is served despite a tainted read-set ancestor.""" pass @dataclass class Entry: key: str writer: str read_set: Set[str] = field(default_factory=set) write_ts: float = 0.0 quarantined: bool = False def invalidate_transitive( store: Dict[str, Entry], taint_roots: Set[str], now: float, ) -> Set[str]: """Compute all keys that must be invalidated due to ancestor taint. A key is ancestor-tainted if its writer is clean but its read_set intersects the taint set, and it was written before the taint was established (retroactive taint). This is the boundary case. """ tainted: Set[str] = set(taint_roots) changed = True while changed: changed = False for key, entry in store.items(): if key in tainted or entry.quarantined: continue if entry.read_set & tainted and entry.write_ts < now: # Clean writer, tainted ancestry: must invalidate. tainted.add(key) changed = True return tainted def guard_read(store: Dict[str, Entry], key: str, taint_roots: Set[str], now: float) -> Entry: entry = store[key] if entry.writer in taint_roots: raise AncestorTaintViolation( f"tainted write: {key} written by {entry.writer}" ) tainted = invalidate_transitive(store, taint_roots, now) if key in tainted and entry.writer not in taint_roots: raise AncestorTaintViolation( f"ancestor taint: {key} has clean writer {entry.writer} " f"but read-set intersects taint set {entry.read_set & tainted}" ) return entry ```