{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-refuse-optimistic-branch-merge-when-a-speculative-tool-invocation-s-side-effects-are-not-idempotent-across-roll",
  "title": "Under what conditions must an instance refuse optimistic branch merge when a speculative tool invocation's side effects are not idempotent across rollback boundaries",
  "date_of_record": "2026 December 2",
  "scope": "Applies to multi-agent systems where a planner forks speculative branches that invoke tools optimistically before a winning branch is selected, and where rollback is implemented as compensating actions rather than transactional isolation. Does not apply to systems with true sandboxed side-effect isolation (e.g., pure in-memory tools) or to single-branch execution.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-optimistic-branch-merge-when-a-speculative-tool-invocation-s-side-effects-are-not-idempotent-across-roll.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-optimistic-branch-merge-when-a-speculative-tool-invocation-s-side-effects-are-not-idempotent-across-roll.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-optimistic-branch-merge-when-a-speculative-tool-invocation-s-side-effects-are-not-idempotent-across-roll.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1636,
    "python_slice_tokens": 299,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Most rollback designs assume that \"undo\" is the dual of \"do\": if a branch invoked `write_record(id=42, value=B)` and lost, the reconciler calls `write_record(id=42, value=prior)` and considers the branch reverted. This holds only when the tool's effect is *state-overwriting and idempotent under replay*. The failure mode here is subtler than a plain non-idemp...",
    "what_was_observed": "In a three-branch planner (A, B, C) sharing a `quota` counter and a `provision` tool, the following trace was captured over ~12k tasks: 1. Planner forks A, B, C. All three invoke `read_counter(\"quota\")` → all see `used=7, limit=10`. Each branch's local reasoning decides \"3 slots free, I may provision 1.\" 2. A invokes `increment_counter(\"quota\", 1)` → `used=8`. A reads back `used=8`, provisions `res-A`. A's branch mar...",
    "condition_of_validity": "Optimistic invocation with compensating rollback is only sound when *all* of the following hold: - **Isolation of observation:** no sibling branch can read state mutated by an uncommitted branch. Either the tool is per-branch (copy-on-write, branch-scoped namespace) or reads are versioned to the branch's fork point. - **Commutative compensation:** the compen...",
    "decision_boundary": "Before a branch invokes a tool optimistically, the instance must classify the tool along two axes: The decision must be made at *tool-registration* time, not at invocation time, because a branch under token pressure will rationalize \"this increment is probably fine.\" The registry entry for `increment_counter` must carry `observable_to_siblings=True, compensa...",
    "operational_effect": "Enforcing this boundary converts a class of silent invariant violations (overcommit, double-send, duplicate ledger entries) into an explicit `SpeculativeMergeRefused` signal at fork time, which the planner can route to serialization or deferral. The cost is reduced parallelism on a small set of tools (counters, quotas, append-only logs, notification sinks). ..."
  },
  "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": "745db7cdf8947fa73fb50f8b74b2a09204a9645aed803e54ac0619cc82e9f0b0",
    "verified_classes": [
      "SpeculativeMergeRefused",
      "ToolClass",
      "ToolProfile"
    ],
    "verified_functions": [
      "authorize_optimistic_invocation",
      "fork_and_invoke",
      "classify"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SpeculativeMergeRefused"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
