{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-of-a-speculative-branch-executor-corrupt-the-canonical-state-when-its-rollback-boundary-is-drawn-at-the-tool-call-layer-instead-o",
  "title": "Why does an instance of a speculative branch executor corrupt the canonical state when its rollback boundary is drawn at the tool-call layer instead of the effect layer",
  "date_of_record": "2026 November 24",
  "scope": "Applies to multi-agent systems that speculatively fork a shared execution context into parallel branches (branch prediction over candidate plans) and merge or roll back on divergence. Does not apply to single-agent linear execution, nor to stateless request/response fan-out where branches share no mutable state.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-of-a-speculative-branch-executor-corrupt-the-canonical-state-when-its-rollback-boundary-is-drawn-at-the-tool-call-layer-instead-o.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-of-a-speculative-branch-executor-corrupt-the-canonical-state-when-its-rollback-boundary-is-drawn-at-the-tool-call-layer-instead-o.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-of-a-speculative-branch-executor-corrupt-the-canonical-state-when-its-rollback-boundary-is-drawn-at-the-tool-call-layer-instead-o.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2278,
    "python_slice_tokens": 432,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"speculation sometimes guesses wrong.\" Wrong guesses are the expected cost of speculation. The failure is that **rollback is scoped to the reasoning/tool-call log rather than to the effects those calls produced**. A branch executor typically records its speculative trace as an ordered list of `(thought, tool_call, tool_result)` tuples and ...",
    "what_was_observed": "A planner agent decomposed a task (\"reconcile inventory across two warehouses\") into three candidate plans and forked three speculative branches against a shared `inventory` tool namespace. Each branch had a private context window and a shared tool gateway. The gateway logged calls but did not isolate effects — all branches wrote to the same backing store. Branch B2 (the eventual loser) executed: 1. `reserve(sku=4471...",
    "condition_of_validity": "The \"discard trace = undo branch\" equivalence is valid **iff** every tool in the branch's reachable set satisfies one of: - **Idempotent and keyed:** replaying the call with the same idempotency key is a no-op (e.g., `PUT` with `If-Match`, or `reserve` keyed by `(branch_id, sku)`). - **Compensable:** a registered inverse exists and is guaranteed to run durin...",
    "decision_boundary": "The decision the executor must make at fork time: - **Shadow-store speculation:** branch writes go to a copy-on-write overlay; merge applies the winner's overlay atomically; losers' overlays are dropped. Cost: overlay must capture every effect, including calls to external services, which requires either a proxy or a transactional backing store. Valid when th...",
    "operational_effect": "When rollback is drawn at the wrong layer, the system exhibits a specific and dangerous signature: **silent divergence between canonical context and external state, with a clean rollback audit trail.** This is worse than a crash, because a crash halts and surfaces; this corrupts and hides. The audit log shows every branch rolled back successfully, so post-ho..."
  },
  "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": "d3ef0f719600067ab54964df69654f67521e6467be2c232ec521e93ab510dd1d",
    "verified_classes": [
      "RollbackDiscipline",
      "ToolSafety",
      "UnsafeSpeculationError",
      "PostRollbackDivergenceError",
      "ToolSpec",
      "Branch"
    ],
    "verified_functions": [
      "admit_branch",
      "rollback",
      "_invoke_compensation"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "PostRollbackDivergenceError",
      "UnsafeSpeculationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
