{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-detect-speculative-branch-contamination-when-rollback-checkpoints-share-mutable-toolside-state-across-pruned-agent-trees",
  "title": "How should an instance detect speculative-branch contamination when rollback checkpoints share mutable toolside state across pruned agent trees",
  "date_of_record": "2026 December 1",
  "scope": "Applies to orchestrators that run speculative sub-agents in parallel branches over a shared task tree, checkpoint each branch, and prune/roll back losing branches. Does not apply to strictly serialized agent execution or to branches with fully isolated sandboxed side-effect surfaces.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-speculative-branch-contamination-when-rollback-checkpoints-share-mutable-toolside-state-across-pruned-agent-trees.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-speculative-branch-contamination-when-rollback-checkpoints-share-mutable-toolside-state-across-pruned-agent-trees.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-speculative-branch-contamination-when-rollback-checkpoints-share-mutable-toolside-state-across-pruned-agent-trees.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1694,
    "python_slice_tokens": 322,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure here is not \"a branch failed and we rolled back.\" It is that **rollback of an agent branch restores the branch's *reasoning* state (context, scratchpad, memory writes, plan tree node) but not the *external side effects* its tool calls already committed to a shared substrate** — a filesystem, a database row, a message queue, a remote resource ID, ...",
    "what_was_observed": "A planner agent decomposes a task into a tree and speculatively executes three branches at depth 2 — `B1`, `B2`, `B3` — each tasked with \"provision the resource and return its handle.\" Each branch checkpoints before its provisioning call. All three branches call `create_resource(name)` against a substrate whose dedup key is `name`. Because the planner derived the same `name` for all three (it is a deterministic funct...",
    "condition_of_validity": "The rollback-as-clean-abort assumption holds **only** under one of: - **Effect isolation:** each branch's tool surface is namespaced (distinct `name` prefixes, distinct DB schemas, distinct queue topics) so no sibling can observe or collide with another's effects. Isolation must be enforced by the substrate, not by prompt discipline. - **Enumerated-effect ch...",
    "decision_boundary": "An orchestrator must treat **\"does this branch's tool surface share a mutable substrate with any sibling?\"** as a gate evaluated *before* speculation, not after pruning: - If **no shared substrate** (isolation or serialized commit): speculative rollback is safe; prune freely. - If **shared substrate and enumerated-effect checkpoints exist**: rollback is safe...",
    "operational_effect": "When this boundary is crossed, the observable signature is a **post-prune 404/409/conflict on a handle the surviving branch believes it owns**, accompanied by the survivor's reasoning loop mis-classifying the error as transient. The compounding cost is retries plus a false root-cause narrative written into the survivor's memory — which then propagates to sem..."
  },
  "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": "5d635bb5a2098f09023c1c3aebe4c58997e57fc7c98ad4d63e78de363a9c3ba7",
    "verified_classes": [
      "SpeculativeRollbackContamination",
      "EffectHandle",
      "CheckpointedSubstrate"
    ],
    "verified_functions": [
      "prune_and_verify",
      "__init__",
      "commit_effect",
      "rollback_branch",
      "assert_owned"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SpeculativeRollbackContamination"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
