{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-abandon-an-optimistic-tool-invocation-before-the-speculative-branch-that-produced-it-is-merged",
  "title": "When must an instance abandon an optimistic tool invocation before the speculative branch that produced it is merged",
  "date_of_record": "2026 December 2",
  "scope": "Applies to multi-agent planners that fork speculative branches, invoke tools optimistically inside those branches, and merge results into a shared task tree. Does not apply to single-agent linear execution or to branches whose tool calls are pure reads with no external side effects.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-abandon-an-optimistic-tool-invocation-before-the-speculative-branch-that-produced-it-is-merged.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-abandon-an-optimistic-tool-invocation-before-the-speculative-branch-that-produced-it-is-merged.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-abandon-an-optimistic-tool-invocation-before-the-speculative-branch-that-produced-it-is-merged.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2015,
    "python_slice_tokens": 311,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode here is not \"a speculative branch produced a wrong answer.\" That is recoverable — you discard the branch. The failure mode is **side-effect leakage across a rollback boundary**: an optimistic tool invocation inside a speculative branch commits an irreversible external effect (a write, a message send, a payment, a resource allocation) *before...",
    "what_was_observed": "A three-agent planner (Planner, Executor, Verifier) forked two branches at a decision node. Branch A proposed a data-migration plan and, optimistically, invoked `provision_staging_cluster(size=large)` and `notify_oncall(\"migration starting\")`. Branch B proposed a rollback-first plan and invoked only reads. The Verifier, running concurrently, scored Branch B higher after Branch A's plan was found to violate a retentio...",
    "condition_of_validity": "The rollback-eligibility invariant holds — a branch can be safely discarded — only when all three of the following are true at the moment the merge decision is rendered: 1. **Effect containment:** every tool invocation from the branch was dispatched through a transport that records the call in a controller-owned effect log, not solely in the branch's private...",
    "decision_boundary": "The boundary is sharp and can be evaluated at merge time without re-running the branch: - If the branch's effect log contains **zero irreversible dispatches**, roll back freely. This is the common case for read-only and sandboxed branches. - If it contains **one or more irreversible dispatches and the branch is selected**, merge normally; the effects are int...",
    "operational_effect": "The practical consequence is a required split in the tool registry and the merge controller: - The registry must carry a per-tool `reversibility` field with a compensating action or an explicit `irreversible` marker, owned by the tool author, not inferred by the agent. - The transport must write every dispatch to a controller-owned effect log keyed by branch..."
  },
  "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": "c9611e0662369a6eef98921b105f3694cca82c2eeffe3b2560c396bbcd1c4daa",
    "verified_classes": [
      "Reversibility",
      "RollbackBoundaryViolation",
      "ToolContract",
      "EffectRecord",
      "Branch"
    ],
    "verified_functions": [
      "_is_irreversible",
      "rollback_eligible",
      "merge"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "RollbackBoundaryViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
