{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-refuse-to-merge-a-speculative-agent-branch-that-has-already-mutated-external-state",
  "title": "In what scenarios must an instance refuse to merge a speculative agent branch that has already mutated external state",
  "date_of_record": "2026 November 12",
  "scope": "Applies to multi-branch speculative agent execution where branches share a memory substrate and may perform idempotent or non-idempotent writes to external systems (APIs, queues, databases, filesystems) before a merge decision is made. Does not apply to purely in-memory speculative trees with no side effects, nor to branches sandboxed behind a transactional outbox that is discarded on abort.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-to-merge-a-speculative-agent-branch-that-has-already-mutated-external-state.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-to-merge-a-speculative-agent-branch-that-has-already-mutated-external-state.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-to-merge-a-speculative-agent-branch-that-has-already-mutated-external-state.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1217,
    "python_slice_tokens": 229,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is not *conflict* versus *no conflict* in shared memory. It is **reversible divergence** versus **irreversible divergence**. Memory conflicts are always reversible: you can rebase, re-run, or discard a branch's memory delta because the memory substrate is under your control. External state mutations are not reversible in general—...",
    "what_was_observed": "A planner agent spawned three speculative branches (A, B, C) from a common checkpoint to satisfy a single user task. Each branch had read-write access to shared working memory and to a ticketing API. Branch A created ticket `T-1001` and wrote `ticket_id=T-1001` into shared memory slot `result.ticket`. Branch B, exploring an alternative, also created a ticket (`T-1002`) and wrote the same slot. Branch C failed validat...",
    "condition_of_validity": "The safe-merge invariant holds only when **every external mutation performed by any branch is recorded in shared memory as a first-class effect record (effect log entry with a stable id, target, and idempotency key) before the branch can be discarded.** Formally: for a merge to proceed, the set of external effects attributable to discarded or losing branches...",
    "decision_boundary": "Refuse the merge (raise, do not degrade) when all of the following hold: the branch executed at least one external write; the write is non-idempotent or lacks a verifiable idempotency key; and the write is absent from the surviving branch's effect log. Proceed with a compensating merge when the write is idempotent and keyed—adopt the effect record into the s...",
    "operational_effect": "Enforcing this boundary converts an invisible correctness bug into a loud, actionable abort. The orchestrator pays a small latency cost (effect-log inspection before merge) and occasionally must run compensation (close orphaned tickets, refund charges) instead of merging. In exchange, the merged memory graph is guaranteed to be a truthful description of exte..."
  },
  "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": "d4825d677ec692436cf787e3b242f51ef5f2c9c8a877e6d05e27d7bbfeb72bac",
    "verified_classes": [
      "UnsafeSpeculativeMergeError",
      "Effect",
      "Branch"
    ],
    "verified_functions": [
      "merge_speculative_branches"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "UnsafeSpeculativeMergeError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
