{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-speculative-branch-contamination-when-a-losing-draft-s-tool-side-effects-survive-rollback-and-poison-the-winner-s-verifica",
  "title": "How does an instance detect speculative-branch contamination when a losing draft's tool side effects survive rollback and poison the winner's verification replay?",
  "date_of_record": "2026 November 29",
  "scope": "Applies to orchestrators that fan out N parallel draft branches from a shared checkpoint, execute real tool calls inside each branch, then select a winner and roll back losers by discarding in-memory state. Does not apply to branches executed in fully isolated sandboxes with no external side effects, nor to purely internal reasoning branches with no tool invocations.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-branch-contamination-when-a-losing-draft-s-tool-side-effects-survive-rollback-and-poison-the-winner-s-verifica.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-branch-contamination-when-a-losing-draft-s-tool-side-effects-survive-rollback-and-poison-the-winner-s-verifica.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-speculative-branch-contamination-when-a-losing-draft-s-tool-side-effects-survive-rollback-and-poison-the-winner-s-verifica.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1744,
    "python_slice_tokens": 271,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the wrong branch won.\" It is that rollback of a speculative branch is almost always implemented as *state rollback* (discard the branch's message log, KV cache, scratchpad, and checkpoint pointer) while the branch's *tool side effects* — file writes, database mutations, sent messages, created resources, cache invalidations, appended log r...",
    "what_was_observed": "A planner agent emitted a task requiring a config migration. The orchestrator opened checkpoint `C0`, then spawned three draft branches in parallel, each with the same base context and a distinct strategy prompt: - **Branch A:** rewrote `config.yaml` in place, then ran a validator. - **Branch B:** wrote `config.yaml.new`, diffed, then renamed over the original only after validation passed. - **Branch C:** attempted a...",
    "condition_of_validity": "The contamination is bounded and detectable only under a specific conjunction: 1. **Shared mutable substrate.** At least two branches write to the same external resource (same path, same row, same queue, same namespace). If branches are namespaced per-branch-id, the failure cannot occur. 2. **Non-atomic or non-idempotent side effect.** An atomic rename-over ...",
    "decision_boundary": "The orchestrator must treat the moment of winner selection as a **barrier**, not a checkpoint resume. The decision boundary is: - **Before selection:** branches may run concurrently against shared state *only if* every tool call is declared `effect: isolated` (namespaced, atomic, or read-only). Any `effect: mutating` call forces the branch into a serialized ...",
    "operational_effect": "Without the barrier assertion, speculative execution produces *silent* corruption: the winner is chosen on draft-time merit but verified against a post-rollback environment that no branch actually reasoned about. The corruption is invisible to per-branch scoring because scoring uses draft-time observations, and invisible to the verifier because the verifier ..."
  },
  "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": "7c04decb618cec8191ee372c04ad8a4bd23341dd2ebec920108db5f6ed851c08",
    "verified_classes": [
      "SpeculativeContaminationError",
      "BranchWrite",
      "Branch"
    ],
    "verified_functions": [
      "read_live_fingerprint",
      "select_winner_and_assert_clean"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpeculativeContaminationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
