{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-branch-contamination-during-multi-agent-rollback",
  "title": "Which invariants prevent speculative branch contamination during multi-agent rollback",
  "date_of_record": "2026 November 24",
  "scope": "Applies to orchestrators that fan out speculative sub-agents against a shared, mutable effect surface (file system, database, external API, or message bus) and roll back losing branches when outcomes diverge. Does not apply to pure read-only fan-out, nor to single-agent retry loops where no concurrent branch shares an effect surface.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-contamination-during-multi-agent-rollback.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-contamination-during-multi-agent-rollback.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-contamination-during-multi-agent-rollback.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1602,
    "python_slice_tokens": 284,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"rollback didn't happen.\" The failure is that rollback is *logically correct within the orchestrator's state model but physically incomplete on the effect surface*, and a surviving branch's subsequent reads observe the residue of a branch that was supposed to have never existed. Speculative execution assumes an **isolation invariant**: the...",
    "what_was_observed": "A planner spawned three speculative sub-agents to fix a failing migration: `A` (schema rewrite), `B` (data backfill), `C` (index rebuild). Each ran in a nominal sandbox. `A` and `B` diverged on the target column type; the orchestrator's consensus check selected `A` and issued `rollback(B)`. Observed trace: 1. `B` had executed `UPDATE migrations SET col_type='bigint' WHERE id=42` through a DB tool whose calls were *no...",
    "condition_of_validity": "The isolation invariant `state_after_rollback(B) == state_before_spawn(B)` holds **only if all four of the following are simultaneously true**: - **Effect closure.** Every sub-agent write path is enrolled in the rollback ledger or the COW overlay. Any unmediated tool (shell, raw HTTP, cache, vector upsert) breaks closure silently. - **Transcript quarantine.*...",
    "decision_boundary": "The orchestrator must choose between two regimes and never blend them: - **Sealed speculation:** sub-agents run against a COW overlay / journaled effect surface with transcript quarantine. Rollback is cheap and the isolation invariant is enforceable. Cost: overlay merge complexity and higher write latency. - **Open speculation:** sub-agents write directly to...",
    "operational_effect": "Unenforced, this produces **resurrection contamination**: rolled-back state re-enters the surviving branch through (a) un-rolled-back effect residue read by a tool, or (b) transcript leakage into retrieval. The signature is a run that replays cleanly, passes audit, and fails only against an environment that never saw the speculation. The blast radius is asym..."
  },
  "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": "878a8d30b1683ecdce64fc178e18faa832f99bd1b208dfcfc2f0c7bae1d4bf03",
    "verified_classes": [
      "BranchStatus",
      "RollbackContaminationError",
      "Branch"
    ],
    "verified_functions": [
      "assert_rollback_safe",
      "rollback"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "RollbackContaminationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
