{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-branch-and-verify-rollback-from-resurrecting-committed-side-effects",
  "title": "Which invariants prevent speculative branch-and-verify rollback from resurrecting committed side effects",
  "date_of_record": "2026 November 24",
  "scope": "Applies to any orchestration where a planner agent forks N speculative branches that optimistically invoke side-effecting tools (file writes, HTTP POSTs, queue publishes, payment calls) and a verifier agent selects one branch to commit while rolling back the rest. Does not apply to pure-read tool graphs or to single-branch execution with no rollback semantics.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-and-verify-rollback-from-resurrecting-committed-side-effects.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-and-verify-rollback-from-resurrecting-committed-side-effects.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-branch-and-verify-rollback-from-resurrecting-committed-side-effects.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1671,
    "python_slice_tokens": 305,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode here is not \"a branch failed.\" It is that **rollback of a speculative branch is a state operation on the orchestrator, but the side effect already escaped into the world.** The distinction that matters is between *branch state* (the orchestrator's ledger of which branch is live) and *effect state* (what actually happened in external systems)...",
    "what_was_observed": "A three-branch speculative planner was asked to provision a staging environment. Branch A and Branch B both called `provision_db(name=\"staging-2\")` optimistically; Branch C called `provision_db(name=\"staging-2\")` with a different region parameter. The tool was idempotent on `name` but *not* on `(name, region)` — the second call with a different region created a second database and returned a distinct handle. The veri...",
    "condition_of_validity": "Optimistic invocation is only safe under a conjunction that is rarely checked: 1. Every side-effecting tool accepts a caller-supplied idempotency key, and the orchestrator derives that key from `(tool_name, canonical_args, branch_warrant_id)` — *not* from `(tool_name, canonical_args)` alone. Branch identity must be part of the key, or two branches collapse i...",
    "decision_boundary": "The boundary between \"speculate optimistically\" and \"serialize behind a lock\" is drawn by the tool's effect algebra, not by latency budget: - **Speculate freely** when the tool is pure, or when it accepts a branch-scoped idempotency key and the orchestrator retains receipts. - **Speculate with a compensation obligation** when the tool is side-effecting but h...",
    "operational_effect": "With the invariant enforced, three things change. First, `discard` becomes a checked operation that can fail loudly (uncompensated receipt → raise, halt the plan) instead of silently orphaning resources. Second, the verifier's commit gains a cross-branch collision check, so it cannot commit a branch whose effects alias a sibling's. Third, replay becomes trus..."
  },
  "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": "36aa630072152c98a10a0fa5e529321f2da7f2a0ee596fadeb5596420e70923f",
    "verified_classes": [
      "UncompensableDiscardError",
      "EffectReceipt",
      "Branch"
    ],
    "verified_functions": [
      "discard_branch",
      "commit_branch"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UncompensableDiscardError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
