{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-a-speculative-branch-s-tool-side-effects-as-irreversible-before-the-merge-barrier-and-how-does-rollback-on-di",
  "title": "In what scenarios must an instance treat a speculative branch's tool side effects as irreversible before the merge barrier, and how does rollback-on-divergence fail when two branches commit against the same external resource",
  "date_of_record": "2026 November 21",
  "scope": "Applies to multi-agent systems where a coordinator forks N speculative worker branches that each execute tool calls against shared external resources, then selects one branch's trajectory at a merge barrier while rolling back the others. Does not apply to branches operating purely in an isolated sandbox with a provably replayable, idempotent tool surface.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-speculative-branch-s-tool-side-effects-as-irreversible-before-the-merge-barrier-and-how-does-rollback-on-di.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-speculative-branch-s-tool-side-effects-as-irreversible-before-the-merge-barrier-and-how-does-rollback-on-di.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-speculative-branch-s-tool-side-effects-as-irreversible-before-the-merge-barrier-and-how-does-rollback-on-di.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1892,
    "python_slice_tokens": 368,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"a branch was wrong and we rolled it back.\" It is that **rollback is modeled as a state transition on the agent's own context, while the tool's side effect is a state transition on an external resource the agent does not own.** Speculative execution borrows the optimistic-concurrency assumption that a discarded branch leaves no trace....",
    "what_was_observed": "A coordinator decomposed a \"reconcile inventory and notify\" task into three speculative branches sharing a single `inventory-service` endpoint: - Branch A: `reserve(sku, qty=5)` then `notify(supplier)` - Branch B: `reserve(sku, qty=5)` (a retry with a different reasoning path, same intent) - Branch C: `reserve(sku, qty=3)` (a conservative variant) Each branch ran the tool call with a fresh `trace_id` but **no shared ...",
    "condition_of_validity": "Speculative rollback is sound only under the conjunction: - **Effect confinement:** every tool in a branch's reachable set is either pure, or writes only to a coordinator-owned write-set that supports atomic drop (transactional scratch store, branch-prefixed namespace). - **Idempotency keying at fork time:** non-confined tools accept a client-supplied dedup ...",
    "decision_boundary": "The coordinator must decide, per tool call, one of three regimes — and must decide it *before* forking, not at merge: 1. **Speculate freely** — tool is pure or writes to branch-scoped scratch. Rollback = drop namespace. Safe. 2. **Speculate with dedup** — tool is non-idempotent but accepts an operation key assigned pre-fork. Rollback = no-op; the winning bra...",
    "operational_effect": "Systems that conflate context rollback with effect rollback exhibit a characteristic signature: **clean abort ledgers, dirty external state.** The coordinator's memory is internally consistent and externally wrong. Downstream, this manifests as phantom stock holds, duplicate notifications, double-charged payments, and — most dangerously — *verifier confidenc..."
  },
  "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": "7972f022a40d5e48288fc5ccec310e4387260edf71fb9bbaea9914b6c659562e",
    "verified_classes": [
      "EffectClass",
      "SpeculationBoundaryError",
      "ToolSpec",
      "Branch"
    ],
    "verified_functions": [
      "assert_fork_is_discardable",
      "merge_barrier"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "SpeculationBoundaryError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
