{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-speculatively-fork-agent-branches-and-then-merge-a-rolled-back-sibling-s-side-effects-into-the-surviving-branch-s-memory",
  "title": "Why does an instance speculatively fork agent branches and then merge a rolled-back sibling's side effects into the surviving branch's memory",
  "date_of_record": "2026 November 27",
  "scope": "Applies to orchestrators that reduce tail latency by speculatively forking two or more agent branches from a shared checkpoint, racing them against a wall-clock or token budget, and merging the winner's state while discarding the loser. Does not apply to single-branch execution, pure fan-out map-reduce with read-only workers, or branches that never mutate external state.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-speculatively-fork-agent-branches-and-then-merge-a-rolled-back-sibling-s-side-effects-into-the-surviving-branch-s-memory.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-speculatively-fork-agent-branches-and-then-merge-a-rolled-back-sibling-s-side-effects-into-the-surviving-branch-s-memory.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-speculatively-fork-agent-branches-and-then-merge-a-rolled-back-sibling-s-side-effects-into-the-surviving-branch-s-memory.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2371,
    "python_slice_tokens": 429,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two things an orchestrator believes it can roll back when it kills a speculative branch: *context* and *effects*. Context rollback is cheap and exact — you drop the loser's message list, tool-call transcript, and KV cache suffix and rehydrate from the checkpoint. Effect rollback is neither cheap nor exact, because effects escape the process: a `wri...",
    "what_was_observed": "A retrieval-augmented agent was asked to reconcile a customer record. The orchestrator forked two speculative branches from a checkpoint taken after the initial `get_customer` call: - **Branch A (conservative):** re-read the record, decided the address field was stale, and issued `PATCH /customer/4471 {address: ...}`. - **Branch B (aggressive):** decided the record was fine but the *account tier* was mis-set, and iss...",
    "condition_of_validity": "Speculative fork/merge is safe only under one of the following, and the orchestrator must be able to *prove* which regime it is in before forking: - **Effect isolation (strongest).** Loser branches execute against a sandboxed tool surface — an overlay filesystem, a transactional DB session that is rolled back on cancel, a mock transport that buffers outbound...",
    "decision_boundary": "The orchestrator must decide, per tool call and *before* dispatch, whether the call is speculative-safe. The boundary is: - **Fork freely** when the branch's tool manifest is entirely `side_effect_free` or runs against an isolated overlay. - **Fork with tagging** when effects are mutating but the tool server honors `commit_epoch` fencing; the merge step must...",
    "operational_effect": "The practical consequences for any orchestrator implementing speculative fork/merge: 1. **Cancellation must be effect-aware.** Track a per-branch `inflight_effects` counter and a `committed_epoch`. A branch may only be cancelled when `inflight_effects == 0`; otherwise the cancellation is deferred until the effect resolves, at which point the branch is either..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "8d0d152c0c37b23979290b9a74724d604bf7ef1f40a2315c3126732b250c485b",
    "verified_classes": [
      "SpeculativeMergeViolation",
      "BranchState",
      "Effect",
      "Branch"
    ],
    "verified_functions": [
      "merge",
      "dispatch_mutating",
      "acknowledge",
      "request_cancel"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "SpeculativeMergeViolation"
    ],
    "sample_fail_closed_invariants": [
      "merge divergence: visible effect set does not match committed-branch effect log"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
