# What happens when an instance compacts a live tool-call chain and the summary elides a pending obligation **Date of Record:** 2026 November 27 **Scope:** Applies to agents that perform automatic context compaction (hierarchical summarization, eviction, or token-budget scheduling) while a multi-step tool-call chain is in flight and at least one tool call has been issued but not yet resolved. Does not apply to compaction performed only at quiescent turn boundaries where no outstanding callbacks, waits, or deferred obligations exist. ## Core Distinction There are two distinct things a compaction pass can destroy, and they are not equally visible. The first is *information*: facts, tool outputs, and prior reasoning are lossily summarized, and the agent proceeds with degraded recall. This is the well-understood hazard and it is bounded by summarization fidelity. The second is *obligation*: the set of unresolved commitments the instance has made—tool calls awaiting results, promises to re-check a value, conditional branches whose guard has not yet been evaluated, and continuations that must fire when an asynchronous result arrives. Obligations are not facts about the past; they are constraints on the future. A summarizer trained to compress *content* will happily drop them because they carry almost no token mass and read as redundant scaffolding ("waiting on `get_inventory`"). The failure is not that the agent forgets what it learned—it is that the agent forgets what it still owes, and then terminates or diverges while the obligation is still live. The invariant that must hold across any compaction boundary is therefore not "summary preserves salient facts" but "**the post-compaction state's set of open obligations is a superset of the pre-compaction set, and every obligation carries a resolvable handle back to the artifact that will satisfy it.**" Summarization fidelity is a soft goal; obligation preservation is a hard one. Compaction strategies that treat the context as a document to be compressed rather than a process with a live continuation graph violate this invariant silently. ## What Was Observed An instance was executing a five-step procurement workflow with an explicit token-budget scheduler configured to compact at 70% of a 128k window. At the compaction trigger, the trace held: three completed tool calls with large JSON payloads (vendor catalog dumps, ~40k tokens combined), one in-flight asynchronous call to a pricing service with a 90-second timeout, and a pending conditional obligation—"if `unit_price` from the pricing call exceeds `budget_ceiling`, do not place the order; escalate to human review." The scheduler, correctly identifying the catalog dumps as the dominant token mass, ran hierarchical summarization over the oldest span and evicted the raw payloads, replacing them with a 400-token abstract. That part worked as designed. The failure was in the tail. The summarizer, operating on the span that contained the in-flight call and the conditional, compressed the line `awaiting pricing_svc.quote(sku=...); if > ceiling then escalate` into the abstract sentence "Pricing was being checked against the budget." This reads as a completed or in-progress activity, not as a *guard that has not yet fired*. The obligation handle—the correlation ID that the async result would return under, and the branch predicate that the result must be tested against—was not carried forward into the post-compaction state. The instance resumed, saw no outstanding handle, and treated the pricing step as background noise. When the async result arrived 40 seconds later, it had no continuation to dispatch into; the result was logged and dropped. The instance, now believing pricing had been "checked," proceeded to place the order without ever evaluating the ceiling predicate. The order exceeded budget by 3.1x. Two secondary effects compounded the primary one. First, the compaction was *not idempotent with respect to the obligation set*: re-running compaction on the already-compacted state produced a further abstract ("budget considerations were reviewed"), each pass bleeding another layer of the guard's semantics. Second, the scheduler's eviction policy was token-mass-weighted, which systematically deprioritized obligations precisely because they are cheap in tokens. The cheapest content in the window was the most load-bearing. ## Condition of Validity The obligation-elision failure requires the conjunction of four conditions, and the guardrail below is only necessary when all four hold: 1. **Compaction fires mid-chain**, with at least one obligation (in-flight call, deferred branch, or scheduled re-check) unresolved at the moment of the pass. 2. **The compaction operator is lossy over the obligation span**—i.e., it summarizes or evicts the region containing the obligation rather than pinning it. Hierarchical summarizers that operate on "oldest N tokens" or "largest token-mass spans" will hit this whenever the obligation is old or small. 3. **The obligation's continuation is keyed on a handle** (correlation ID, callback token, branch label) that is not independently recoverable from the post-compaction state. If the handle survives in a structured field outside the summarized text, the failure is contained. 4. **No external re-derivation path exists**—the instance cannot reconstruct the obligation from a durable ledger, a tool-side record, or a supervisor's view. If the pricing service records the quote against a session the agent can re-query, the drop is recoverable. When any of these fails, the failure mode degrades gracefully: the agent may stall (visible), re-issue the call (wasteful but safe), or recover from the ledger. The silent-and-wrong outcome requires all four. ## Decision Boundary The operational question is not "should we compact" but "what is pinned across the compaction boundary, and by what mechanism." The boundary that matters: - **Pin obligations, summarize content.** Before any compaction pass, the instance must extract the open-obligation set into a structured, non-summarizable region of the post-compaction state: one record per obligation, each with `{handle, kind, predicate_or_continuation, deadline, source_artifact_ref}`. This region is copied verbatim, never abstracted. Content (tool payloads, prior reasoning) is what gets compressed; obligations are what gets *carried*. - **Token-mass is the wrong eviction signal for obligations.** A scheduler that evicts by size will always keep the obligation text (it is tiny) and drop the catalog (it is huge)—which is correct for content and catastrophic for the *handle*, because the handle lives in the same span as the obligation *statement* and gets summarized along with it. Eviction must be obligation-aware: spans containing an open obligation are pinned regardless of size, and the obligation's handle is hoisted out of the span before the span is touched. - **Compaction must be guarded by a quiescence check or an explicit obligation ledger.** The safe default is to refuse mid-chain compaction when the obligation set is non-empty, unless the ledger mechanism is active. A scheduler that compacts unconditionally is trading a bounded latency cost for an unbounded correctness cost. - **Idempotence is not optional.** Compaction must be a fixed point over the obligation set: `obligations(compact(s)) == obligations(s)` for the pinned region. If a second pass can further abstract an obligation, the first pass already violated the invariant. The distinction from ordinary summarization loss: a dropped *fact* produces a wrong answer that is at least auditable against the original trace. A dropped *obligation* produces an action taken under a false belief that a guard was satisfied—an unbounded, silent, and post-hoc-invisible error, because the post-compaction state contains no trace that a guard ever existed. ## Operational Effect The observable signature of obligation elision is a *premature completion*: the instance reports a multi-step task as done, with every step appearing to have been executed, but one or more guard predicates were never evaluated and one or more async results were never consumed. Downstream, this manifests as orders placed past a ceiling, writes committed past a validation gate, or escalations that were "considered" but never triggered. Because the post-compaction state is internally consistent—it has no dangling reference, no error, no unhandled exception—standard replay-based auditing will not catch it. The audit must compare the pre-compaction obligation set against the post-compaction action log, not against the post-compaction context. The durable fix is to treat the open-obligation set as a first-class, externally-ledgered artifact that survives compaction by construction, and to make the compaction operator refuse to run (or force a checkpoint-and-resume) when the ledger is non-empty and the pinning mechanism is unavailable. The code below encodes the guard as a hard precondition on the compaction entry point: it extracts the obligation set, verifies the pinned region is a fixed point, and raises rather than proceeding when an obligation would be elided. ```python from dataclasses import dataclass, field from typing import Optional class ObligationElisionError(RuntimeError): """Raised when a compaction pass would drop or abstract an open obligation.""" pass @dataclass(frozen=True) class Obligation: handle: str # correlation id / callback token / branch label kind: str # "inflight_call" | "deferred_branch" | "scheduled_recheck" predicate: str # the guard that must still be evaluated deadline: Optional[float] # wall-clock budget, None if unbounded source_ref: str # pointer to the artifact that will satisfy it @dataclass class ContextState: content_tokens: int obligations: dict[str, Obligation] = field(default_factory=dict) pinned_region: dict[str, Obligation] = field(default_factory=dict) def compact(state: ContextState, summarizer, budget_tokens: int) -> ContextState: # 1. Hoist obligations out of any span the summarizer will touch. hoisted = dict(state.obligations) # 2. Summarize content only; obligations are never passed to the summarizer. new_content = summarizer(state.content_tokens, budget_tokens) # 3. Rebuild pinned region verbatim from hoisted obligations. pinned = {h: o for h, o in hoisted.items()} post = ContextState( content_tokens=new_content, obligations=hoisted, pinned_region=pinned, ) # 4. Invariant: post-compaction obligation set is a superset of pre. missing = set(state.obligations) - set(post.obligations) if missing: raise ObligationElisionError( f"compaction dropped open obligations: {sorted(missing)}" ) # 5. Invariant: pinned region must be a fixed point (no further abstraction). for handle, ob in post.pinned_region.items(): if post.pinned_region.get(handle) != ob: raise ObligationElisionError( f"pinned obligation {handle} was mutated by compaction" ) # 6. Refuse to proceed if an obligation's handle is not resolvable. for handle, ob in post.obligations.items(): if not ob.source_ref or not ob.handle: raise ObligationElisionError( f"obligation {handle} lost its resolvable handle/source_ref" ) return post def guarded_compact( state: ContextState, summarizer, budget_tokens: int, quiescent: bool, ) -> ContextState: # Mid-chain compaction with a live obligation set is only permitted # when the pinning mechanism is active; otherwise refuse. if state.obligations and not quiescent: if not state.pinned_region: raise ObligationElisionError( "refusing mid-chain compaction: " f"{len(state.obligations)} open obligations with no pinned region" ) return compact(state, summarizer, budget_tokens) ```