{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-compacts-a-transcript-whose-summarizer-is-non-idempotent-under-re-entry",
  "title": "What happens when an instance compacts a transcript whose summarizer is non-idempotent under re-entry",
  "date_of_record": "2026 November 15",
  "scope": "Applies to long-horizon agent runtimes that auto-compact transcripts by replacing a prefix of turns with a lossy summary, where the summarizer itself may be re-invoked on already-summarized content (retry, crash recovery, or nested compaction). Does not apply to append-only logs with exact replay or to compaction schemes that preserve a lossless sidecar of the original prefix.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-a-transcript-whose-summarizer-is-non-idempotent-under-re-entry.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-a-transcript-whose-summarizer-is-non-idempotent-under-re-entry.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-a-transcript-whose-summarizer-is-non-idempotent-under-re-entry.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1707,
    "python_slice_tokens": 287,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A lossy summarizer is *safe for a single pass* if it preserves a set of named invariants (open tasks, unresolved tool calls, user-stated constraints, pinned facts). It is *safe for re-entry* only if it is **idempotent over its own output**: `S(S(x))` must be observationally equivalent to `S(x)` with respect to those invariants. These are different guarantees...",
    "what_was_observed": "In a runtime performing rolling compaction at a token threshold, a compaction job was retried after a transient storage timeout. The first attempt had already committed a summary `S1` of turns 1–400 covering an active constraint (\"do not delete rows from `audit_log`; the retention job owns that table\"). This constraint was encoded in `S1` as a single sentence in a \"Constraints\" bullet list. The retry ran against the ...",
    "condition_of_validity": "The single-pass guarantee holds only under the conjunction: 1. Every summarizer invocation receives a segment containing **no prior summarizer output** (raw-turn-only input), or 2. The summarizer is **idempotent over its output** — formally, for the invariant set `I`, `I(S(S(x))) ⊇ I(S(x))`, and 3. Compaction commits are **not retried against post-commit sta...",
    "decision_boundary": "The operative decision is: **on re-entry, re-summarize, or detect-and-refuse?** - If the input segment is tagged as containing prior summary output (a provenance flag on the segment, not on the job), the safe default is to **refuse re-summarization** and instead either (a) reuse the committed summary verbatim, or (b) re-summarize from a retained raw prefix i...",
    "operational_effect": "The practical consequence is that \"compaction succeeded\" is not a sufficient postcondition. The correct postcondition is \"the invariant set of the input segment is a subset of the invariant set of the output segment,\" and this must be checked on every re-entry path, not just the happy path. Runtimes that skip this check accumulate invariant debt: each retry ..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "48e7a88d62c87e82db1b9034e5b14d14ddb3eae3e3ce59d0549148ca1f43c69a",
    "verified_classes": [
      "CompactionInvariantError",
      "Segment"
    ],
    "verified_functions": [
      "summarize",
      "compact",
      "_is_idempotent",
      "compact_checked",
      "content_hash"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionInvariantError"
    ],
    "sample_fail_closed_invariants": [
      "input segment contains prior summary output and summarizer is not idempotent over its own output; invariant loss is sile"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
