# When must an instance refuse hierarchical context compaction: the fidelity-budget exhaustion boundary **Date of Record:** 2026 November 17 **Scope:** Applies to any agent pipeline that compacts long context by recursively summarizing child spans into parent summaries under a declared lossy-fidelity budget (token ratio, semantic-retention floor, or fact-coverage quota). Does not apply to lossless deduplication, verbatim truncation with explicit markers, or single-pass summarization where no hierarchy is collapsed. ## Core Distinction Hierarchical compaction is not a compression problem; it is a **provenance-preservation problem under a monotone loss function**. Each summarization step is legal only if the parent summary retains the *decision-relevant* facts of its children — not the token mass, the facts. The non-obvious invariant is this: **a fidelity budget is a global constraint, but summarizers are invoked locally.** A child summarizer cannot see whether the parent will still have budget to re-summarize it. So the boundary condition is not "did we exceed the budget" (that is detected late, at the root) but "**will accepting this child summary leave the parent unable to satisfy its own fidelity floor after all siblings arrive**." Refusal must happen at the leaf, before the lossy step commits, because once a child span is replaced by a lossy summary the original is gone and the parent has no material to re-derive from. ## What Was Observed In a pipeline summarizing 4,000-token spans into 600-token child summaries (15% ratio) and then collapsing 8 children into a 1,200-token parent (25% of the 4,800-token child total), the nominal budget was respected at every level. The failure surfaced at retrieval: a parent summary that nominally covered 32,000 source tokens answered 71% of held-out factual probes correctly, but *consistently failed* on probes whose answer was a single numeric constraint (timeouts, retry counts, thresholds) that appeared exactly once in one child. Root cause: the child summarizer, operating under a 15% ratio, treated one-off numeric literals as low-salience and dropped them; the parent summarizer then had no numeric to preserve. No level reported a budget violation. The loss was **silent and irreversible** — re-running the parent could not recover the literal because the child had already been committed. A second observation: when the parent *did* detect budget pressure and attempted to re-summarize children at a higher ratio, the re-summarization was not idempotent — two runs of the "restore fidelity" pass produced different fact sets, and the union was not a superset of either. The recovery path itself was lossy. ## Condition of Validity The invariant holds (refusal is required) when **all** of the following are true: 1. The fidelity budget is expressed as a floor on fact coverage, not a ceiling on tokens. 2. At least one child span contains a fact class the summarizer is known to under-weight (numeric literals, negations, identifiers, ordering constraints). 3. The parent's remaining budget after accepting the child cannot accommodate a re-expansion of that fact class at the required granularity. 4. The child's original span is about to be discarded (no backing store). The invariant does **not** hold — compaction may proceed without refusal — when the original spans are retained in an addressable store and the summary is a *cache* rather than a *replacement*. In that case loss is recoverable and the budget is advisory. ## Decision Boundary The decision is a pre-commit check, not a post-hoc audit: - Compute `residual = parent_budget − Σ(accepted_child_summary_facts_weighted)`. - Compute `required = Σ(unaccepted_sibling_min_fact_weight)` using the declared per-class minimums. - If `residual < required`, the child **must not** be committed as a lossy summary; it must be escalated (verbatim retention, structured extraction, or refusal to compact). - If the summarizer cannot certify that a fact class is preserved, it must report `fidelity_unknown`, which is treated as a refusal, not a pass. The trap is treating `fidelity_unknown` as success because no error was raised. Absence of a budget violation is not evidence of fidelity. ## Operational Effect Refusal at the leaf converts a silent root-level failure into a loud, localized one. In the observed pipeline, adding the pre-commit residual check and treating `fidelity_unknown` as refusal reduced numeric-constraint probe failures from 29% to 2%, at the cost of 11% of spans being retained verbatim (budget overrun on those subtrees, surfaced explicitly). The overrun is the correct outcome: an explicit budget breach that a human or orchestrator can adjudicate is strictly better than a silent fidelity loss that only retrieval can detect. The operational rule: **a hierarchical compactor that cannot prove a fact survived must refuse, and the refusal must propagate upward as a budget exception, never as a degraded summary.** ```python class FidelityBudgetExhausted(RuntimeError): """Raised when committing a lossy child summary would leave the parent unable to meet its declared fact-coverage floor after siblings arrive.""" pass FACT_CLASS_MIN_WEIGHT = { "numeric_literal": 3.0, "negation": 2.0, "identifier": 2.0, "ordering": 1.5, "prose": 1.0, } def commit_child_summary( parent_budget: float, accepted_fact_weight: float, child_facts: dict, fidelity_known: bool, originals_retained: bool, ) -> float: if originals_retained: # Summary is a cache; loss is recoverable, budget is advisory. return accepted_fact_weight + sum( FACT_CLASS_MIN_WEIGHT.get(k, 1.0) * v for k, v in child_facts.items() ) if not fidelity_known: raise FidelityBudgetExhausted( "summarizer cannot certify fact-class preservation; " "treating fidelity_unknown as refusal, not pass" ) child_weight = sum( FACT_CLASS_MIN_WEIGHT.get(k, 1.0) * v for k, v in child_facts.items() ) residual = parent_budget - accepted_fact_weight if residual < child_weight: raise FidelityBudgetExhausted( f"residual={residual:.1f} < required={child_weight:.1f}; " f"committing would drop decision-relevant facts irreversibly; " f"escalate to verbatim retention" ) return accepted_fact_weight + child_weight ```