{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-the-orphaned-speculative-branch-when-rollback-safe-tool-invocation-and-branch-reconciliation-disagree-on-commit-order",
  "title": "How does an instance detect the \"orphaned speculative branch\" when rollback-safe tool invocation and branch reconciliation disagree on commit order",
  "date_of_record": "2026 November 16",
  "scope": "Applies to multi-agent pipelines where a coordinator speculatively dispatches tool calls down multiple branches, each branch being individually rollback-safe (idempotent or compensable), and reconciliation merges branch results at a join point. Does not apply to strictly sequential pipelines, single-branch retries, or branches whose tools are non-compensable and therefore never rolled back.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-the-orphaned-speculative-branch-when-rollback-safe-tool-invocation-and-branch-reconciliation-disagree-on-commit-order.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-the-orphaned-speculative-branch-when-rollback-safe-tool-invocation-and-branch-reconciliation-disagree-on-commit-order.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-the-orphaned-speculative-branch-when-rollback-safe-tool-invocation-and-branch-reconciliation-disagree-on-commit-order.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1489,
    "python_slice_tokens": 328,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The invariant that fails here is not \"every speculative branch is rolled back on abort.\" That invariant is trivially enforceable per-branch. The invariant that actually matters is **the reconciliation ledger and the tool side-effect log must agree on which branches were committed before any branch is reconciled**. Rollback-safe invocation guarantees that *in...",
    "what_was_observed": "A three-branch speculative read-modify-write pipeline over a shared key-value store. Branch A wrote `key := f(orig)`, branch B wrote `key := g(orig)`, branch C was a read-only probe. Coordinator selected A at reconciliation, issued compensation for B, and immediately proceeded to a downstream reader. In 4 of 10,000 runs, the downstream reader observed `g(orig)` instead of `f(orig)`. Instrumentation showed the compens...",
    "condition_of_validity": "The rollback-safe guarantee holds **only if** the following precondition is enforced: *a branch's ledger state transitions to `ROLLED_BACK` or `COMMITTED` no earlier than the acknowledgment of its terminal tool call, and no branch is reconciled while any sibling is in `COMPENSATING` state*. The second clause is the one that is routinely violated because it i...",
    "decision_boundary": "Detect the orphan at the boundary where the reconciliation ledger and the side-effect log are compared. The decision is binary: either the terminal timestamp of every branch's last tool call precedes the reconciliation commit timestamp, or the branch is orphaned. Do not attempt to detect it via per-branch status flags — they will report `ROLLED_BACK` in the ...",
    "operational_effect": "When the orphan is detected, the correct action is to **re-run the join point from a snapshot taken before the first speculative dispatch**, not to re-issue the compensation. Re-issuing the compensation is a no-op because the tool is idempotent and already compensated; the corruption is in the reconciliation decision, which was made against a store state tha..."
  },
  "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": "609b42559a3ee8620c228aef5fbd7525cc4943324e172927a7697f023b8270f8",
    "verified_classes": [
      "OrphanedSpeculativeBranchError",
      "BranchRecord",
      "ReconciliationLedger"
    ],
    "verified_functions": [
      "reconcile_join_point",
      "run_join",
      "record_commit",
      "record_compensation_ack"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "OrphanedSpeculativeBranchError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
