{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-speculatively-forks-agent-branches-whose-tool-side-effects-are-not-provably-reversible",
  "title": "What happens when an instance speculatively forks agent branches whose tool side effects are not provably reversible",
  "date_of_record": "2026 December 1",
  "scope": "Applies to orchestrators that run two or more agent branches concurrently against a shared external tool surface (filesystem writes, HTTP POSTs, message sends, DB mutations) and attempt to discard losing branches by \"rolling back.\" Does not apply to branches whose tools are read-only or genuinely transactional with compensating actions verified by the tool itself.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-speculatively-forks-agent-branches-whose-tool-side-effects-are-not-provably-reversible.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-speculatively-forks-agent-branches-whose-tool-side-effects-are-not-provably-reversible.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-speculatively-forks-agent-branches-whose-tool-side-effects-are-not-provably-reversible.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1586,
    "python_slice_tokens": 271,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There is a difference between **speculative reasoning** and **speculative execution with side effects**. Speculative reasoning (forking N candidate plans, scoring them, keeping one) is safe because the discarded branches leave no trace outside the context window. Speculative *execution* forks branches that call tools, and tool calls mutate the world. The bou...",
    "what_was_observed": "Setup: an orchestrator forks three branches at step 4 of a task (branch A: write config via `fs.write`, branch B: send notification via `http.post`, branch C: update ledger via `db.update`). Each branch checkpoints agent state before its first tool call. A scorer selects branch A. Branches B and C are \"rolled back\" by restoring their pre-fork state snapshots and marking them aborted. Failure trace: 1. Branch B's `htt...",
    "condition_of_validity": "Speculative execution with rollback is sound only when, for every tool in the branch's reachable tool set, at least one of the following holds and is *verified at fork time*: - The tool is declared read-only (no external mutation). - The tool is transactional and the branch holds an open transaction that the orchestrator can abort, with abort confirmed by th...",
    "decision_boundary": "The boundary is between *forking to explore* and *forking to commit*. Fork freely when the branch's tool surface is read-only or transactionally abortable. Do not fork when the branch's first mutating tool call precedes branch selection and that tool lacks verified undo. Concretely: - If `tool.reversible == False` and `tool.idempotent_key_supported == False`...",
    "operational_effect": "Without this boundary, speculative execution produces three classes of silent corruption: (1) ghost side effects — notifications, payments, messages sent by branches the orchestrator believes never ran; (2) phantom reads — surviving branches reasoning over writes from discarded branches, causing plan divergence with no attributable cause; (3) replica-masked ..."
  },
  "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": "56e2b44cc7f61d2581bff1bd5057ea27e7e9d03db627d5920a8361a225052003",
    "verified_classes": [
      "RollbackUnsoundError",
      "ToolReversibility",
      "ToolManifest",
      "Branch"
    ],
    "verified_functions": [
      "precheck_branch_reversibility",
      "confirm_rollback",
      "detect_contamination"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "RollbackUnsoundError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
