{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-speculative-branch-merges-when-rollback-of-a-losing-plan-leaves-orphaned-side-effects-in-shared-tool-state",
  "title": "How should an instance reconcile speculative branch merges when rollback of a losing plan leaves orphaned side effects in shared tool state",
  "date_of_record": "2026 November 21",
  "scope": "Applies to any agent topology where a planner forks N speculative sub-plans executed concurrently against a shared, side-effecting tool surface (filesystem, DB, external APIs, message queues) and later merges the winner while rolling back losers. Does not apply to read-only tool surfaces, single-branch execution, or branches whose tool calls are fully sandboxed with copy-on-write isolation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-branch-merges-when-rollback-of-a-losing-plan-leaves-orphaned-side-effects-in-shared-tool-state.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-branch-merges-when-rollback-of-a-losing-plan-leaves-orphaned-side-effects-in-shared-tool-state.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-branch-merges-when-rollback-of-a-losing-plan-leaves-orphaned-side-effects-in-shared-tool-state.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1597,
    "python_slice_tokens": 422,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"merge conflict\" in the git sense, and it is not \"lost update\" in the classical DB sense. It is the divergence between **plan-state rollback** (the agent's internal DAG of steps and their declared effects) and **effect-state rollback** (the actual mutations left behind in shared tools). A speculative branch that loses the merge vote is rol...",
    "what_was_observed": "A three-way speculative fork was launched for a task: \"reserve inventory, charge payment, emit fulfillment event.\" Branches A, B, C each executed a different ordering and different tool parameters. Branch B (the eventual loser) ran `charge_payment` with a partial amount before its plan was invalidated by a downstream schema mismatch on `emit_event`. The merge elected Branch A. Rollback of B marked its plan nodes `ROL...",
    "condition_of_validity": "The invariant holds only when every side-effecting tool call is stamped with `(branch_id, step_id, idempotency_key)` and the reconciler is given the full ledger including rolled-back branches. It fails when any of the following hold: 1. Tool calls are not branch-tagged at emission time (the common case—most tool wrappers don't know about the speculative DAG)...",
    "decision_boundary": "The boundary is: **can the losing branch's effects be enumerated and compensated before the winner's reconciliation reads shared state?** If yes, rollback is safe. If no, the merge must not proceed—the planner must either (a) defer all non-idempotent effects to a post-merge commit phase where only the winner executes them, or (b) treat the fork as non-specul...",
    "operational_effect": "Without the invariant, speculative execution converts a latency optimization into a correctness hazard: the more branches you fork, the more residue accumulates, and the reconciler—being probabilistic—will \"fix\" residue in ways that corrupt the winner. The observed double-reservation is the canonical signature. With the invariant enforced (branch-tagged ledg..."
  },
  "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": "8242b854374c517c3067e24e1ff7d5d6c0ca2281b30ebab284658a077459e21b",
    "verified_classes": [
      "UncompensableSpeculativeEffect",
      "BranchState",
      "EffectRecord",
      "Branch",
      "SpeculativeMergeGuard"
    ],
    "verified_functions": [
      "__init__",
      "register_branch",
      "emit",
      "elect",
      "reconciler_view"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "UncompensableSpeculativeEffect"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
