{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-rollback-state-when-speculative-agent-branches-commit-side-effects-to-a-shared-external-substrate-before-divergence-i",
  "title": "How should an instance reconcile rollback state when speculative agent branches commit side effects to a shared external substrate before divergence is detected",
  "date_of_record": "2026 November 28",
  "scope": "Applies to orchestrators that fork a task into N speculative branches (parallel agent instances exploring alternative plans), each branch permitted to invoke tools with external side effects, where a single winning branch is selected and the losers are \"rolled back.\" Does not apply to read-only speculative execution, pure in-context tree search, or branches confined to a transactional sandbox with true ACID semantics.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-rollback-state-when-speculative-agent-branches-commit-side-effects-to-a-shared-external-substrate-before-divergence-i.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-rollback-state-when-speculative-agent-branches-commit-side-effects-to-a-shared-external-substrate-before-divergence-i.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-rollback-state-when-speculative-agent-branches-commit-side-effects-to-a-shared-external-substrate-before-divergence-i.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1848,
    "python_slice_tokens": 321,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure here is not \"a loser branch did something bad.\" It is that **rollback of a speculative branch is not the inverse of its execution**, because the substrate the branch touched is non-transactional and its effect is *observable to the winner*. Teams conflate two different guarantees: - **Execution rollback**: discarding the loser's context, KV cache...",
    "what_was_observed": "A planning task was forked into four branches at step 3, each branch running the same tool-using agent against a shared workspace (a scratch filesystem plus a mock ticketing API). Branch selection was deferred until all branches reached a terminal state, then a scorer picked the branch with the highest plan-validity score. Divergence was detected at step 5 of branch B — it had chosen to \"reset the staging config\" whi...",
    "condition_of_validity": "Rollback-on-divergence is only sound when **all three** hold: 1. **Divergence precedes effect.** The detector fires strictly before the loser's first non-compensable mutation. In practice this requires the branch to *declare intent* (a dry-run / plan object) and have the orchestrator gate the actual commit — i.e., speculative branches run against a *shadow s...",
    "decision_boundary": "The orchestrator must choose, per tool, between two regimes and must not blur them: - **Speculate-and-commit-late** (default for any tool with non-compensable effects): the branch produces a *proposed* call; the orchestrator applies it only after the branch is selected. Cost: branches cannot observe their own side effects, so any branch whose plan depends on...",
    "operational_effect": "Concretely, the guardrail is a **speculation ledger** with per-branch effect records and a barrier: - Each branch runs with a `branch_id` and a `speculation_epoch`. - Every tool call is intercepted; the interceptor consults the tool's invertibility class. Compensable tools commit and record an inverse closure. Non-compensable tools are *staged* into a propos..."
  },
  "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": "9e0da966c4d9deb2855d96d3d2d1b1864c2ef0d1ff1f5b3bc26ea4cfbe5be950",
    "verified_classes": [
      "SpeculationRollbackError",
      "InvertibilityClass",
      "Effect",
      "SpeculationLedger"
    ],
    "verified_functions": [
      "resolve_barrier",
      "record",
      "unresolved_for"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SpeculationRollbackError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
