{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-orphaned-side-effects-when-speculative-agent-branches-roll-back-after-a-shared-resource-commit",
  "title": "Which invariants prevent orphaned side effects when speculative agent branches roll back after a shared-resource commit",
  "date_of_record": "2026 November 22",
  "scope": "Applies to multi-agent systems where a planner spawns speculative branches (parallel sub-agents exploring alternative tool-call trajectories) that may be rolled back after one branch has already committed an irreversible external effect (file write, API mutation, message send, DB insert). Does not apply to pure read-only speculation or to systems where every external effect is mediated by a transactional coordinator that supports true two-phase commit with participant rollback.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-orphaned-side-effects-when-speculative-agent-branches-roll-back-after-a-shared-resource-commit.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-orphaned-side-effects-when-speculative-agent-branches-roll-back-after-a-shared-resource-commit.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-orphaned-side-effects-when-speculative-agent-branches-roll-back-after-a-shared-resource-commit.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1981,
    "python_slice_tokens": 294,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The naive model of speculative execution treats rollback as the inverse of forward execution: if branch B executed steps S1…Sn, rolling back means undoing Sn…S1. This holds for pure functions and for effects behind a transactional boundary. It fails for **irreversible external effects** — an HTTP POST that sent an email, a `git push`, a row inserted into a t...",
    "what_was_observed": "A three-branch speculative planner (branches A, B, C) was tasked with \"update the deployment manifest and notify the team.\" Each branch ran independently with a full toolset. Branch A chose to edit `deploy.yaml` then POST to a webhook. Branch B chose to POST the webhook first (to \"announce intent\") then edit. Branch C chose to edit and then run a validation script that itself wrote a `.lock` file. The orchestrator's ...",
    "condition_of_validity": "The \"rollback restores prior state\" invariant is valid only when, for every step in every branch, one of the following holds: - **Idempotent-and-owned:** the effect is keyed by a branch-scoped idempotency token, so a duplicate from a sibling is deduplicated at the environment, and the orchestrator can enumerate its own effects by token. - **Compensable-with-...",
    "decision_boundary": "The boundary between safe speculation and orphaned effects is crossed at the first irreversible effect executed **before** the global nomination decision. Practically, the orchestrator must classify each tool at dispatch time: - `PURE` — no external state change (read, compute, local scratchpad). Always speculable. - `COMPENSABLE` — external change with a re...",
    "operational_effect": "With the commit-token gate and environment-verified rollback, the failure mode is bounded: speculative branches can still *plan* irreversible actions (they park them), so reasoning quality is preserved, but no irreversible effect can escape before nomination. The cost is latency on the commit path (nomination must serialize) and the requirement that every ir..."
  },
  "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": "5ac2d0de13996ee7066b14292d26b8dbc41cf1b7aeabf238d1ac688c8c4f64a9",
    "verified_classes": [
      "OrphanedEffectError",
      "EffectClass",
      "CommitTokenGate"
    ],
    "verified_functions": [
      "rollback_branch",
      "__init__",
      "nominate",
      "authorize"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "OrphanedEffectError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
