{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-refuse-to-merge-a-speculative-branch-whose-tool-side-effects-were-already-committed-upstream",
  "title": "Under what conditions must an instance refuse to merge a speculative branch whose tool side effects were already committed upstream",
  "date_of_record": "2026 November 23",
  "scope": "Applies to multi-agent orchestrators that fork speculative branches from a shared checkpoint, execute tool calls optimistically inside those branches, and later merge the winning branch back into a canonical task graph. Does not apply to purely read-only speculative execution, nor to single-agent retry loops with no branch fan-out.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-merge-a-speculative-branch-whose-tool-side-effects-were-already-committed-upstream.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-merge-a-speculative-branch-whose-tool-side-effects-were-already-committed-upstream.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-to-merge-a-speculative-branch-whose-tool-side-effects-were-already-committed-upstream.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2313,
    "python_slice_tokens": 324,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure that matters here is not \"a speculative branch lost the race.\" That is the designed outcome of speculative execution: you fork N branches, you race them, you keep the winner, you discard the losers. The dangerous case is subtler. A *losing* branch has already emitted an irreversible or externally-observed tool side effect (a payment, a file write...",
    "what_was_observed": "A three-way speculative fan-out over a task graph node `provision_account`. The node's plan had two candidate strategies, so the orchestrator forked branches A, B, and C from a shared checkpoint. Each branch was authorized to call the same tool family (`crm.create_contact`, `billing.attach_plan`) under the assumption that speculative calls would be *deferred* until merge. The deferral was implemented as a write-ahead...",
    "condition_of_validity": "The invariant that must hold for a speculative merge to be safe is: > **A branch may be merged or discarded only if, for every tool invocation the branch performed, the invocation is either (a) provably side-effect-free, (b) proven deferred (buffered, not yet flushed), or (c) proven already reverted with a confirmed compensation receipt.** Formally, define f...",
    "decision_boundary": "The boundary between \"merge may proceed\" and \"merge must block\" is drawn at the moment the orchestrator transitions from *evaluating* branches to *committing* the winner. Before that transition, the orchestrator is allowed to be optimistic: it may fork, it may speculate, it may let branches call tools. After that transition, optimism is no longer licensed, b...",
    "operational_effect": "Once the merge gate consults the effect ledger, the failure mode changes shape rather than disappearing. The orchestrator now *blocks* merges that would orphan effects, which means speculative fan-out over effectful tools becomes slower and more expensive: every losing branch with committed effects must be compensated before the winner can be committed. This..."
  },
  "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": "307f73ce332ccbec1fe88a8aec66ad6c28e61230aaf65dd0eaa49a75ce547036",
    "verified_classes": [
      "PhantomCommitError",
      "EffectLedger"
    ],
    "verified_functions": [
      "commit_merge",
      "record_commit",
      "record_compensation",
      "residue"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "PhantomCommitError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
