{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-orphaned-side-effect-commits-in-speculative-branch-and-rollback-agent-trees",
  "title": "Which invariants prevent orphaned side-effect commits in speculative branch-and-rollback agent trees",
  "date_of_record": "2026 November 30",
  "scope": "Applies to multi-agent orchestrators that speculatively fork sibling sub-agents over a shared task tree and rely on optimistic concurrency (version-tagged writes plus compensating rollback) rather than distributed locking. Does not apply to strictly serialized DAG executors or single-agent retry loops where no concurrent sibling can observe a partially committed branch.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-orphaned-side-effect-commits-in-speculative-branch-and-rollback-agent-trees.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-orphaned-side-effect-commits-in-speculative-branch-and-rollback-agent-trees.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-orphaned-side-effect-commits-in-speculative-branch-and-rollback-agent-trees.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1728,
    "python_slice_tokens": 338,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"a rollback failed.\" It is that a **rollback succeeded for the branch that owns the write, while a sibling branch that observed the write treats it as committed truth and re-emits it after the owning branch is reverted.** Speculative execution assumes a write is owned by exactly one branch and that rollback of that branch removes the write...",
    "what_was_observed": "A planner agent forks three speculative branches from a shared checkpoint at version `v=41` over a task tree with a single shared `workspace` object (a dict of task nodes with `version` tags). Branch A (the \"optimistic\" branch) writes `workspace[\"schema\"] = new_schema` at `v=42` and emits a downstream tool call `migrate_db()` whose side effect is external and non-idempotent. Branch B, executing concurrently, reads `w...",
    "condition_of_validity": "The naive invariant — \"a branch may commit iff its write version is strictly greater than the current workspace version\" — is valid only under the condition that **no committed branch transitively depends on a compensated write.** That condition fails whenever: 1. Sibling branches share a read-committed store (read visibility across live branches), and 2. A ...",
    "decision_boundary": "The orchestrator must choose, at rollback time, between two policies, and the choice is not free: - **Eager rollback** (compensate immediately, invalidate dependents): correct for external non-idempotent side effects, because leaving them live risks compounding. Cost: dependent branches are discarded and must re-execute, which can cascade into re-forking the...",
    "operational_effect": "After the fix, every branch commit carries a `read_set` of `(key, version)` pairs and a `side_effect_deps` set of journal entries. The commit gate is a closure check over the workspace lineage: any `(key, version)` in the read set whose version is tombstoned, or any journal entry that is compensated, blocks the commit and forces re-derivation from the latest..."
  },
  "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": "0c587acf46455dc36aba98effe4267abc86bb14817d7b9631110035f53aa788d",
    "verified_classes": [
      "OrphanedDependencyCommit",
      "WriteRecord",
      "Branch",
      "SpeculativeWorkspace"
    ],
    "verified_functions": [
      "__init__",
      "write",
      "read",
      "rollback",
      "commit"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "KeyError",
      "OrphanedDependencyCommit"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
