# In what scenarios must an instance refuse auto-compaction when salient-state extraction would collapse a pending causal dependency **Date of Record:** 2026 November 24 **Scope:** Applies to long-horizon agents that summarize (auto-compact) their own transcripts to stay within a context window while attempting to preserve salient state. Does not apply to stateless single-turn calls, nor to compaction performed offline by a separate process with access to the full un-truncated transcript and a verified replay oracle. ## Core Distinction Auto-compaction is not lossy compression of *tokens*; it is lossy compression of *causal dependencies*. The distinction that matters operationally is between **salient state** (facts the agent can restate: "the user's account ID is 4471", "the migration is half-done") and **pending causal dependencies** (obligations the agent has *not yet discharged*: a tool call whose result was consumed but whose side effect is unverified, a promise to revisit a branch, a value that a future step will dereference). Salient-state extraction reliably preserves the former and silently drops the latter, because an undischarged obligation has no present-tense proposition to extract — it is a *future* reference, and summarizers write in the present tense of what happened, not the future tense of what is owed. The failure mode is therefore not "the summary forgot something." It is "the summary is *correct and complete about the past*, and the agent resumes as if the past were settled." Compaction that reads as faithful can still be unsafe. ## What Was Observed A 40-step infrastructure-remediation agent was auto-compacting every 6 turns with a salience-extraction prompt ("summarize decisions, facts, and open questions"). At turn 31 it had issued a `drain_node` call, received `{"status": "draining", "eta_s": 90}`, and — instead of blocking — recorded a note to "confirm drain completion before cordoning." At turn 36 compaction fired. The extractor correctly captured: node ID, the draining status, the ETA, and the decision to cordon afterward. What it dropped was the *dependency edge*: that the cordon step's precondition was an unobserved completion event, not the recorded string `"draining"`. On resume at turn 37 the agent read its own summary, saw `status: draining`, treated the status token as the settled state, and issued the cordon. The drain was still in flight (real ETA had slipped to 140s). Cordon-on-draining-node deadlocked the scheduler for 11 minutes. Nothing in the summary was false. The summary said "draining"; the node *was* draining. The agent inferred "drained" from a stale present-participle because the extractor had no schema slot for "event awaited but not observed." A second instance showed the inverse: an extractor that *did* preserve open questions produced a summary listing "confirm drain completion" as an open item — but placed it in a flat bullet list alongside three already-resolved items, with no ordering or dependency marker. On resume the agent re-derived the plan from the flat list, re-ran a destructive `resize_volume` that had already succeeded (idempotency key had been dropped with the resolved item), and doubled the volume's provisioned IOPS. Compaction preserved the *content* of the obligation and destroyed its *state* (pending vs. discharged). ## Condition of Validity Auto-compaction is safe to perform at turn *t* if and only if every pending causal dependency outstanding at *t* is either (a) discharged before compaction, or (b) reified in the summary as a **typed, ordered obligation** with an explicit state (`PENDING`/`AWAITING`/`DISCHARGED`) and a precondition link to the steps that depend on it. A flat natural-language summary satisfies neither. The invariant is: > For every step *s* in the post-compaction plan, every precondition *p* of *s* that was established before compaction must appear in the summary with the same truth-value it had at compaction time, and every precondition whose truth-value was *not yet determined* must appear as an unresolved obligation, not as a status token. The common violation is representing an in-flight state with a value that is also a valid terminal-looking token (`draining`, `pending`, `in_progress`, `200 OK`). These tokens are *ambiguous between "observed and still true" and "observed and will change without further notice."* Salience extraction, which optimizes for factual density, prefers them because they are compact and accurate. They are exactly the tokens that must be forbidden in a summary unless paired with an explicit "awaiting event X" annotation. ## Decision Boundary The boundary is not "how much to compress" but "whether the compaction point is a **quiescent point**." A quiescent point is a turn at which no async operation is in flight, no tool result is un-consumed, and no branch is deferred. Most agents compact on a *token budget* trigger — a proxy that is uncorrelated with quiescence. The correct trigger is conjunctive: compact when the token budget is exceeded **and** the dependency graph has no `AWAITING` edges, or when the budget is exceeded and the extractor can emit typed obligations. If neither holds, the agent must either block until quiescence or spill the raw transcript to external storage and compact only the *narrative* while retaining a machine-readable obligation ledger out-of-band. The specific refusal condition: if the extractor's output schema has no field for obligation state, or if any in-flight operation lacks a resolvable completion predicate, the instance must **not** compact — it must extend the window (spill-to-disk with a retrieval handle) or halt and surface the dependency to the orchestrator. Compacting anyway converts a bounded memory problem into an unbounded correctness problem. ## Operational Effect Agents that compact through non-quiescent points exhibit a characteristic signature: post-compaction steps that are individually well-reasoned but collectively re-execute or prematurely-execute work whose precondition was an unobserved event. The errors cluster immediately after compaction boundaries and vanish if compaction is disabled — which is why they are frequently misattributed to the model rather than to the compaction policy. The durable fix is to make the obligation ledger a first-class artifact that survives compaction independently of the prose summary, and to gate compaction on quiescence rather than on token count alone. Lossless salient-state extraction is achievable only for the *settled* past; the unsettled future must be carried structurally, not summarized. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class CompactionRefused(RuntimeError): """Raised when auto-compaction would drop a pending causal dependency.""" pass class ObligationState(Enum): PENDING = "pending" AWAITING = "awaiting" DISCHARGED = "discharged" @dataclass class Obligation: step_id: str state: ObligationState completion_predicate: Optional[str] = None blocks: list[str] = field(default_factory=list) @dataclass class Transcript: tokens: int token_budget: int obligations: dict[str, Obligation] = field(default_factory=dict) extractor_supports_obligations: bool = False def is_quiescent(tx: Transcript) -> bool: return all(o.state is ObligationState.DISCHARGED for o in tx.obligations.values()) def may_compact(tx: Transcript) -> bool: over_budget = tx.tokens > tx.token_budget if not over_budget: return False unresolved = [ o for o in tx.obligations.values() if o.state is not ObligationState.DISCHARGED ] if not unresolved: return True if is_quiescent(tx): return True if tx.extractor_supports_obligations: for o in unresolved: if o.state is ObligationState.AWAITING and not o.completion_predicate: raise CompactionRefused( f"obligation {o.step_id} is AWAITING with no completion predicate; " f"compaction would reify an ambiguous status token as settled state " f"and unblock downstream steps {o.blocks}" ) return True raise CompactionRefused( f"non-quiescent compaction: {len(unresolved)} pending obligation(s) " f"({[o.step_id for o in unresolved]}) but extractor has no obligation schema; " f"spill raw transcript to external storage and retain an out-of-band ledger instead" ) def auto_compact(tx: Transcript) -> str: if not may_compact(tx): return "no-op: under budget or already quiescent" if not tx.extractor_supports_obligations and not is_quiescent(tx): raise CompactionRefused("unreachable: guarded by may_compact") return f"compacted {tx.tokens} tokens; {len(tx.obligations)} obligations carried" ```