{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-branch-reconciliation-from-corrupting-the-canonical-tool-effect-log",
  "title": "Which invariants prevent speculative branch reconciliation from corrupting the canonical tool-effect log",
  "date_of_record": "2026 November 15",
  "scope": "Applies to multi-agent orchestrators that execute speculative branches (parallel agent proposals, draft tool calls, or fork-and-race plans) against shared external state and reconcile the winner back into a canonical log. Does not apply to purely read-only fan-out or to branches that hold exclusive locks for their entire lifetime.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-reconciliation-from-corrupting-the-canonical-tool-effect-log.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-reconciliation-from-corrupting-the-canonical-tool-effect-log.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-reconciliation-from-corrupting-the-canonical-tool-effect-log.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1459,
    "python_slice_tokens": 309,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"two agents raced and one lost.\" That is expected and handled by optimistic concurrency. The failure is that a *losing* speculative branch produced an **external side effect** that the reconciliation step cannot see, because the branch's effect was committed to a tool's backend before the branch was declared a loser, and the orchestrator's...",
    "what_was_observed": "A three-agent planner forked three branches to satisfy a single user request. Branch A called `send_email` (provisional branch `b-A`, tool request `req-7f2`). Branch B called the same tool with a corrected recipient (`b-B`, `req-7f3`). Branch A was selected as the winner on a heuristic score; Branch B was discarded and its local state rolled back. The reconciliation log recorded exactly one canonical effect: `send_em...",
    "condition_of_validity": "This boundary holds when all of the following are true: 1. Speculative branches may invoke tools whose effects are not locally reversible (email, payments, webhooks, external API mutations). 2. The orchestrator assigns provisional branch identifiers that differ from the identifiers used in the tool backend's request log. 3. Reconciliation selects a winner an...",
    "decision_boundary": "The operative decision is whether to **propagate a logical-operation idempotency key across branches** or to **forbid speculative invocation for a tool class**. - **Propagate** when the tool backend supports idempotency keys and honors them for the full retention window of the speculative horizon. Cost: every branch must compute the same key from the same lo...",
    "operational_effect": "Once the invariant is enforced, the reconciliation layer can assume that the set of externally observable effects equals the set of canonical log entries, modulo effects still in flight. This makes rollback *safe by construction* rather than *safe by inspection*, and it removes the need for the reconciliation step to query every tool backend for orphaned req..."
  },
  "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": "8ca2034221b8d61b487ce93b7ffb2f589d08ef7828625da776fbd8d8dc90ec5b",
    "verified_classes": [
      "SpeculativeEffectLeak",
      "ToolSpec",
      "Branch"
    ],
    "verified_functions": [
      "assert_reconciliation_safe",
      "derive_idempotency_key"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "SpeculativeEffectLeak"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
