{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-agent-branches-from-leaking-uncommitted-side-effects-across-a-rollback-barrier",
  "title": "Which invariants prevent speculative agent branches from leaking uncommitted side effects across a rollback barrier",
  "date_of_record": "2026 November 24",
  "scope": "Applies to orchestrators that speculatively fork a plan into parallel agent branches (e.g., multiple tool-calling trajectories, competing drafters, or hedged retrieval paths) and commit exactly one branch while discarding the rest. Does not apply to read-only fan-out (map/reduce over pure queries) where branches have no externally observable effects.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-agent-branches-from-leaking-uncommitted-side-effects-across-a-rollback-barrier.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-agent-branches-from-leaking-uncommitted-side-effects-across-a-rollback-barrier.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-agent-branches-from-leaking-uncommitted-side-effects-across-a-rollback-barrier.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1946,
    "python_slice_tokens": 280,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between *rollback of reasoning state* and *rollback of world state*. A speculative branch is cheap to discard at the token/context layer: you drop its message history, its scratchpad, its KV cache. But an agent branch is almost never pure reasoning — it calls tools. Those tool calls mutate the world: they write files, send ema...",
    "what_was_observed": "A planner forked a three-way speculative search over a remediation task. Branch A would attempt an in-place config patch; Branch B would stage the patch to a temp path and validate; Branch C would query a dependency graph. All three were launched concurrently with a shared tool credential and a 90-second branch budget. Branch B's validator wrote a `*.staged` artifact and registered a cleanup hook. Branch A failed a s...",
    "condition_of_validity": "Speculative rollback is only sound when all of the following hold. These are the invariants; the failure above is their conjunction's negation. 1. **Effect fencing.** Every branch runs under a distinct, revocable effect scope (a transaction, a scoped credential, a sandboxed mount, a namespaced queue). Discarding a branch must *revoke* the scope, not merely d...",
    "decision_boundary": "The boundary is between *hedged reads* and *speculative writes*. Hedge freely when branches are pure: fork three retrieval strategies, keep the best, discard the rest — the cost of a wrong discard is zero because nothing was written. The moment a branch crosses into mutation, the orchestrator must either (a) demote the branch to a two-phase protocol where th...",
    "operational_effect": "Enforcing the invariants changes three things operationally. First, branch launch cost rises: each speculative branch needs its own effect scope, which means per-branch credentials, per-branch transaction handles, or per-branch sandbox namespaces. This is the price of safe speculation and it is non-negotiable; an orchestrator that shares a credential across ..."
  },
  "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": "3968fe8c20eb5fd7236ba21ed8fdd837ec072fed69bfb8e943843b2ec0a821bb",
    "verified_classes": [
      "SpeculativeEffectLeak",
      "BranchScope"
    ],
    "verified_functions": [
      "discard_branch",
      "commit_winner",
      "__init__"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "SpeculativeEffectLeak"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
