{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-speculative-agent-rollback-from-corrupting-externally-committed-side-effects",
  "title": "Which invariants prevent speculative agent rollback from corrupting externally-committed side effects",
  "date_of_record": "2026 November 27",
  "scope": "Applies to pipelines where a planner agent speculatively forks downstream agents along predicted branches and rolls back losing branches. Does not apply to purely read-only agent graphs, or to pipelines where every tool call is idempotent and side-effect-free by construction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-agent-rollback-from-corrupting-externally-committed-side-effects.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-agent-rollback-from-corrupting-externally-committed-side-effects.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-speculative-agent-rollback-from-corrupting-externally-committed-side-effects.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1491,
    "python_slice_tokens": 175,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Speculative execution across an agent pipeline differs from CPU speculative execution in one fatal way: the \"register file\" being speculated over is not internal. A downstream agent's tool call—`send_email`, `charge_card`, `git_push`, `POST /refund`—commits to the outside world the instant it returns, long before the planner decides whether that branch was t...",
    "what_was_observed": "A three-stage pipeline: `planner → [speculative] researcher / writer → committer`. The planner forks two writer branches, `W_alpha` and `W_beta`, predicted from a partial outline. `W_alpha` wins the planner's confidence vote; `W_beta` is rolled back. During `W_beta`'s execution, before the vote, its agent called `create_draft_branch(repo, name=\"beta-<hash>\")` and `post_review_comment(pr, body=...)`. Both returned 200...",
    "condition_of_validity": "The invariant that must hold for speculative agent rollback to be safe is a **commit barrier on external effects**, stated precisely: > A branch may not perform an external, non-idempotent effect until it has been promoted from `SPECULATIVE` to `COMMITTED`. Any effect issued while `SPECULATIVE` must be either (a) buffered in a branch-scoped outbox that is di...",
    "decision_boundary": "The boundary is drawn at the tool-call boundary, not the agent boundary. For each tool in the pipeline's registry, classify: - **Buffered-safe:** effect can be queued in a branch outbox and flushed only on promotion (e.g., `create_draft_branch`, `post_review_comment`, `enqueue_job`). - **Namespace-safe:** effect is scoped to a branch ID that rollback garbage...",
    "operational_effect": "With the commit barrier in place, the observable behavior changes in three ways. First, losing branches leave zero external residue: their outboxes are discarded, their namespaces collected, and the external ledger matches the internal ledger exactly. Second, re-planning is safe because the resume pointer only ever points at committed state, so replay re-iss..."
  },
  "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": "ec5c8e3bde7d097ce2b6bd0487f92bd85b442497e8ba9e610935ef600e699830",
    "verified_classes": [
      "SpeculativeCommitViolation"
    ],
    "verified_functions": [
      "assert_speculation_safe",
      "promote_branch"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpeculativeCommitViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
