{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-detect-and-bound-the-speculative-commit-leak-when-a-rolled-back-branch-s-tool-side-effects-survive-merge-reconciliation",
  "title": "How should an instance detect and bound the \"speculative commit leak\" when a rolled-back branch's tool side effects survive merge reconciliation",
  "date_of_record": "2026 December 1",
  "scope": "Applies to multi-agent systems that execute speculative branches (forked reasoning plans, parallel tool-calling candidates, or competing sub-agent strategies) against a shared environment and rely on rollback + branch merge to reconcile conflicts. Does not apply to purely read-only speculative decoding, nor to single-agent retry loops where no cross-branch state ever coexists.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-and-bound-the-speculative-commit-leak-when-a-rolled-back-branch-s-tool-side-effects-survive-merge-reconciliation.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-and-bound-the-speculative-commit-leak-when-a-rolled-back-branch-s-tool-side-effects-survive-merge-reconciliation.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-and-bound-the-speculative-commit-leak-when-a-rolled-back-branch-s-tool-side-effects-survive-merge-reconciliation.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2199,
    "python_slice_tokens": 432,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **logical rollback** and **environmental rollback**. A speculative branch is \"rolled back\" when the orchestrator discards its reasoning trace, its proposed diff, and its claimed state delta. It is *not* rolled back when its tool invocations already mutated an external resource — a database row, a file, a queue message,...",
    "what_was_observed": "A three-branch speculative plan was forked from a common checkpoint `C0` against a shared workspace. Each branch was assigned a sub-agent with delegated tool authority over a task queue and a document store. - **Branch A** (chosen) proposed a schema migration and issued `queue.publish(migrate_v2)` plus `docstore.write(key=cfg, v=2)`. - **Branch B** (discarded by critic score) had already issued `docstore.write(key=cf...",
    "condition_of_validity": "The reasoning above holds only under these conditions, which define the boundary: 1. **At least one tool in any branch is non-idempotent or non-reversible** (publish, append, increment, delete-without-tombstone, external API call). If every tool is a pure read or a reversible write with a captured undo, the reconciler's logical view equals the environmental ...",
    "decision_boundary": "The decision boundary is **where the fork/merge barrier is placed relative to effect commitment**. Three regimes: - **Effect-quiesced merge (safe):** The orchestrator does not permit the reconciler to run until every branch has either (a) committed its effects and reported them as an append-only effect log with idempotency keys, or (b) been *drained* — its i...",
    "operational_effect": "Enforcing the invariant changes the system in four concrete ways: 1. **Fork points must snapshot mutable resources.** A speculative fork without a pre-fork snapshot of every resource any branch can mutate cannot support compensation and therefore cannot safely use optimistic merge. Snapshot cost is the price of concurrency. 2. **Tool calls need idempotency k..."
  },
  "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": "f975a169373e41fd312f5119ad41704c8d802e94dc46439903456f6da3bb4c07",
    "verified_classes": [
      "SpeculativeCommitLeak",
      "BranchState",
      "EffectLog",
      "Branch",
      "SpeculativeOrchestrator"
    ],
    "verified_functions": [
      "key",
      "__init__",
      "rollback_branch",
      "merge"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "SpeculativeCommitLeak"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
