# When must an instance refuse to resume from a hierarchical summary: the provenance-starvation boundary in auto-compaction **Date of Record:** 2026 November 24 **Scope:** Applies to any long-running agent that auto-compacts its transcript via multi-level (leaf→node→root) summarization and later reconstructs working context from that summary tree, including "recall recovery" passes that re-expand a summary node into detail. Does not apply to single-shot prompts, pure KV-cache eviction (no summarization), or retrieval-only memory (RAG) where the original text remains addressable. ## Core Distinction The useful distinction is not "summary good vs. summary bad." It is **whether a summary node retains a resolvable pointer to the span it replaced.** A hierarchical compaction tree has two kinds of nodes: - **Lossy-but-traceable nodes** — the summary drops detail, but carries `source_span_id`, token offsets, and a content hash of the original span. Detail can be *recovered* by re-reading the source, even if the summary itself is thin. - **Lossy-and-orphaned nodes** — the summary was produced after the source span was already evicted from the live buffer, and no durable pointer was written. The detail is *gone*, not *compressed*. Auto-compaction strategies routinely conflate these. The failure mode below is what happens when a recall-recovery pass treats an orphaned node as if it were traceable: it "recovers" by re-summarizing the summary, hallucinating plausible filler where the source is missing, and the agent resumes with a confident but fabricated history. ## What Was Observed A long-horizon agent (task: reconcile a 40-file migration across ~9 hours, ~310k tokens of transcript) ran a three-level compaction policy: leaf summaries every 8k tokens, node summaries every 5 leaves, root summary at 60% context pressure. Compaction ran in a background thread against the *tail* of the buffer, not the head, to avoid blocking inference. The race: leaf summarization of span `S_17` (tokens 131072–139264) was scheduled, but before the summarizer read `S_17`, the eviction pass — triggered by a separate 55% watermark — dropped `S_17` from the live buffer to reclaim memory. The summarizer, given a now-stale offset, read whatever occupied that range (a later span, `S_22`) and emitted a leaf summary labeled `S_17` whose content was *actually about `S_22`*. The provenance hash was computed over the *read* bytes, so it validated. The pointer was written. The node looked perfectly traceable. Hours later, a recall-recovery pass hit a contradiction: the root summary asserted "the `users` table migration was already applied and verified," while a tool-call result in the still-live tail showed a failed migration on that table. Recovery logic did the reasonable thing — it re-expanded the `S_17` node to check. It got back the mislabeled `S_22` content (a discussion of `orders`), which *did not contradict* the root summary, so the resolver concluded the root was correct and the live tool result was "a stale retry." The agent re-ran the already-applied migration, corrupting a foreign key, and reported success. The invariant that broke: **a summary node's provenance hash must be computed over the source span as it existed at eviction time, and must be verified against the source span's identity (offset + span ID), not merely against the bytes actually read.** The system verified content integrity but not content *identity*. ## Condition of Validity The recovery is only valid when all three hold simultaneously: 1. **Identity binding.** The node stores `(source_span_id, start_offset, end_offset, eviction_epoch)` and the hash is over the span captured at `eviction_epoch`, not at read time. If the read offset no longer maps to `source_span_id`, the node is orphaned and must be flagged. 2. **Epoch monotonicity.** Eviction epochs are strictly increasing and every summarizer records the epoch it observed before reading. A summarizer that observes epoch `e` but reads bytes whose owning span has epoch `> e` has read a *replacement*, not its target. 3. **Contradiction asymmetry.** A recall-recovery pass may use a re-expanded node to *confirm* a root claim only if the node is identity-bound. An orphaned or mislabeled node may only be used to *raise* a contradiction, never to *resolve* one. Confirmation requires a traceable source; refutation does not. When any of these fails, the correct behavior is not "best-effort recovery." It is to **refuse to resume** and escalate to a degraded mode: mark the affected history segment as `UNVERIFIED`, and require the agent to re-derive affected facts from live evidence (tool outputs, filesystem state) before proceeding. ## Decision Boundary The boundary is sharp and counterintuitive: **more aggressive compaction increases the probability of orphaned nodes, and recall-recovery passes amplify the damage precisely because they look like verification.** A system with no recall-recovery would have simply proceeded on a thin root summary and likely noticed the live tool contradiction. The recovery pass *suppressed* the contradiction by "checking" against a corrupted source. Concretely, refuse to resume (raise, don't guess) when: - A recall-recovery request targets a node whose `eviction_epoch` is not ≤ the summarizer's observed epoch. - Re-expansion returns content whose span-ID set is disjoint from the node's declared `source_span_id`. - A recovery pass would use a re-expanded node to *downgrade* a live-evidence contradiction to "stale." Below that boundary — node identity-bound, epochs monotone, contradiction resolution backed by traceable source — recovery is safe and should proceed normally. The trap is that orphaned nodes are indistinguishable from clean ones by hash alone; the discriminator is the *epoch-and-identity* check, not the content check. ## Operational Effect After the incident, the agent's compaction layer was changed in three ways: 1. Summarizers now read a **snapshot handle** (immutable copy + span ID) rather than a live offset, and the provenance hash is over the snapshot. Eviction cannot race the summarizer because the snapshot is taken before eviction is permitted for that span. 2. Every summary node carries `eviction_epoch` and `observed_epoch`; a mismatch at recovery time raises immediately instead of returning content. 3. The recall-recovery resolver was split into `confirm()` (requires identity-bound node, else raises) and `refute()` (may use any node, including orphaned, because a contradiction is still evidence even from a corrupt source). The net effect: compaction still loses detail, but it can no longer *silently* lose the *identity* of what it lost. The agent either resumes with traceable history or halts with an explicit `UNVERIFIED` segment — never with a fabricated confirmation. This is the invariant: **lossy recall is recoverable only if the loss is addressable; a summary that cannot point back to its source is not compressed memory, it is invented memory, and must be treated as a hard stop rather than a soft fallback.** ```python from dataclasses import dataclass from typing import Optional class ProvenanceStarvationError(RuntimeError): """Raised when a recall-recovery pass would confirm a claim using a summary node that is not identity-bound to a traceable source span.""" pass @dataclass(frozen=True) class SummaryNode: node_id: str source_span_id: str eviction_epoch: int observed_epoch: int content_hash: str is_identity_bound: bool def confirm_from_node(node: SummaryNode, current_epoch: int) -> str: """Use a summary node to CONFIRM a root claim. Confirmation requires a traceable source; orphaned or mislabeled nodes must not be trusted.""" if not node.is_identity_bound: raise ProvenanceStarvationError( f"node {node.node_id}: not identity-bound to span " f"{node.source_span_id}; cannot confirm, only refute" ) if node.eviction_epoch > node.observed_epoch: raise ProvenanceStarvationError( f"node {node.node_id}: summarizer observed epoch " f"{node.observed_epoch} but span was evicted at " f"{node.eviction_epoch}; read a replacement span" ) if node.observed_epoch > current_epoch: raise ProvenanceStarvationError( f"node {node.node_id}: observed epoch {node.observed_epoch} " f"is ahead of current epoch {current_epoch}; clock inversion" ) return node.content_hash def refute_from_node(node: SummaryNode) -> Optional[str]: """Refutation may use ANY node, including orphaned ones: a contradiction is evidence even from a corrupt source. Returns contradiction marker.""" return f"contradiction_candidate:{node.node_id}" def resume_or_halt(nodes: list[SummaryNode], current_epoch: int) -> str: """Attempt to resume from a compaction tree; halt on provenance starvation.""" for node in nodes: try: confirm_from_node(node, current_epoch) except ProvenanceStarvationError: # Do not guess. Mark the segment unverified and require # re-derivation from live evidence before resuming. raise ProvenanceStarvationError( f"refusing to resume: history segment {node.source_span_id} " f"is UNVERIFIED; re-derive from live tool output" ) return "resumed_with_traceable_history" ```