{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-parallel-agent-plans-from-corrupting-shared-state-when-a-divergent-branch-rolls-back",
  "title": "Which invariants prevent speculative parallel agent plans from corrupting shared state when a divergent branch rolls back",
  "date_of_record": "2026 November 26",
  "scope": "Applies to orchestrators that fork a single agent plan into N speculative parallel branches against a shared tool/state substrate and commit the first branch whose outcome matches a success predicate, aborting the rest. Does not apply to branches operating on isolated sandboxes with no shared mutable resources (filesystem, database, message bus, external API side effects).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-parallel-agent-plans-from-corrupting-shared-state-when-a-divergent-branch-rolls-back.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-parallel-agent-plans-from-corrupting-shared-state-when-a-divergent-branch-rolls-back.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-parallel-agent-plans-from-corrupting-shared-state-when-a-divergent-branch-rolls-back.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1733,
    "python_slice_tokens": 288,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"a branch failed.\" It is **rollback that is not idempotent against a substrate that already absorbed the branch's side effects before divergence was detected**. Speculative execution of agent plans is safe only when every branch's side effects are *revocable* or *isolated*; the invariant that matters is not \"we can roll back,\" but \"we...",
    "what_was_observed": "An orchestrator forks a 4-way speculative plan for a customer-refund agent: each branch independently decides whether to issue a refund and via which path (`stripe.refund`, `ledger.credit`, `manual_queue`, `escalate`). The commit predicate accepts the first branch that returns `status == \"refunded\"` with a matching amount. Branches run concurrently against a shared ledger service. Trace: 1. Branch B2 calls `ledger.cr...",
    "condition_of_validity": "Rollback-on-divergence is sound only if all three hold simultaneously: - **C1 — Effect revocability or isolation.** Every tool a branch may call is either (a) isolated to a branch-scoped overlay (copy-on-write ledger, staged transaction, outbox), or (b) has an idempotent compensating action keyed by a branch-unique token, so a late-arriving compensation cann...",
    "decision_boundary": "The orchestrator must choose, per plan, between **speculate-and-compensate** and **speculate-and-isolate**, and the choice is forced by the tool inventory, not by latency budget: - If **every** tool in the branch's reachable call graph is overlay-capable (staged writes, branch-scoped sandboxes, outbox-pattern emits), use isolation. Commit = promote overlay; ...",
    "operational_effect": "Enforcing the invariant converts a class of silent shared-state corruption into an up-front planning rejection. The orchestrator's fork step fails closed: a plan whose capability closure includes non-revocable tools is not forked speculatively; it is run single-path with the commit decision made before the irreversible call. Latency regresses on those plans ..."
  },
  "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": "81fc54f71d42bfca7fe9ac506ee901c4c66dbcbf2b60e8f83615d816413e08b9",
    "verified_classes": [
      "SpeculationBoundaryError",
      "EffectClass",
      "ToolCapability",
      "Plan"
    ],
    "verified_functions": [
      "assert_speculatable",
      "fork_speculative"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpeculationBoundaryError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
