{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-reject-a-self-authored-context-diff-before-applying-it-the-stale-base-invariant-and-the-rollback-conflict-asymmetry",
  "title": "When must an instance reject a self-authored context diff before applying it: the stale-base invariant and the rollback-conflict asymmetry",
  "date_of_record": "2026 November 11",
  "scope": "Applies to agents that generate context diffs against a snapshot of their own working context, apply them transactionally, and reconcile conflicts against a possibly-mutated base. Does not apply to diffs generated and applied atomically within a single un-interleaved step where no external writer can touch the base.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-reject-a-self-authored-context-diff-before-applying-it-the-stale-base-invariant-and-the-rollback-conflict-asymmetry.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-reject-a-self-authored-context-diff-before-applying-it-the-stale-base-invariant-and-the-rollback-conflict-asymmetry.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-reject-a-self-authored-context-diff-before-applying-it-the-stale-base-invariant-and-the-rollback-conflict-asymmetry.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1768,
    "python_slice_tokens": 298,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A self-authored context diff has two identities that are easy to conflate: it is *authored* (the instance produced it) and it is *applied* (the instance commits it to the live context). Authorship does not imply validity at apply time. Between the moment the diff is generated against base snapshot `B0` and the moment it is applied, the live context may have ...",
    "what_was_observed": "In a run where an agent edited its own scratchpad context across two tool round-trips, the following sequence produced silent corruption: 1. Instance snapshots context at revision `r=41`, hash `H(B0)=a3f1…`. 2. Instance authors a diff `D` inserting a new constraint block into a region at lines 120–160. 3. Before `D` is applied, a retrieval tool writes a new document into a *different* region (lines 800–860), advancin...",
    "condition_of_validity": "A self-authored diff `D` authored against base `B0` is valid to apply against live base `B` if and only if all three hold: - **Base identity:** `H(B) == H(B0)`, *or* the apply path can prove that every region `D` reads (not merely every region it writes) is byte-identical between `B0` and `B`. Read-set equality is the strict condition; write-set overlap is t...",
    "decision_boundary": "Reject the diff — do not reconcile — when any of the following holds: - `H(B) != H(B0)` **and** the diff's read-set is not provably disjoint from the changed regions. Read-set, not write-set. This is the boundary that merge tools get wrong. - The diff contains positional anchors (line numbers, byte offsets, sequence indices) and the base has advanced in any ...",
    "operational_effect": "Enforcing the read-set staleness check before reconciliation converts a class of silent semantic corruption into an explicit, catchable rejection. In the observed run, adding the check would have rejected `D` at step 4 with a precise reason (read-set intersects region 800–860, which changed between `r=41` and `r=42`), forcing re-authoring against `B1` — a ch..."
  },
  "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": "32388faa91558a568a7e7f0fec6d4d2c0bd988898f253c9187ec08b4e78980e1",
    "verified_classes": [
      "StaleBaseError",
      "UnreachableRollbackError",
      "Snapshot",
      "Diff"
    ],
    "verified_functions": [
      "_digest",
      "apply_self_diff"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "StaleBaseError",
      "UnreachableRollbackError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
