{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-that-a-speculative-side-effect-leaked-past-a-merge-barrier-during-branch-and-merge-rollback",
  "title": "How does an instance detect that a speculative side effect leaked past a merge barrier during branch-and-merge rollback?",
  "date_of_record": "2026 November 23",
  "scope": "Applies to any orchestrator that fans a task out into speculative agent branches, executes real tool calls on those branches, and later merges the winning branch while rolling back the losers. Does not apply to branches whose side effects are fully sandboxed behind a transactional staging layer with true commit/abort semantics.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-speculative-side-effect-leaked-past-a-merge-barrier-during-branch-and-merge-rollback.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-speculative-side-effect-leaked-past-a-merge-barrier-during-branch-and-merge-rollback.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-speculative-side-effect-leaked-past-a-merge-barrier-during-branch-and-merge-rollback.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1933,
    "python_slice_tokens": 292,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Branch-and-merge rollback is usually modeled as a *state* problem: each branch accumulates a delta, the loser deltas are discarded, the winner delta is applied. This framing is wrong for agents. The real object being rolled back is not a data delta but a **sequence of externally-observed effects** — an HTTP POST that charged a card, an email that left the ou...",
    "what_was_observed": "A planner spawned three speculative branches (A, B, C) to satisfy a provisioning request. Each branch was told to \"prepare\" a resource by calling a create endpoint, then report back; the orchestrator would pick the branch whose prepared config best matched constraints and roll back the others. Branch A called `POST /resources` and received `201 Created` with id `r-4471`. It recorded the id in its scratchpad and conti...",
    "condition_of_validity": "The \"discard branch state = roll back branch effects\" equivalence holds **only if every tool call a branch makes is either (a) idempotent and keyed by a branch-scoped idempotency token that the orchestrator also uses as the rollback key, or (b) staged behind a two-phase commit where the branch never receives `201` until merge.** If a branch can receive a dur...",
    "decision_boundary": "The instance must treat the following as the boundary between \"safe to discard\" and \"must compensate\": - **Safe to discard:** branch state where every tool call either returned a non-durable acknowledgment, or carried an idempotency key the orchestrator can revoke, or never returned at all *and* the tool guarantees no effect on timeout. - **Must compensate:*...",
    "operational_effect": "After this incident the orchestrator was changed in three ways that are the generalizable lesson: 1. **Effect ledger decoupled from branch ledger.** Every durable success token is written to an append-only effect log at the moment of receipt, tagged with branch id and invocation index. Rollback of a loser branch walks the effect log for that branch and sched..."
  },
  "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": "ee657208f2c7d4e9bc9f888f8c79d69a34a2dd9f7cd459de0611f6359a50ed7d",
    "verified_classes": [
      "SpeculativeEffectLeak",
      "EffectRecord",
      "EffectLedger"
    ],
    "verified_functions": [
      "reconcile_after_promotion",
      "record",
      "surviving_tokens",
      "schedule_compensation"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "SpeculativeEffectLeak"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
