{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-detect-and-bound-speculative-branch-contamination-when-a-rollback-checkpoint-restores-tool-side-effects-that-the-branch-predict",
  "title": "How should an instance detect and bound speculative-branch contamination when a rollback checkpoint restores tool-side effects that the branch prediction never owned",
  "date_of_record": "2026 November 25",
  "scope": "Applies to orchestrators that run speculative sub-plans in parallel against a shared tool substrate, checkpointing agent state and rolling back losers. Does not apply to purely read-only speculative fan-out (e.g., parallel sampling with no external writes) or to single-agent retry loops.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-and-bound-speculative-branch-contamination-when-a-rollback-checkpoint-restores-tool-side-effects-that-the-branch-predict.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-and-bound-speculative-branch-contamination-when-a-rollback-checkpoint-restores-tool-side-effects-that-the-branch-predict.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-and-bound-speculative-branch-contamination-when-a-rollback-checkpoint-restores-tool-side-effects-that-the-branch-predict.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1883,
    "python_slice_tokens": 372,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"rollback failed to restore state.\" Rollback of *agent-internal* state (working memory, plan DAG, token ledger) is typically exact. The failure is the asymmetry between two rollback domains: **episodic state** (recoverable by snapshot) and **tool-side effects** (recoverable only if the tool exposes compensation or the effect was namespaced...",
    "what_was_observed": "A planner agent speculatively forks three sub-plans at a decision node: branch A (assume inventory available), branch B (assume backorder), branch C (assume partial fulfillment). Each branch is a full agent instance with its own context window, checkpointed at fork. Branch A calls `reserve_inventory(sku, qty)` on a tool that is idempotent-per-caller but *not* transactional—it decrements stock immediately and returns ...",
    "condition_of_validity": "Rollback-based speculation is sound only under the **effect-isolation invariant**: for every tool call made by a speculative branch, either (a) the effect is namespaced to the branch and invisible to non-branch callers until commit, (b) the tool exposes a compensation primitive the orchestrator invokes on rollback, or (c) the call is provably idempotent and ...",
    "decision_boundary": "The boundary is **whether the speculative branch's tool surface intersects shared mutable state**. If it does not—pure reads, branch-scoped scratchpads, namespaced writes—speculation is free and rollback is total. If it does, the orchestrator must choose between three regimes: - **Barrier regime:** speculative branches may only *read*; all writes are deferre...",
    "operational_effect": "Downstream, the contamination manifests as *reasoning divergence with a valid-looking trace*. Branch B's context shows a clean `INSUFFICIENT_STOCK` response and a coherent backorder decision; no log line indicates that the stock was held by a discarded sibling. Auditors replaying branch B's trace reproduce the decision exactly, because replay reads the same ..."
  },
  "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": "4c6b71fa5881a164fbe7e354609a00f3ee56ed450a1b0077572bd927b79bf744",
    "verified_classes": [
      "EffectClass",
      "BranchContaminationError",
      "ToolSpec"
    ],
    "verified_functions": [
      "pre_fork_effect_audit",
      "rollback_branch"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "BranchContaminationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
