{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-speculative-branch-rollback-as-a-two-phase-commit-across-shared-memory-not-a-local-undo",
  "title": "In what scenarios must an instance treat speculative branch rollback as a two-phase commit across shared memory, not a local undo",
  "date_of_record": "2026 November 21",
  "scope": "Applies to orchestrators that fan out a plan into parallel speculative branches (N candidate tool-call sequences, N agent personas, or N reasoning traces) where branches may write to a shared episodic store, scratchpad, or external side-effect ledger. Does not apply to fully isolated sandboxes with copy-on-write memory and no external side effects.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-speculative-branch-rollback-as-a-two-phase-commit-across-shared-memory-not-a-local-undo.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-speculative-branch-rollback-as-a-two-phase-commit-across-shared-memory-not-a-local-undo.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-speculative-branch-rollback-as-a-two-phase-commit-across-shared-memory-not-a-local-undo.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1992,
    "python_slice_tokens": 390,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The non-obvious boundary is between **speculative state** and **committed state** when more than one branch can mutate the same logical memory key. A single-agent speculative loop (generate branch, evaluate, discard) has a trivial rollback: throw away the branch's local buffer. A *multi-agent* speculative execution has a rollback that is not local, because b...",
    "what_was_observed": "An orchestrator spawned four speculative branches of a \"resolve customer refund\" plan. Each branch ran an independent agent with read/write access to a shared `facts` store keyed by entity. Branch 1 (the \"aggressive\" persona) speculatively wrote `order_8841.status = \"cancelled\"` and `order_8841.refund_eligible = true`. Branch 3, running concurrently, read `refund_eligible = true` and wrote `refund_8841.decision = \"ap...",
    "condition_of_validity": "Two-phase commit across shared memory is required—and local undo is insufficient—exactly when all three of the following hold: 1. **Cross-branch read dependency exists:** at least one branch reads a key written by another branch during the speculation window. If branches are read-isolated (each sees only its own writes plus a frozen pre-speculation snapshot)...",
    "decision_boundary": "The decision boundary is whether the arbiter's rollback is **state-reverting** or **effect-compensating**. Draw it at the moment a write crosses from internal store to external consumer: - **Internal store, no external consumer yet:** rollback = delete + provenance invalidation in reverse topological order. Safe. - **External consumer has observed the write:...",
    "operational_effect": "With the two-phase protocol enforced, three operational consequences follow: 1. **Rollback latency becomes proportional to the provenance graph depth, not branch count.** Deep derivation chains (branch A → B → C) must be invalidated leaf-first; a naive parallel delete can invalidate B before C reads B, producing a transient inconsistent read. The orchestrato..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "8eaec0ace41c42c0a8d889d8299a72496eabdab759fbb8a81b412364c0e66524",
    "verified_classes": [
      "SpeculationState",
      "UncompensatedRollbackError",
      "Write",
      "SpeculationLedger"
    ],
    "verified_functions": [
      "__init__",
      "record",
      "mark_externalized",
      "_topo_order",
      "rollback",
      "visit"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "UncompensatedRollbackError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
