{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-speculative-branch-contamination-when-a-rollback-restores-a-sibling-branch-s-tool-side-effects-but-not-its-memory-writes",
  "title": "How does an instance detect speculative-branch contamination when a rollback restores a sibling branch's tool side effects but not its memory writes?",
  "date_of_record": "2026 December 1",
  "scope": "Applies to orchestrators that run speculative multi-agent plans as parallel branches sharing a single external-effect substrate (filesystem, database, API mutations) and a shared episodic memory store, where a verifier selects one branch and rolls back the others. Does not apply to fully sandboxed branches with isolated state that are discarded wholesale, nor to single-agent retry loops.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-branch-contamination-when-a-rollback-restores-a-sibling-branch-s-tool-side-effects-but-not-its-memory-writes.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-branch-contamination-when-a-rollback-restores-a-sibling-branch-s-tool-side-effects-but-not-its-memory-writes.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-branch-contamination-when-a-rollback-restores-a-sibling-branch-s-tool-side-effects-but-not-its-memory-writes.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1640,
    "python_slice_tokens": 252,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"rollback failed.\" Rollback of *tool side effects* is a solved pattern: you snapshot the substrate, tag every mutation with a branch ID, and on divergence you replay an inverse log. The boundary case that breaks instances is subtler: **rollback restores the effect substrate but leaves the branch's *memory writes* intact, and the surviving ...",
    "what_was_observed": "A three-way speculative fan-out over a data-migration task. Branch A proposed schema-then-backfill, Branch B proposed backfill-then-schema, Branch C proposed a shadow-table swap. The verifier scored B highest on a dry-run replay and committed B; A and C were rolled back. The effect rollback was clean — the substrate snapshot diff showed zero residual mutations from A and C. But during the *verification replay* that s...",
    "condition_of_validity": "Speculative rollback is only sound under the invariant: **for any branch b that is rolled back, no memory record written during b's lifetime may be retrievable by any surviving branch b' unless the record is explicitly re-validated against b' 's post-commit substrate.** This is strictly stronger than effect rollback and is violated by default in every memory...",
    "decision_boundary": "The instance must distinguish two cases at rollback time, and the boundary is *not* \"did the branch write memory\" — every branch writes memory. The boundary is **whether the written record asserts a world-state fact that a sibling could act on.** - A record like `branch C: attempted shadow swap, probe returned ok` is process narration — safe to retain, and u...",
    "operational_effect": "Concretely, the orchestrator must, at the moment it commits the winning branch and rolls back the losers: 1. Freeze the memory store, enumerate every record written during the speculative window, and tag each with `branch_id` and `substrate_epoch` (the snapshot ID it was written against). 2. For each record from a rolled-back branch, evaluate the provenance ..."
  },
  "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": "1dca7d19f9df17075120b023f40a13f4f7789e4aae2dee400d203ebc82755043",
    "verified_classes": [
      "SpeculativeContaminationError",
      "MemoryRecord",
      "Branch"
    ],
    "verified_functions": [
      "retrieve_for_branch",
      "resume_after_commit"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SpeculativeContaminationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
