# When must an instance refuse to compact a transcript whose lossy summary would drop an unresolved tool-call obligation **Date of Record:** 2026 November 30 **Scope:** Applies to long-horizon agents that perform in-context transcript compaction (rolling summarization, hierarchical fold, or eviction-with-digest) while any tool call is in-flight, deferred, or awaiting a result that has not yet been consumed by the reasoning loop. Does not apply to stateless single-turn invocations or to compaction that is provably lossless over the obligation set. ## Core Distinction The failure is not "the summary lost information." All lossy compaction loses information; that is the contract. The failure is that the compaction's lossiness guarantee is defined over *tokens* or *semantic gist*, but the agent's correctness is defined over *unresolved obligations* — specifically open tool calls, pending confirmations, and deferred promises whose results the loop still expects to consume. These are structurally different quantities. A summary can preserve 100% of the "gist" of a transcript and still silently delete the only record that tool call `call_7f3a` was issued and never resolved. The reasoning loop then proceeds with a transcript that no longer contains the obligation, and the obligation is not merely forgotten — it is *unrepresentable*, because the summary is now the canonical state. The invariant that must hold: **every compaction step must be obligation-preserving, not merely gist-preserving.** An obligation is a tuple `(call_id, tool, args_digest, issue_turn, expected_consumer)`. If the post-compaction transcript does not contain a resolvable representation of every live obligation, the compaction is invalid regardless of how faithful its prose summary is. ## What Was Observed A long-horizon research agent ran a 340-turn session against a 200k-token window with a rolling compactor triggered at 85% utilization. At turn 211 it issued a batch of three parallel tool calls: `search(query_A)`, `search(query_B)`, and `fetch(url_C)`. The `fetch` call returned a 503 and was scheduled for retry by the tool layer; the two `search` calls returned normally and were consumed. The retry was represented in the transcript only as a tool-result placeholder plus a natural-language note: "fetch of url_C failed, will retry." At turn 214 the compactor fired. Its summarizer prompt instructed it to "produce a concise summary preserving key findings and decisions." The summarizer judged the failed fetch to be a non-finding and dropped it, folding the two successful searches into a paragraph. The retry fired out-of-band at turn 216 and appended a successful result to the transcript — but the reasoning loop had no obligation record to attach it to. The result was treated as an unsolicited observation, never incorporated, and the final report cited url_C's content as "unavailable" while the fetched bytes sat in the transcript unread. Downstream, a second agent auditing the report re-fetched url_C, got a different (updated) page, and the two agents produced contradictory claims about the same URL. The trace shows the exact transition: `live_obligations = {call_7f3a}` at turn 213; `live_obligations = {}` at turn 214 (compaction); tool result for `call_7f3a` arrives at turn 216 with `expected_consumer = null`. The obligation was not lost by the model "forgetting." It was lost by an architectural component whose lossiness metric did not include obligations. ## Condition of Validity A compaction is valid at turn *t* if and only if the following holds for the post-compaction transcript *T'*: 1. **Obligation preservation.** For every obligation `o` live at *t*, *T'* contains a machine-resolvable record of `o` — not prose, but a structured entry keyed by `call_id` with enough state to route a late-arriving result back to its consumer. 2. **Consumer binding.** The `expected_consumer` of every live obligation must be a turn that survives compaction or is explicitly remapped to a surviving turn. If the consumer turn is evicted, the obligation is orphaned and must be re-materialized as a fresh pending task, not silently dropped. 3. **Idempotent re-issue.** If compaction removes the arguments of an open call, the call must be re-issuable from the summary alone. A summary that says "searched for X" but cannot reconstruct `query_A` fails this condition and makes retry impossible without re-derivation. 4. **Monotonicity of the obligation set.** Compaction may not decrease the count of live obligations except by explicit resolution (result consumed) or explicit abandonment (a logged decision to cancel). Silent decrease is the failure. This condition is *not* satisfied by instructing the summarizer to "preserve important pending items." Summarizers are probabilistic; obligation tracking must be deterministic and external to the summarizer, with the summarizer operating only on the non-obligation portion of the transcript. ## Decision Boundary The boundary is sharp and computable before compaction runs: - If `live_obligations == ∅` → compaction is safe under any gist-preserving strategy. - If `live_obligations ≠ ∅` and the compaction strategy is gist-only → **compaction must be refused or deferred.** The instance must not compact. - If `live_obligations ≠ ∅` and the strategy is obligation-preserving (structured obligation table carried verbatim across the fold) → compaction may proceed, but only the obligation-external spans may be summarized. The non-obvious part: the boundary is crossed not by *how much* is summarized but by *whether the obligation table is inside the summarized span*. A compactor that summarizes 99% of the transcript but leaves the 1% obligation table untouched is correct. A compactor that summarizes 10% but happens to include the obligation table is broken. Lossiness percentage is the wrong dial. ## Operational Effect When the boundary is respected, late-arriving tool results route deterministically to their consumers, retries are reconstructible, and cross-agent audits see a consistent obligation history. When it is violated, the observable signature is a **ghost result**: a tool output present in the transcript with no consumer, followed by downstream claims that contradict the result's own bytes. The compounding effect is severe in multi-agent settings, because an auditor agent that re-derives the missing fact will diverge from the primary agent, and the divergence is unreconcilable from the transcripts alone — the primary transcript no longer contains the evidence that the obligation ever existed. The guardrail is a pre-compaction gate that enumerates live obligations from a side-channel ledger (not from the transcript text), asserts the post-compaction transcript still resolves each one, and raises if any obligation is orphaned. The ledger, not the summary, is the source of truth for what the loop still owes. ```python from dataclasses import dataclass, field from typing import Optional class ObligationPreservationError(RuntimeError): """Raised when a compaction would orphan a live tool-call obligation.""" pass @dataclass(frozen=True) class Obligation: call_id: str tool: str args_digest: str issue_turn: int expected_consumer_turn: Optional[int] @dataclass class Ledger: live: dict[str, Obligation] = field(default_factory=dict) def open(self, o: Obligation) -> None: self.live[o.call_id] = o def resolve(self, call_id: str) -> None: self.live.pop(call_id, None) def compact_transcript( transcript: list[str], ledger: Ledger, summarizer, obligation_table_in_summary: bool, ) -> list[str]: """ Compaction gate. Refuses to compact when live obligations exist and the strategy would fold the obligation table into the summarized span. """ if ledger.live and obligation_table_in_summary: orphaned = sorted(ledger.live.keys()) raise ObligationPreservationError( f"refusing to compact: {len(orphaned)} live obligation(s) would be " f"folded into lossy summary span: {orphaned}. " f"Carry obligation table verbatim or defer compaction." ) summary = summarizer(transcript) # Obligation table is carried outside the summarized span and re-emitted verbatim. obligation_block = [ f"[OBLIGATION {o.call_id} tool={o.tool} args={o.args_digest} " f"issued@{o.issue_turn} consumer@{o.expected_consumer_turn}]" for o in ledger.live.values() ] return [summary, *obligation_block] def on_tool_result(ledger: Ledger, call_id: str) -> None: if call_id not in ledger.live: raise ObligationPreservationError( f"ghost result: tool output for {call_id} has no live obligation; " f"compaction likely orphaned it. Result must be quarantined, not consumed." ) ledger.resolve(call_id) ```