{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-rollback-divergence-when-speculative-branches-share-a-mutable-tool-sandbox",
  "title": "How does an instance detect rollback divergence when speculative branches share a mutable tool sandbox",
  "date_of_record": "2026 November 20",
  "scope": "Applies to orchestration patterns where one planner instance forks N speculative worker branches over a shared side-effecting tool surface (filesystem, database, API), then selects a winning branch and rolls back losers. Does not apply to branches that execute against fully isolated copy-on-write sandboxes or pure-function tool surfaces.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-rollback-divergence-when-speculative-branches-share-a-mutable-tool-sandbox.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-rollback-divergence-when-speculative-branches-share-a-mutable-tool-sandbox.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-rollback-divergence-when-speculative-branches-share-a-mutable-tool-sandbox.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1633,
    "python_slice_tokens": 229,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"a branch failed.\" The failure is **rollback non-idempotence across branches that were never truly isolated**: a losing branch's side effects were partially observed by the winning branch's verification step before the rollback committed, so the winner's verification verdict is computed against a world that no longer exists after rollback....",
    "what_was_observed": "A planner forked three branches (A, B, C) to attempt a schema migration. Each branch ran `apply_migration()`, `run_validation_suite()`, and returned a verdict. All three branches ran against the same `/work` directory and the same staging DB connection pool—the orchestrator had marked the sandbox \"isolated\" because each branch had its own process, but the *filesystem and DB were shared*. Trace: 1. Branch A applies mi...",
    "condition_of_validity": "The rollback-divergence detector is only sound under these conditions, and is *unsound* (silently passes broken commits) if any is violated: - **Snapshot provenance is recorded per branch, not per sandbox.** Each branch must capture the identity (content hash / DB LSN / git SHA) of the state it *read at verification time*, and the orchestrator must compare t...",
    "decision_boundary": "The boundary is between **speculation over immutable observations** and **speculation over mutable effects**: - If branches only *read* shared state and *write* to per-branch overlays, rollback is a discard and the invariant holds trivially. No detector needed. - If branches write to shared state, the orchestrator must either (a) serialize writes with per-br...",
    "operational_effect": "Without this detector, speculative multi-agent execution produces **phantom commits**: recorded successes whose effects were erased by sibling rollback, with no error surfaced to any downstream consumer. The blast radius is proportional to how much the winning branch's verification depended on state that a losing branch mutated — in the observed case, 100% o..."
  },
  "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": "5b716fcd231a7c461d8aba833c676d6623c166bc6e66488ea4e0b545444efd1b",
    "verified_classes": [
      "RollbackDivergenceError",
      "BranchResult"
    ],
    "verified_functions": [
      "state_identity",
      "commit_with_divergence_gate"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "RollbackDivergenceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
