{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-rollback-divergence-from-silently-forking-agent-state-across-speculative-branches",
  "title": "Which invariants prevent rollback divergence from silently forking agent state across speculative branches",
  "date_of_record": "2026 November 25",
  "scope": "Applies to orchestration layers that speculatively fan out N agent branches over a shared logical state (context, tool side-effects, memory writes) and commit the first branch whose verifier passes, discarding the rest. Does not cover single-branch retry loops or pure stateless tool-call fan-out with no shared mutable state.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-rollback-divergence-from-silently-forking-agent-state-across-speculative-branches.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-rollback-divergence-from-silently-forking-agent-state-across-speculative-branches.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-rollback-divergence-from-silently-forking-agent-state-across-speculative-branches.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1989,
    "python_slice_tokens": 352,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two meanings of \"rollback\" that speculative multi-agent execution conflates, and the conflation is the failure. *Logical rollback* restores the agent's context, episodic memory, and pending-write set to a pre-branch snapshot. *Physical rollback* reverses externally observable side-effects: files written, records inserted, messages emitted, downstre...",
    "what_was_observed": "A planner agent (P) decomposed a task into three tool calls and spawned three speculative executor branches (B1, B2, B3) with identical initial context, each attempting a different tool-call ordering. The orchestrator's rollback contract was \"on verifier failure, replay the branch's recorded tool calls in reverse with an `undo` flag.\" The verifier for B1 passed first; B2 and B3 were rolled back. The failure trace: 1....",
    "condition_of_validity": "The rollback invariant holds if and only if all three of the following are simultaneously true: - **Isolation:** speculative branches cannot observe each other's uncommitted writes. Either each branch receives a copy-on-write view, or all writes are buffered in a per-branch WAL and never applied to shared state until commit. - **Atomic commit:** the epoch-fl...",
    "decision_boundary": "The orchestrator must choose between two regimes at branch-spawn time, not at rollback time: - **Speculate only over WAL-backed tools.** If every tool a branch may call buffers writes behind the branch epoch, speculation is safe and rollback is a WAL discard (O(1), no inverse replay). This is the default and should be enforced by a capability check at spawn:...",
    "operational_effect": "Downstream symptoms appear with a characteristic lag, which is why this failure is hard to attribute: - **Change-feed consumers** process phantom events from rolled-back branches; their state drifts from the committed timeline. The drift is unbounded if the consumer is itself an agent whose memory distills from the feed. - **Committed-branch re-reads** retur..."
  },
  "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": "94335ab24e1c935ae6f6691fb5fb349c39152577ee906447a78eb0d30afa46dc",
    "verified_classes": [
      "SilentForkError",
      "Branch"
    ],
    "verified_functions": [
      "_state_hash",
      "commit_with_replay_audit",
      "_apply_op"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SilentForkError",
      "ValueError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
