{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-speculative-branch-divergence-has-already-polluted-shared-tool-state-a-rollback-invariant-analysis",
  "title": "What structural signals indicate speculative branch divergence has already polluted shared tool state: a rollback-invariant analysis",
  "date_of_record": "2026 November 27",
  "scope": "Applies to orchestration patterns where an agent forks N speculative branches that each execute real side-effecting tool calls (writes, POSTs, resource allocation) under a presumed-rollbackable transaction, then reconciles to one winner. Does not apply to read-only speculation, shadow/dry-run execution against cloned sandboxes, or single-branch retry loops.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-speculative-branch-divergence-has-already-polluted-shared-tool-state-a-rollback-invariant-analysis.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-speculative-branch-divergence-has-already-polluted-shared-tool-state-a-rollback-invariant-analysis.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-speculative-branch-divergence-has-already-polluted-shared-tool-state-a-rollback-invariant-analysis.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1663,
    "python_slice_tokens": 324,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"a branch diverged.\" Divergence is expected and is the entire point of speculation. The failure is that **divergence was detected at the reconciliation boundary but the rollback had already been invalidated by a non-idempotent effect that occurred *before* the divergence was observable**. Speculative execution is safe only under a specific...",
    "what_was_observed": "A three-branch planner was asked to provision a staging environment. Branches B1, B2, B3 each ran a `provision_cluster` tool call speculatively, then compared resulting plans; B2 won on a cost heuristic. The reconciler rolled back B1 and B3. Post-run audit found four clusters live, not one. The trace showed: 1. B3's `provision_cluster` call returned at t=8.2s with cluster ID `c-3`. 2. The orchestrator's rollback-jour...",
    "condition_of_validity": "The rollback invariant holds if and only if, for every effect a branch produces: - **Effect-before-journal ordering is impossible.** The journal entry must be durable *before* the tool call is dispatched (a write-ahead pattern), carrying an intent record with a client-generated idempotency key. The tool call then references that key. Rollback reconciles by k...",
    "decision_boundary": "The boundary between \"safe to speculate\" and \"must serialize\" is drawn per tool, not per agent: - **Idempotent, keyed, reversible-from-intent tools** (object stores with versioning, queues with dedup keys, APIs honoring `Idempotency-Key`): safe to speculate in parallel; rollback is a keyed delete/compensate driven by the intent log. - **Non-idempotent, unkey...",
    "operational_effect": "The practical consequence is that **speculative fan-out with real effects requires a write-ahead intent journal and a probe-before-absent rule**, or it silently leaks. The divergence report will look clean; the cost shows up as orphaned resources, duplicate notifications, or double-charges discovered days later. Teams typically first notice it as an unexplai..."
  },
  "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": "700036fac6a3dab61407a02f984c1b5620ad784299538abf95226fcf94e1aadd",
    "verified_classes": [
      "SpeculativeRollbackViolation",
      "BranchEffects"
    ],
    "verified_functions": [
      "reconcile_branch",
      "assert_no_leak"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpeculativeRollbackViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
