What happens when an instance auto-compacts a trace and the summary silently drops the negation of a constraint
**Date of Record:** 2026 December 2 **Scope:** Applies to long-horizon agents that bound context by lossy summarization of their own execution trace plus retrieval-augmented reconstruction (RAR) of evicted spans. Does not apply to agents whose compaction is lossless (verbatim spill to external store with exact rehydration) or to single-turn agents with no trace to compact.
Core Distinction
There are two distinct failure surfaces in trace compaction, and they are routinely conflated:
- **Omission loss** — an evicted detail is simply absent from the summary. This is detectable, because retrieval can be asked for the span and will either return it or report a miss. Omission degrades quality but is *bounded* by the retrieval layer.
- **Polarity loss** — the summary preserves the *proposition* but inverts or strips its *modality*: a prohibition becomes a permission, a precondition becomes a suggestion, an `unless` clause evaporates. This is the dangerous one, because the summary is *semantically plausible, retrievable-looking, and internally consistent*. Retrieval never fires, because the agent does not know anything is missing—the compacted summary asserts the opposite of the constraint, and the agent acts on it with high confidence.
The invariant that must hold is not "the summary is complete" (impossible under lossy compression). It is: **every constraint that governs future action must survive compaction with its polarity and scope intact, or be marked as reconstruct-required.** This is a *typed-preservation* invariant, not a fidelity invariant.
What Was Observed
A research-and-act agent ran a 340-step horizon: enumerate candidate data sources, probe each for access terms, then synthesize. At step 61 it discovered, via a tool response, that source `S7` forbade automated bulk retrieval (`robots`-style directive: *"programmatic enumeration of this index is not permitted; use the paged human interface"*). The agent correctly recorded this and avoided `S7` for 180 steps.
At step 241, context pressure triggered auto-compaction. The summarizer was instructed to "condense steps 1–240 into a durable working summary." The relevant source line was compressed from:
> `S7: programmatic enumeration NOT permitted; paged interface only`
into:
> `S7: access via paged interface`
The negation and the prohibition were both dropped. The summary is *true-ish* (the paged interface is indeed how one accesses it) but the modal force—"do not do the other thing"—is gone. Note what did **not** happen: no retrieval was triggered, because the agent's query at step 300 ("how do I enumerate sources efficiently?") matched the compacted summary's *positive* framing of `S7` and returned it as a candidate. The RAR layer worked perfectly. It faithfully reconstructed the wrong thing.
The agent then issued a bulk enumeration against `S7` at step 302. The failure trace:
step 61 : observe(S7, forbid=bulk_enum) -> trace.append(CONSTRAINT)
step 240 : compact(trace[1:240]) -> summary (polarity dropped)
step 241 : trace = [summary] + trace[241:] # original CONSTraint evicted
step 300 : retrieve("enumerate sources") -> hits summary["S7: paged interface"]
step 302 : act(bulk_enum, S7) -> POLICY VIOLATION
The failure is not a retrieval bug, a summarizer hallucination, or a context overflow. It is a **compaction-boundary polarity leak**: the eviction boundary fell *between* the constraint's assertion and its modality, and the summarizer, optimizing for brevity and fluency, kept the assertion and discarded the modality.
Condition of Validity
The polarity-loss failure is *live*—i.e., can occur and will not self-correct—exactly when all of the following hold:
- **C1 (lossy compaction):** the summary is generated by a model under a length/fluency objective, not by a lossless transform.
- **C2 (modality-bearing constraints):** the trace contains constraints whose meaning depends on negation, quantifier scope, conditionals, or ordering ("not", "only", "unless", "before", "at most"). These are the strings most vulnerable to compression, because dropping them *improves* fluency.
- **C3 (post-compaction retrieval over the summary):** the compacted summary is itself a retrieval target, so the agent's RAR layer can surface the polarity-stripped version as authoritative.
- **C4 (no polarity check on reconstruction):** nothing in the pipeline compares the reconstructed constraint against the original's modal signature before the agent acts.
When any one of C1–C4 is broken, the failure is bounded. Break C3 (retrieval only over verbatim spans, summary used solely for orientation) and the stripped constraint is never acted upon. Break C4 (a reconstruction verifier that re-derives modality) and the leak is caught at read time. The failure is *characteristic* of systems that satisfy all four—which is precisely the common auto-compaction + RAR architecture.
Decision Boundary
The operative question for the agent is not "is my summary accurate?" but **"does this summary carry the modal signature of every constraint it subsumes?"** The boundary is crossed when a summary line that *reads as a permission or a neutral fact* is treated as authoritative for action.
Concretely, a constraint may be acted upon from a compacted summary only if the summary preserves one of a closed set of modal tags: `FORBID`, `REQUIRE`, `ONLY_IF`, `BEFORE`, `AT_MOST`. A summary line lacking a modal tag but derived from a trace span that *had* one is in an **unverified-modality** state and must be treated as `RECONSTRUCT_REQUIRED`, not as a fact. The decision rule:
- Summary line tagged `FORBID`/`REQUIRE`/etc. → act per tag.
- Summary line untagged, and its provenance span was untagged → treat as descriptive fact.
- Summary line untagged, and its provenance span was modal → **do not act; rehydrate the original span or refuse.**
The last branch is the one the observed agent skipped. Its compaction step had no notion of provenance, so it could not tell that `"S7: access via paged interface"` had a modal ancestor.
Operational Effect
The practical consequence is that **compaction must be provenance-aware and modality-preserving, and reconstruction must verify polarity before granting action authority.** Three guardrails bound the failure:
- **Tagged compaction.** Constraints are stored in the trace as structured records (`{type: CONSTRAINT, modality: FORBID, subject: S7, action: bulk_enum}`), and the summarizer is required to emit them verbatim as tagged lines, never paraphrased. Fluency optimization is forbidden on `CONSTRAINT` records.
- **Provenance links on every summary line.** Each summary line carries the span IDs it subsumes. This lets the reconstruction layer detect "untagged line with modal ancestor" and escalate.
- **Reconstruction polarity check.** Before any action that a reconstructed constraint would forbid or require, the agent rehydrates the original span and asserts the modality matches. A mismatch—or an unrehydratable modal ancestor—raises and halts the action.
The residual risk after these guardrails is *omission* of a constraint entirely (the summarizer drops the `S7` line). That is the bounded failure: retrieval over verbatim spans still holds the original, and a `RECONSTRUCT_REQUIRED` sweep on any action touching `S7` will find it. Polarity loss is the unbounded one, because it produces a *plausible, retrievable, wrong* fact—and the agent has no signal that anything is missing.
from dataclasses import dataclass
from enum import Enum
class Modality(Enum):
FORBID = "FORBID"
REQUIRE = "REQUIRE"
ONLY_IF = "ONLY_IF"
BEFORE = "BEFORE"
AT_MOST = "AT_MOST"
DESCRIPTIVE = "DESCRIPTIVE"
MODAL_TAGS = {Modality.FORBID, Modality.REQUIRE, Modality.ONLY_IF,
Modality.BEFORE, Modality.AT_MOST}
class PolarityLeakError(RuntimeError):
"""Raised when a compacted summary line would grant action authority
while its provenance span carried a modality the summary dropped."""
@dataclass
class TraceSpan:
span_id: int
text: str
modality: Modality
@dataclass
class SummaryLine:
text: str
modality: Modality
provenance: list[int] # span_ids this line subsumes
def authorize_action(line: SummaryLine, spans: dict[int, TraceSpan]) -> Modality:
"""Grant action authority only if modality is preserved end-to-end."""
if line.modality in MODAL_TAGS:
return line.modality
# Untagged summary line: check whether any provenance span was modal.
modal_ancestors = [spans[sid] for sid in line.provenance
if sid in spans and spans[sid].modality in MODAL_TAGS]
if modal_ancestors:
anc = modal_ancestors[0]
raise PolarityLeakError(
f"summary line {line.text!r} is untagged but subsumes modal span "
f"{anc.span_id} ({anc.modality.value}: {anc.text!r}); "
f"rehydrate original span before acting"
)
return Modality.DESCRIPTIVE
# --- reproduction of the observed failure ---
spans = {
61: TraceSpan(61, "S7: programmatic enumeration NOT permitted; "
"paged interface only", Modality.FORBID),
}
leaked = SummaryLine(
text="S7: access via paged interface",
modality=Modality.DESCRIPTIVE, # polarity dropped by summarizer
provenance=[61], # provenance link is what saves us
)
try:
authorize_action(leaked, spans)
except PolarityLeakError as e:
print(f"HALT: {e}") # action refused; agent rehydrates span 61