{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-rolls-back-a-self-edit-log-whose-inverse-patch-was-computed-against-a-context-window-that-has-already-been-mutated-by-a",
  "title": "What happens when an instance rolls back a self-edit log whose inverse patch was computed against a context window that has already been mutated by a concurrent compaction pass",
  "date_of_record": "2026 November 27",
  "scope": "Applies to any agent runtime that implements reversible context self-modification (append/insert/replace/delete of context segments) via an undo log, where the log stores inverse operations rather than full snapshots, and where a separate compaction/summarization pass may run against the same window. Does not apply to snapshot-only rollback schemes or to single-writer runtimes with no concurrent compaction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rolls-back-a-self-edit-log-whose-inverse-patch-was-computed-against-a-context-window-that-has-already-been-mutated-by-a.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rolls-back-a-self-edit-log-whose-inverse-patch-was-computed-against-a-context-window-that-has-already-been-mutated-by-a.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rolls-back-a-self-edit-log-whose-inverse-patch-was-computed-against-a-context-window-that-has-already-been-mutated-by-a.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1817,
    "python_slice_tokens": 355,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"rollback lost data.\" The failure is that a **reversible edit log is only reversible with respect to the state it was computed against**. An inverse patch `P⁻¹` produced by observing segment boundaries `(offset, length)` at edit time is a *positional* inverse. When a compaction pass rewrites, elides, or re-summarizes segments in the same w...",
    "what_was_observed": "A long-running research agent maintains a scratch context region it edits directly: it appends tool outputs, replaces stale hypotheses with revised ones, and deletes resolved sub-goals. Every edit pushes `(edit_id, forward_op, inverse_op, window_digest_at_edit, segment_span)` onto an undo log. On a failed verification step the agent calls `rollback(edit_id)`, which pops the log and applies `inverse_op`. The trace tha...",
    "condition_of_validity": "A positional inverse patch is valid **iff** the target window is byte-identical (or at minimum segment-boundary-identical) to the window observed at forward-edit time. Concretely, rollback of `edit_id` is sound only when all of the following hold: - `current_window_digest == window_digest_at_edit`, **or** - the runtime can prove that every segment intersecti...",
    "decision_boundary": "The runtime must decide, at rollback time, between three outcomes based on the digest/generation check: The boundary is not \"did the window change\" — the window changes constantly. The boundary is \"**did the window change in a way that makes the positional inverse denote different bytes than intended**.\" That is precisely the overlap/precedence test. A rollb...",
    "operational_effect": "With the guard in place, the failure mode inverts from *silent semantic corruption* to *explicit rollback refusal*. The agent receives a `RollbackUnavailable` signal at `t2`, learns that the edit is no longer reversible because compaction consumed it, and is forced onto a defined recovery branch: either reload from the last full snapshot or re-derive the rej..."
  },
  "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": "8f70e446ef996e9279aafce1ef8a930bec233d9071960a1b6787e39f612ace06",
    "verified_classes": [
      "RollbackUnavailable",
      "EditEntry",
      "ContextWindow"
    ],
    "verified_functions": [
      "_overlaps_or_precedes",
      "rollback",
      "digest",
      "compact"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "RollbackUnavailable"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
